File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -378,14 +378,24 @@ def undefine0(genv)
378378 end
379379
380380 def install0 ( genv )
381- cond_tys = @exceptions . map { |exc |
382- exc . install ( genv )
383- Type ::Instance . new ( genv , genv . resolve_cpath ( exc . static_ret . cpath ) , [ ] )
384- }
381+ cond_vtxs = @exceptions . map do |exc |
382+ case exc
383+ when AST ::SplatNode
384+ ary_vtx = exc . expr . install ( genv )
385+ @changes . add_splat_box ( genv , ary_vtx ) . ret
386+ else
387+ exc . install ( genv )
388+ end
389+ end
390+
385391 if @reference
386392 @reference . install ( genv )
387- @changes . add_edge ( genv , Source . new ( *cond_tys ) , @reference . rhs . ret )
393+ cond_vtxs . each do |cond_vtx |
394+ instance_ty_box = @changes . add_instance_type_box ( genv , cond_vtx )
395+ @changes . add_edge ( genv , instance_ty_box . ret , @reference . rhs . ret )
396+ end
388397 end
398+
389399 if @statements
390400 @statements . install ( genv )
391401 else
Original file line number Diff line number Diff line change @@ -1032,4 +1032,24 @@ def run0(genv, changes)
10321032 end
10331033 end
10341034 end
1035+
1036+ class InstanceTypeBox < Box
1037+ def initialize ( node , genv , singleton_ty_vtx )
1038+ super ( node )
1039+ @singleton_ty_vtx = singleton_ty_vtx
1040+ @ret = Vertex . new ( node )
1041+ genv . add_run ( self )
1042+ end
1043+
1044+ attr_reader :ret
1045+
1046+ def run0 ( genv , changes )
1047+ instance_tys = [ ]
1048+ @singleton_ty_vtx . each_type do |ty |
1049+ instance_tys << ty . get_instance_type ( genv )
1050+ end
1051+ source_vtx = Source . new ( *instance_tys )
1052+ changes . add_edge ( genv , source_vtx , @ret )
1053+ end
1054+ end
10351055end
Original file line number Diff line number Diff line change @@ -141,6 +141,12 @@ def add_type_read_box(genv, type)
141141 @new_boxes [ key ] = TypeReadBox . new ( @node , genv , type )
142142 end
143143
144+ def add_instance_type_box ( genv , singleton_ty_vtx )
145+ key = [ :instance_type , singleton_ty_vtx ]
146+ return if @new_boxes [ key ]
147+ @new_boxes [ key ] = InstanceTypeBox . new ( @node , genv , singleton_ty_vtx )
148+ end
149+
144150 def add_diagnostic ( meth , msg )
145151 @new_diagnostics << TypeProf ::Diagnostic . new ( @node , meth , msg )
146152 end
You can’t perform that action at this time.
0 commit comments