class TypeProf::Core::EscapeBox::HashSplatBox::IVarReadBox

Attributes

const_read[R]
node[R]
ret[R]

Public Class Methods

new(node, genv, cpath, singleton, name) click to toggle source
Calls superclass method TypeProf::Core::Box::new
# File typeprof-0.30.1/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

Public Instance Methods

destroy(genv) click to toggle source
Calls superclass method TypeProf::Core::Box#destroy
# File typeprof-0.30.1/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) click to toggle source
# File typeprof-0.30.1/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