class TypeProf::Core::EscapeBox::HashSplatBox::CVarReadBox - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::EscapeBox::HashSplatBox::CVarReadBox

### Attributes

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

### Public Class Methods

new(node, genv, cpath, name) click to toggle source
Calls superclass method `TypeProf::Core::Box::new`

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 915
    def initialize(node, genv, cpath, name)
      super(node)
      @cpath = cpath
      @name = name
      genv.resolve_cpath(cpath).cvar_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 927
    def destroy(genv)
      genv.resolve_cpath(@cpath).cvar_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 932
    def run0(genv, changes)
      mod = genv.resolve_cpath(@cpath)
      cur_cve = mod.get_cvar(@name)
      target_vtx = nil
      genv.each_direct_superclass(mod, nil) do |mod, _|
        cve = mod.get_cvar(@name)
        if cve.exist?
          target_vtx = cve.vtx
        end
      end

      edges = []
      if target_vtx
        if target_vtx != cur_cve.vtx
          edges << [cur_cve.vtx, @proxy] << [@proxy, target_vtx]
        end
        edges << [target_vtx, @ret]
      end

      edges.each do |src, dst|
        changes.add_edge(genv, src, dst)
      end
    end