Class: YARP::GlobalVariableWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::GlobalVariableWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents writing to a global variable.
$foo = 1
^^^^^^^^
Instance Attribute Summary collapse
-
#name_loc ⇒ Object
readonly
attr_reader name_loc: Location.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location?.
-
#value ⇒ Object
readonly
attr_reader value: Node?.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name_loc, operator_loc, value, location) ⇒ GlobalVariableWriteNode
constructor
def initialize: (name_loc: Location, operator_loc: Location?, value: Node?, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String.
-
#operator ⇒ Object
def operator: () -> String?.
Constructor Details
#initialize(name_loc, operator_loc, value, location) ⇒ GlobalVariableWriteNode
def initialize: (name_loc: Location, operator_loc: Location?, value: Node?, location: Location) -> void
2790 2791 2792 2793 2794 2795 |
# File 'lib/yarp/node.rb', line 2790 def initialize(name_loc, operator_loc, value, location) @name_loc = name_loc @operator_loc = operator_loc @value = value @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
2781 2782 2783 |
# File 'lib/yarp/node.rb', line 2781 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location?
2784 2785 2786 |
# File 'lib/yarp/node.rb', line 2784 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node?
2787 2788 2789 |
# File 'lib/yarp/node.rb', line 2787 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
2798 2799 2800 |
# File 'lib/yarp/node.rb', line 2798 def accept(visitor) visitor.visit_global_variable_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
2803 2804 2805 |
# File 'lib/yarp/node.rb', line 2803 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
2811 2812 2813 |
# File 'lib/yarp/node.rb', line 2811 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location } end |
#name ⇒ Object
def name: () -> String
2816 2817 2818 |
# File 'lib/yarp/node.rb', line 2816 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String?
2821 2822 2823 |
# File 'lib/yarp/node.rb', line 2821 def operator operator_loc&.slice end |