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, = baz
^^^ ^^^
foo => 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.
-
#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.
12271 12272 12273 12274 12275 12276 12277 12278 |
# File 'lib/prism/node.rb', line 12271 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
12317 12318 12319 |
# File 'lib/prism/node.rb', line 12317 def depth @depth end |
#name ⇒ Object (readonly)
attr_reader name: Symbol
12314 12315 12316 |
# File 'lib/prism/node.rb', line 12314 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
12330 12331 12332 |
# File 'lib/prism/node.rb', line 12330 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.
12336 12337 12338 12339 12340 |
# File 'lib/prism/node.rb', line 12336 def ===(other) other.is_a?(LocalVariableTargetNode) && (name === other.name) && (depth === other.depth) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
12281 12282 12283 |
# File 'lib/prism/node.rb', line 12281 def accept(visitor) visitor.visit_local_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
12286 12287 12288 |
# File 'lib/prism/node.rb', line 12286 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
12296 12297 12298 |
# File 'lib/prism/node.rb', line 12296 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
12291 12292 12293 |
# File 'lib/prism/node.rb', line 12291 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
12301 12302 12303 |
# File 'lib/prism/node.rb', line 12301 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 }
12309 12310 12311 |
# File 'lib/prism/node.rb', line 12309 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name, depth: depth } end |
#inspect ⇒ Object
def inspect -> String
12320 12321 12322 |
# File 'lib/prism/node.rb', line 12320 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
12325 12326 12327 |
# File 'lib/prism/node.rb', line 12325 def type :local_variable_target_node end |