Class: TypeProf::Core::MethodAliasBox

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

Instance Attribute Summary collapse

Attributes inherited from Box

#changes, #destroyed

Instance Method Summary collapse

Methods inherited from Box

#diagnostics, #on_type_added, #on_type_removed, #reuse, #run, #to_s

Constructor Details

#initialize(node, genv, cpath, singleton, new_mid, old_mid) ⇒ MethodAliasBox

Returns a new instance of MethodAliasBox.



619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
# File 'lib/typeprof/core/graph/box.rb', line 619

def initialize(node, genv, cpath, singleton, new_mid, old_mid)
  super(node)
  @cpath = cpath
  @singleton = singleton
  @new_mid = new_mid
  @old_mid = old_mid
  @ret = Source.new(genv.nil_type)

  me = genv.resolve_method(@cpath, @singleton, @new_mid)
  me.add_alias(self, @old_mid)
  if me.decls.empty?
    me.add_run_all_method_call_boxes(genv)
  else
    genv.add_run(self)
  end
end

Instance Attribute Details

#cpathObject (readonly)

Returns the value of attribute cpath.



638
639
640
# File 'lib/typeprof/core/graph/box.rb', line 638

def cpath
  @cpath
end

#new_midObject (readonly)

Returns the value of attribute new_mid.



638
639
640
# File 'lib/typeprof/core/graph/box.rb', line 638

def new_mid
  @new_mid
end

#nodeObject

Returns the value of attribute node.



636
637
638
# File 'lib/typeprof/core/graph/box.rb', line 636

def node
  @node
end

#old_midObject (readonly)

Returns the value of attribute old_mid.



638
639
640
# File 'lib/typeprof/core/graph/box.rb', line 638

def old_mid
  @old_mid
end

#retObject (readonly)

Returns the value of attribute ret.



638
639
640
# File 'lib/typeprof/core/graph/box.rb', line 638

def ret
  @ret
end

#singletonObject (readonly)

Returns the value of attribute singleton.



638
639
640
# File 'lib/typeprof/core/graph/box.rb', line 638

def singleton
  @singleton
end

Instance Method Details

#destroy(genv) ⇒ Object



640
641
642
643
644
645
646
647
648
649
# File 'lib/typeprof/core/graph/box.rb', line 640

def destroy(genv)
  me = genv.resolve_method(@cpath, @singleton, @new_mid)
  me.remove_alias(self)
  if me.decls.empty?
    me.add_run_all_method_call_boxes(genv)
  else
    genv.add_run(self)
  end
  super(genv)
end

#run0(genv, changes) ⇒ Object



651
652
653
# File 'lib/typeprof/core/graph/box.rb', line 651

def run0(genv, changes)
  # TODO: what to do?
end