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
2778 2779 2780 2781 2782 2783 |
# File 'lib/yarp/node.rb', line 2778 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
2769 2770 2771 |
# File 'lib/yarp/node.rb', line 2769 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location?
2772 2773 2774 |
# File 'lib/yarp/node.rb', line 2772 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node?
2775 2776 2777 |
# File 'lib/yarp/node.rb', line 2775 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
2786 2787 2788 |
# File 'lib/yarp/node.rb', line 2786 def accept(visitor) visitor.visit_global_variable_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
2792 2793 2794 |
# File 'lib/yarp/node.rb', line 2792 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
2800 2801 2802 |
# File 'lib/yarp/node.rb', line 2800 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location } end |
#name ⇒ Object
def name: () -> String
2805 2806 2807 |
# File 'lib/yarp/node.rb', line 2805 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String?
2810 2811 2812 |
# File 'lib/yarp/node.rb', line 2810 def operator operator_loc&.slice end |