Class: TypeProf::Core::MAsgnBox
- Defined in:
- lib/typeprof/core/graph/box.rb
Instance Attribute Summary collapse
-
#lefts ⇒ Object
readonly
Returns the value of attribute lefts.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#rest_elem ⇒ Object
readonly
Returns the value of attribute rest_elem.
-
#rights ⇒ Object
readonly
Returns the value of attribute rights.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Box
Instance Method Summary collapse
- #destroy(genv) ⇒ Object
-
#initialize(node, genv, value, lefts, rest_elem, rights) ⇒ MAsgnBox
constructor
A new instance of MAsgnBox.
- #ret ⇒ Object
- #run0(genv, changes) ⇒ Object
Methods inherited from Box
#add_symbol_proc_call_box, #destroy_symbol_proc_call_boxes, #on_type_added, #on_type_removed, #reuse, #run, #to_s
Constructor Details
#initialize(node, genv, value, lefts, rest_elem, rights) ⇒ MAsgnBox
Returns a new instance of MAsgnBox.
1491 1492 1493 1494 1495 1496 1497 1498 |
# File 'lib/typeprof/core/graph/box.rb', line 1491 def initialize(node, genv, value, lefts, rest_elem, rights) super(node) @value = value @lefts = lefts @rest_elem = rest_elem @rights = rights @value.add_edge(genv, self) end |
Instance Attribute Details
#lefts ⇒ Object (readonly)
Returns the value of attribute lefts.
1500 1501 1502 |
# File 'lib/typeprof/core/graph/box.rb', line 1500 def lefts @lefts end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
1500 1501 1502 |
# File 'lib/typeprof/core/graph/box.rb', line 1500 def node @node end |
#rest_elem ⇒ Object (readonly)
Returns the value of attribute rest_elem.
1500 1501 1502 |
# File 'lib/typeprof/core/graph/box.rb', line 1500 def rest_elem @rest_elem end |
#rights ⇒ Object (readonly)
Returns the value of attribute rights.
1500 1501 1502 |
# File 'lib/typeprof/core/graph/box.rb', line 1500 def rights @rights end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
1500 1501 1502 |
# File 'lib/typeprof/core/graph/box.rb', line 1500 def value @value end |
Instance Method Details
#destroy(genv) ⇒ Object
1502 1503 1504 1505 |
# File 'lib/typeprof/core/graph/box.rb', line 1502 def destroy(genv) @value.remove_edge(genv, self) # TODO: Is this really needed? super(genv) end |
#ret ⇒ Object
1507 |
# File 'lib/typeprof/core/graph/box.rb', line 1507 def ret = @rhs |
#run0(genv, changes) ⇒ Object
1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 |
# File 'lib/typeprof/core/graph/box.rb', line 1509 def run0(genv, changes) @value.each_type do |ty| # TODO: call to_ary? case ty when Type::Array ty.splat_assign(genv, @lefts, @rest_elem, @rights).each do |src, dst| changes.add_edge(genv, src, dst) end when Type::Instance if ty.mod == genv.mod_ary && (elem_vtx = ty.args[0]) @lefts.each {|lhs| changes.add_edge(genv, elem_vtx, lhs) } changes.add_edge(genv, elem_vtx, @rest_elem) if @rest_elem @rights&.each {|rhs| changes.add_edge(genv, elem_vtx, rhs) } else lhs = @lefts[0] || (@rights && @rights[0]) || @rest_elem changes.add_edge(genv, Source.new(ty), lhs) if lhs end else lhs = @lefts[0] || (@rights && @rights[0]) || @rest_elem changes.add_edge(genv, Source.new(ty), lhs) if lhs end end end |