Class: Prism::GlobalVariableTargetNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::GlobalVariableTargetNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents writing to a global variable in a context that doesn’t have an explicit value.
$foo, $bar = baz
^^^^ ^^^^
Instance Attribute Summary collapse
-
#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) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableTargetNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }.
-
#initialize(source, node_id, location, flags, name) ⇒ GlobalVariableTargetNode
constructor
Initialize a new GlobalVariableTargetNode 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) ⇒ GlobalVariableTargetNode
Initialize a new GlobalVariableTargetNode node.
7970 7971 7972 7973 7974 7975 7976 |
# File 'lib/prism/node.rb', line 7970 def initialize(source, node_id, location, flags, name) @source = source @node_id = node_id @location = location @flags = flags @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
8012 8013 8014 |
# File 'lib/prism/node.rb', line 8012 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
8025 8026 8027 |
# File 'lib/prism/node.rb', line 8025 def self.type :global_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.
8031 8032 8033 8034 |
# File 'lib/prism/node.rb', line 8031 def ===(other) other.is_a?(GlobalVariableTargetNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
7979 7980 7981 |
# File 'lib/prism/node.rb', line 7979 def accept(visitor) visitor.visit_global_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
7984 7985 7986 |
# File 'lib/prism/node.rb', line 7984 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
7994 7995 7996 |
# File 'lib/prism/node.rb', line 7994 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
7989 7990 7991 |
# File 'lib/prism/node.rb', line 7989 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableTargetNode
7999 8000 8001 |
# File 'lib/prism/node.rb', line 7999 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) GlobalVariableTargetNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }
8007 8008 8009 |
# File 'lib/prism/node.rb', line 8007 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name } end |
#inspect ⇒ Object
def inspect -> String
8015 8016 8017 |
# File 'lib/prism/node.rb', line 8015 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
8020 8021 8022 |
# File 'lib/prism/node.rb', line 8020 def type :global_variable_target_node end |