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

#destroy, #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.



367
368
369
370
371
372
373
# File 'lib/typeprof/core/graph/box.rb', line 367

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.



377
378
379
# File 'lib/typeprof/core/graph/box.rb', line 377

def hsh
  @hsh
end

#unified_keyObject (readonly)

Returns the value of attribute unified_key.



377
378
379
# File 'lib/typeprof/core/graph/box.rb', line 377

def unified_key
  @unified_key
end

#unified_valObject (readonly)

Returns the value of attribute unified_val.



377
378
379
# File 'lib/typeprof/core/graph/box.rb', line 377

def unified_val
  @unified_val
end

Instance Method Details

#retObject

dummy



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

def ret = @hsh # dummy

#run0(genv, changes) ⇒ Object



379
380
381
382
383
384
385
386
387
388
389
# File 'lib/typeprof/core/graph/box.rb', line 379

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