Class: YARP::GlobalVariableAndWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::GlobalVariableAndWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘&&=` operator for assignment to a global variable.
$target &&= value
^^^^^^^^^^^^^^^^^
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) -> GlobalVariableAndWriteNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name_loc, operator_loc, value, location) ⇒ GlobalVariableAndWriteNode
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) ⇒ GlobalVariableAndWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
3269 3270 3271 3272 3273 3274 |
# File 'lib/yarp/node.rb', line 3269 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
3260 3261 3262 |
# File 'lib/yarp/node.rb', line 3260 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
3263 3264 3265 |
# File 'lib/yarp/node.rb', line 3263 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
3266 3267 3268 |
# File 'lib/yarp/node.rb', line 3266 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3277 3278 3279 |
# File 'lib/yarp/node.rb', line 3277 def accept(visitor) visitor.visit_global_variable_and_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3282 3283 3284 |
# File 'lib/yarp/node.rb', line 3282 def child_nodes [value] end |
#copy(**params) ⇒ Object
def copy: (**params) -> GlobalVariableAndWriteNode
3287 3288 3289 3290 3291 3292 3293 3294 |
# File 'lib/yarp/node.rb', line 3287 def copy(**params) GlobalVariableAndWriteNode.new( params.fetch(:name_loc) { name_loc }, params.fetch(:operator_loc) { operator_loc }, params.fetch(:value) { value }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
3300 3301 3302 |
# File 'lib/yarp/node.rb', line 3300 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location } end |
#name ⇒ Object
def name: () -> String
3305 3306 3307 |
# File 'lib/yarp/node.rb', line 3305 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
3310 3311 3312 |
# File 'lib/yarp/node.rb', line 3310 def operator operator_loc.slice end |