class TypeProf::Core::AST::LocalVariableReadNode::LocalVariableWriteNode::InstanceVariableReadNode::InstanceVariableWriteNode::GlobalVariableReadNode::GlobalVariableWriteNode::PostExecutionNode::ClassVariableWriteNode
Attributes
rhs[R]
var[R]
var_code_range[R]
Public Class Methods
new(raw_node, rhs, lenv)
click to toggle source
Calls superclass method
TypeProf::Core::AST::Node::new
# File typeprof-0.30.1/lib/typeprof/core/ast/variable.rb, line 234 def initialize(raw_node, rhs, lenv) super(raw_node, lenv) @var = raw_node.name @var_code_range = TypeProf::CodeRange.from_node(raw_node.respond_to?(:name_loc) ? raw_node.name_loc : raw_node) @rhs = rhs end
Public Instance Methods
attrs(= { var: })
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/variable.rb, line 244 def attrs = { var: } def define0(genv) @rhs.define(genv) if @rhs mod = genv.resolve_cvar(@lenv.cref.cpath, @var) mod.add_def(self) mod end def define_copy(genv) mod = genv.resolve_cvar(@lenv.cref.cpath, @var) mod.add_def(self) mod.remove_def(@prev_node) super(genv) end def undefine0(genv) mod = genv.resolve_cvar(@lenv.cref.cpath, @var) mod.remove_def(self) @rhs.undefine(genv) if @rhs end def install0(genv) @changes.add_cvar_read_box(genv, @lenv.cref.cpath, @var) val = @rhs.install(genv) val = val.new_vertex(genv, self) # avoid multi-edge from val to static_ret.vtx @changes.add_edge(genv, val, @static_ret.vtx) val end def retrieve_at(pos, &blk) yield self if @var_code_range && @var_code_range.include?(pos) super(pos, &blk) end end
define0(genv)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/variable.rb, line 246 def define0(genv) @rhs.define(genv) if @rhs mod = genv.resolve_cvar(@lenv.cref.cpath, @var) mod.add_def(self) mod end
define_copy(genv)
click to toggle source
Calls superclass method
TypeProf::Core::AST::Node#define_copy
# File typeprof-0.30.1/lib/typeprof/core/ast/variable.rb, line 253 def define_copy(genv) mod = genv.resolve_cvar(@lenv.cref.cpath, @var) mod.add_def(self) mod.remove_def(@prev_node) super(genv) end
install0(genv)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/variable.rb, line 266 def install0(genv) @changes.add_cvar_read_box(genv, @lenv.cref.cpath, @var) val = @rhs.install(genv) val = val.new_vertex(genv, self) # avoid multi-edge from val to static_ret.vtx @changes.add_edge(genv, val, @static_ret.vtx) val end
retrieve_at(pos) { |self| ... }
click to toggle source
Calls superclass method
TypeProf::Core::AST::Node#retrieve_at
# File typeprof-0.30.1/lib/typeprof/core/ast/variable.rb, line 274 def retrieve_at(pos, &blk) yield self if @var_code_range && @var_code_range.include?(pos) super(pos, &blk) end
subnodes(= { rhs: })
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/variable.rb, line 243 def subnodes = { rhs: } def attrs = { var: } def define0(genv) @rhs.define(genv) if @rhs mod = genv.resolve_cvar(@lenv.cref.cpath, @var) mod.add_def(self) mod end def define_copy(genv) mod = genv.resolve_cvar(@lenv.cref.cpath, @var) mod.add_def(self) mod.remove_def(@prev_node) super(genv) end def undefine0(genv) mod = genv.resolve_cvar(@lenv.cref.cpath, @var) mod.remove_def(self) @rhs.undefine(genv) if @rhs end def install0(genv) @changes.add_cvar_read_box(genv, @lenv.cref.cpath, @var) val = @rhs.install(genv) val = val.new_vertex(genv, self) # avoid multi-edge from val to static_ret.vtx @changes.add_edge(genv, val, @static_ret.vtx) val end def retrieve_at(pos, &blk) yield self if @var_code_range && @var_code_range.include?(pos) super(pos, &blk) end end class ClassVariableReadNode < Node def initialize(raw_node, lenv) super(raw_node, lenv) @var = raw_node.name end attr_reader :var def attrs = { var: } def install0(genv) box = @changes.add_cvar_read_box(genv, lenv.cref.cpath, @var) @lenv.apply_read_filter(genv, self, @var, box.ret) end def retrieve_at(pos) yield self if code_range.include?(pos) end end class RegexpReferenceReadNode < Node def initialize(raw_node, lenv) super(raw_node, lenv) @var = raw_node.type == :back_reference_read_node ? :"$&" : :"$#{raw_node.number}" end attr_reader :var def attrs = { var: } def install0(genv) Source.new(genv.str_type) end end end
undefine0(genv)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/variable.rb, line 260 def undefine0(genv) mod = genv.resolve_cvar(@lenv.cref.cpath, @var) mod.remove_def(self) @rhs.undefine(genv) if @rhs end