class TypeProf::Core::AST::ConstantReadNode::ConstantWriteNode
Attributes
Public Class Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/const.rb, line 53 def initialize(raw_node, rhs, lenv) super(raw_node, lenv) case raw_node.type when :constant_write_node, :constant_target_node, :constant_operator_write_node, :constant_or_write_node, :constant_and_write_node # C = expr @cpath = nil @static_cpath = lenv.cref.cpath + [raw_node.name] @cname_code_range = TypeProf::CodeRange.from_node(raw_node.respond_to?(:name_loc) ? raw_node.name_loc : raw_node) when :constant_path_write_node, :constant_path_operator_write_node, :constant_path_or_write_node, :constant_path_and_write_node # expr::C = expr @cpath = AST.create_node(raw_node.target, lenv) @static_cpath = AST.parse_cpath(raw_node.target, lenv.cref) @cname_code_range = TypeProf::CodeRange.from_node(raw_node.target) when :constant_path_target_node # expr::C, * = ary @cpath = ConstantReadNode.new(raw_node, lenv) @static_cpath = AST.parse_cpath(raw_node, lenv.cref) @cname_code_range = TypeProf::CodeRange.from_node(raw_node) else raise end @rhs = rhs end
Calls superclass method
TypeProf::Core::AST::Node::new
Public Instance Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/const.rb, line 80 def attrs = { static_cpath: } def define0(genv) @cpath.define(genv) if @cpath @rhs.define(genv) if @rhs if @static_cpath mod = genv.resolve_const(@static_cpath) mod.add_def(self) mod else nil end end def define_copy(genv) if @static_cpath mod = genv.resolve_const(@static_cpath) mod.add_def(self) mod.remove_def(@prev_node) end super(genv) end def undefine0(genv) if @static_cpath genv.resolve_const(@static_cpath).remove_def(self) end @rhs.undefine(genv) if @rhs @cpath.undefine(genv) if @cpath end def install0(genv) @cpath.install(genv) if @cpath val = @rhs.install(genv) if @static_cpath @changes.add_edge(genv, val, @static_ret.vtx) end val end end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/const.rb, line 82 def define0(genv) @cpath.define(genv) if @cpath @rhs.define(genv) if @rhs if @static_cpath mod = genv.resolve_const(@static_cpath) mod.add_def(self) mod else nil end end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/const.rb, line 94 def define_copy(genv) if @static_cpath mod = genv.resolve_const(@static_cpath) mod.add_def(self) mod.remove_def(@prev_node) end super(genv) end
Calls superclass method
TypeProf::Core::AST::Node#define_copy
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/const.rb, line 111 def install0(genv) @cpath.install(genv) if @cpath val = @rhs.install(genv) if @static_cpath @changes.add_edge(genv, val, @static_ret.vtx) end val end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/const.rb, line 79 def subnodes = { cpath:, rhs: } def attrs = { static_cpath: } def define0(genv) @cpath.define(genv) if @cpath @rhs.define(genv) if @rhs if @static_cpath mod = genv.resolve_const(@static_cpath) mod.add_def(self) mod else nil end end def define_copy(genv) if @static_cpath mod = genv.resolve_const(@static_cpath) mod.add_def(self) mod.remove_def(@prev_node) end super(genv) end def undefine0(genv) if @static_cpath genv.resolve_const(@static_cpath).remove_def(self) end @rhs.undefine(genv) if @rhs @cpath.undefine(genv) if @cpath end def install0(genv) @cpath.install(genv) if @cpath val = @rhs.install(genv) if @static_cpath @changes.add_edge(genv, val, @static_ret.vtx) end val end end end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/ast/const.rb, line 103 def undefine0(genv) if @static_cpath genv.resolve_const(@static_cpath).remove_def(self) end @rhs.undefine(genv) if @rhs @cpath.undefine(genv) if @cpath end