class YARP::LocalVariableReadNode
Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope, otherwise it is parsed as a method call.
foo ^^^
Attributes
depth[R]
attr_reader depth: Integer
name[R]
attr_reader name: Symbol
Public Class Methods
new(name, depth, location)
click to toggle source
def initialize: (name: Symbol, depth: Integer, location: Location
) -> void
# File yarp/node.rb, line 6943 def initialize(name, depth, location) @name = name @depth = depth @location = location end
Public Instance Methods
accept(visitor)
click to toggle source
def accept: (visitor: Visitor
) -> void
# File yarp/node.rb, line 6950 def accept(visitor) visitor.visit_local_variable_read_node(self) end
child_nodes()
click to toggle source
def child_nodes
: () -> Array[nil | Node]
# File yarp/node.rb, line 6955 def child_nodes [] end
Also aliased as: deconstruct
comment_targets()
click to toggle source
def comment_targets
: () -> Array[Node | Location]
# File yarp/node.rb, line 6960 def comment_targets [] end
copy(**params)
click to toggle source
def copy: (**params) -> LocalVariableReadNode
# File yarp/node.rb, line 6965 def copy(**params) LocalVariableReadNode.new( params.fetch(:name) { name }, params.fetch(:depth) { depth }, params.fetch(:location) { location }, ) end
deconstruct_keys(keys)
click to toggle source
inspect(inspector = NodeInspector.new)
click to toggle source
# File yarp/node.rb, line 6981 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "├── name: #{name.inspect}\n" inspector << "└── depth: #{depth.inspect}\n" inspector.to_str end