Class: TypeProf::Core::HashSplatBox

Inherits:
Box
  • Object
show all
Defined in:
lib/typeprof/core/graph/box.rb

Instance Attribute Summary collapse

Attributes inherited from Box

#changes, #destroyed, #node

Instance Method Summary collapse

Methods inherited from Box

#add_symbol_proc_call_box, #destroy, #destroy_symbol_proc_call_boxes, #on_type_added, #on_type_removed, #reuse, #run, #to_s

Constructor Details

#initialize(node, genv, hsh, unified_key, unified_val) ⇒ HashSplatBox

Returns a new instance of HashSplatBox.



714
715
716
717
718
719
720
# File 'lib/typeprof/core/graph/box.rb', line 714

def initialize(node, genv, hsh, unified_key, unified_val)
  super(node)
  @hsh = hsh
  @unified_key = unified_key
  @unified_val = unified_val
  @hsh.add_edge(genv, self)
end

Instance Attribute Details

#hshObject (readonly)

Returns the value of attribute hsh.



724
725
726
# File 'lib/typeprof/core/graph/box.rb', line 724

def hsh
  @hsh
end

#unified_keyObject (readonly)

Returns the value of attribute unified_key.



724
725
726
# File 'lib/typeprof/core/graph/box.rb', line 724

def unified_key
  @unified_key
end

#unified_valObject (readonly)

Returns the value of attribute unified_val.



724
725
726
# File 'lib/typeprof/core/graph/box.rb', line 724

def unified_val
  @unified_val
end

Instance Method Details

#retObject

dummy



722
# File 'lib/typeprof/core/graph/box.rb', line 722

def ret = @hsh # dummy

#run0(genv, changes) ⇒ Object



726
727
728
729
730
731
732
733
734
735
736
# File 'lib/typeprof/core/graph/box.rb', line 726

def run0(genv, changes)
  @hsh.each_type do |ty|
    ty = ty.base_type(genv)
    if ty.mod == genv.mod_hash
      changes.add_edge(genv, ty.args[0].new_vertex(genv, :__hash_splat), @unified_key)
      changes.add_edge(genv, ty.args[1].new_vertex(genv, :__hash_splat), @unified_val)
    else
      "???"
    end
  end
end