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



310
311
312
313
314
315
316
# File 'lib/typeprof/core/graph/box.rb', line 310

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.



320
321
322
# File 'lib/typeprof/core/graph/box.rb', line 320

def hsh
  @hsh
end

#unified_keyObject (readonly)

Returns the value of attribute unified_key.



320
321
322
# File 'lib/typeprof/core/graph/box.rb', line 320

def unified_key
  @unified_key
end

#unified_valObject (readonly)

Returns the value of attribute unified_val.



320
321
322
# File 'lib/typeprof/core/graph/box.rb', line 320

def unified_val
  @unified_val
end

Instance Method Details

#retObject

dummy



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

def ret = @hsh # dummy

#run0(genv, changes) ⇒ Object



322
323
324
325
326
327
328
329
330
331
332
# File 'lib/typeprof/core/graph/box.rb', line 322

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], @unified_key)
      changes.add_edge(genv, ty.args[1], @unified_val)
    else
      "???"
    end
  end
end