Class: Prism::LocalVariableTargetNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::LocalVariableTargetNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents writing to a local variable in a context that doesn’t have an explicit value.
foo, bar = baz
^^^ ^^^
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
attr_reader depth: Integer.
-
#name ⇒ Object
readonly
attr_reader name: Symbol.
Class Method Summary collapse
-
.type ⇒ Object
Return a symbol representation of this node type.
Instance Method Summary collapse
-
#===(other) ⇒ Object
Implements case-equality for the node.
-
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name, depth: self.depth) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol, depth: Integer }.
-
#initialize(source, node_id, location, flags, name, depth) ⇒ LocalVariableTargetNode
constructor
Initialize a new LocalVariableTargetNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags, name, depth) ⇒ LocalVariableTargetNode
Initialize a new LocalVariableTargetNode node.
12129 12130 12131 12132 12133 12134 12135 12136 |
# File 'lib/prism/node.rb', line 12129 def initialize(source, node_id, location, flags, name, depth) @source = source @node_id = node_id @location = location @flags = flags @name = name @depth = depth end |
Instance Attribute Details
#depth ⇒ Object (readonly)
attr_reader depth: Integer
12175 12176 12177 |
# File 'lib/prism/node.rb', line 12175 def depth @depth end |
#name ⇒ Object (readonly)
attr_reader name: Symbol
12172 12173 12174 |
# File 'lib/prism/node.rb', line 12172 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
12188 12189 12190 |
# File 'lib/prism/node.rb', line 12188 def self.type :local_variable_target_node end |
Instance Method Details
#===(other) ⇒ Object
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
12194 12195 12196 12197 12198 |
# File 'lib/prism/node.rb', line 12194 def ===(other) other.is_a?(LocalVariableTargetNode) && (name === other.name) && (depth === other.depth) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
12139 12140 12141 |
# File 'lib/prism/node.rb', line 12139 def accept(visitor) visitor.visit_local_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
12144 12145 12146 |
# File 'lib/prism/node.rb', line 12144 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
12154 12155 12156 |
# File 'lib/prism/node.rb', line 12154 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
12149 12150 12151 |
# File 'lib/prism/node.rb', line 12149 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name, depth: self.depth) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode
12159 12160 12161 |
# File 'lib/prism/node.rb', line 12159 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name, depth: self.depth) LocalVariableTargetNode.new(source, node_id, location, flags, name, depth) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol, depth: Integer }
12167 12168 12169 |
# File 'lib/prism/node.rb', line 12167 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name, depth: depth } end |
#inspect ⇒ Object
def inspect -> String
12178 12179 12180 |
# File 'lib/prism/node.rb', line 12178 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
12183 12184 12185 |
# File 'lib/prism/node.rb', line 12183 def type :local_variable_target_node end |