Class: TypeProf::Core::IVarReadBox
- Defined in:
- lib/typeprof/core/graph/box.rb
Instance Attribute Summary collapse
-
#const_read ⇒ Object
readonly
Returns the value of attribute const_read.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#ret ⇒ Object
readonly
Returns the value of attribute ret.
Attributes inherited from Box
Instance Method Summary collapse
- #destroy(genv) ⇒ Object
-
#initialize(node, genv, cpath, singleton, name) ⇒ IVarReadBox
constructor
A new instance of IVarReadBox.
- #run0(genv, changes) ⇒ Object
Methods inherited from Box
#diagnostics, #on_type_added, #on_type_removed, #reuse, #run, #to_s
Constructor Details
#initialize(node, genv, cpath, singleton, name) ⇒ IVarReadBox
Returns a new instance of IVarReadBox.
870 871 872 873 874 875 876 877 878 879 |
# File 'lib/typeprof/core/graph/box.rb', line 870 def initialize(node, genv, cpath, singleton, name) super(node) @cpath = cpath @singleton = singleton @name = name genv.resolve_cpath(cpath).ivar_reads << self @proxy = Vertex.new(node) @ret = Vertex.new(node) genv.add_run(self) end |
Instance Attribute Details
#const_read ⇒ Object (readonly)
Returns the value of attribute const_read.
881 882 883 |
# File 'lib/typeprof/core/graph/box.rb', line 881 def const_read @const_read end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
881 882 883 |
# File 'lib/typeprof/core/graph/box.rb', line 881 def node @node end |
#ret ⇒ Object (readonly)
Returns the value of attribute ret.
881 882 883 |
# File 'lib/typeprof/core/graph/box.rb', line 881 def ret @ret end |
Instance Method Details
#destroy(genv) ⇒ Object
883 884 885 886 |
# File 'lib/typeprof/core/graph/box.rb', line 883 def destroy(genv) genv.resolve_cpath(@cpath).ivar_reads.delete(self) super(genv) end |
#run0(genv, changes) ⇒ Object
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
# File 'lib/typeprof/core/graph/box.rb', line 888 def run0(genv, changes) mod = genv.resolve_cpath(@cpath) singleton = @singleton cur_ive = mod.get_ivar(singleton, @name) target_vtx = nil genv.each_direct_superclass(mod, singleton) do |mod, singleton| ive = mod.get_ivar(singleton, @name) if ive.exist? target_vtx = ive.vtx end end edges = [] if target_vtx if target_vtx != cur_ive.vtx edges << [cur_ive.vtx, @proxy] << [@proxy, target_vtx] end edges << [target_vtx, @ret] else # TODO: error? end edges.each do |src, dst| changes.add_edge(genv, src, dst) end end |