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 }.
-
#each_child_node ⇒ Object
def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator.
-
#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.
12991 12992 12993 12994 12995 12996 12997 12998 |
# File 'lib/prism/node.rb', line 12991 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
13043 13044 13045 |
# File 'lib/prism/node.rb', line 13043 def depth @depth end |
#name ⇒ Object (readonly)
attr_reader name: Symbol
13040 13041 13042 |
# File 'lib/prism/node.rb', line 13040 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See Node::type.
13056 13057 13058 |
# File 'lib/prism/node.rb', line 13056 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.
13062 13063 13064 13065 13066 |
# File 'lib/prism/node.rb', line 13062 def ===(other) other.is_a?(LocalVariableTargetNode) && (name === other.name) && (depth === other.depth) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
13001 13002 13003 |
# File 'lib/prism/node.rb', line 13001 def accept(visitor) visitor.visit_local_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
13006 13007 13008 |
# File 'lib/prism/node.rb', line 13006 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
13022 13023 13024 |
# File 'lib/prism/node.rb', line 13022 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
13017 13018 13019 |
# File 'lib/prism/node.rb', line 13017 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
13027 13028 13029 |
# File 'lib/prism/node.rb', line 13027 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 }
13035 13036 13037 |
# File 'lib/prism/node.rb', line 13035 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name, depth: depth } end |
#each_child_node ⇒ Object
def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator
13011 13012 13013 13014 |
# File 'lib/prism/node.rb', line 13011 def each_child_node return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ Object
def inspect -> String
13046 13047 13048 |
# File 'lib/prism/node.rb', line 13046 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
13051 13052 13053 |
# File 'lib/prism/node.rb', line 13051 def type :local_variable_target_node end |