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].
-
#copy(**params) ⇒ Object
def copy: (**params) -> GlobalVariableWriteNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name_loc, value, operator_loc, location) ⇒ GlobalVariableWriteNode
constructor
def initialize: (name_loc: Location, value: Node, operator_loc: Location, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(name_loc, value, operator_loc, location) ⇒ GlobalVariableWriteNode
def initialize: (name_loc: Location, value: Node, operator_loc: Location, location: Location) -> void
3524 3525 3526 3527 3528 3529 |
# File 'lib/yarp/node.rb', line 3524 def initialize(name_loc, value, operator_loc, location) @name_loc = name_loc @value = value @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
3515 3516 3517 |
# File 'lib/yarp/node.rb', line 3515 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
3521 3522 3523 |
# File 'lib/yarp/node.rb', line 3521 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
3518 3519 3520 |
# File 'lib/yarp/node.rb', line 3518 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3532 3533 3534 |
# File 'lib/yarp/node.rb', line 3532 def accept(visitor) visitor.visit_global_variable_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3537 3538 3539 |
# File 'lib/yarp/node.rb', line 3537 def child_nodes [value] end |
#copy(**params) ⇒ Object
def copy: (**params) -> GlobalVariableWriteNode
3542 3543 3544 3545 3546 3547 3548 3549 |
# File 'lib/yarp/node.rb', line 3542 def copy(**params) GlobalVariableWriteNode.new( params.fetch(:name_loc) { name_loc }, params.fetch(:value) { value }, params.fetch(:operator_loc) { operator_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
3555 3556 3557 |
# File 'lib/yarp/node.rb', line 3555 def deconstruct_keys(keys) { name_loc: name_loc, value: value, operator_loc: operator_loc, location: location } end |
#name ⇒ Object
def name: () -> String
3560 3561 3562 |
# File 'lib/yarp/node.rb', line 3560 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
3565 3566 3567 |
# File 'lib/yarp/node.rb', line 3565 def operator operator_loc.slice end |