Class: YARP::GlobalVariableOperatorWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::GlobalVariableOperatorWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents assigning to a global variable using an operator that isn’t ‘=`.
$target += value
^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#name_loc ⇒ Object
readonly
attr_reader name_loc: Location.
-
#operator ⇒ Object
readonly
attr_reader operator: Symbol.
-
#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) -> GlobalVariableOperatorWriteNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name_loc, operator_loc, value, operator, location) ⇒ GlobalVariableOperatorWriteNode
constructor
def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String.
Constructor Details
#initialize(name_loc, operator_loc, value, operator, location) ⇒ GlobalVariableOperatorWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
3333 3334 3335 3336 3337 3338 3339 |
# File 'lib/yarp/node.rb', line 3333 def initialize(name_loc, operator_loc, value, operator, location) @name_loc = name_loc @operator_loc = operator_loc @value = value @operator = operator @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
3321 3322 3323 |
# File 'lib/yarp/node.rb', line 3321 def name_loc @name_loc end |
#operator ⇒ Object (readonly)
attr_reader operator: Symbol
3330 3331 3332 |
# File 'lib/yarp/node.rb', line 3330 def operator @operator end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
3324 3325 3326 |
# File 'lib/yarp/node.rb', line 3324 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
3327 3328 3329 |
# File 'lib/yarp/node.rb', line 3327 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3342 3343 3344 |
# File 'lib/yarp/node.rb', line 3342 def accept(visitor) visitor.visit_global_variable_operator_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3347 3348 3349 |
# File 'lib/yarp/node.rb', line 3347 def child_nodes [value] end |
#copy(**params) ⇒ Object
def copy: (**params) -> GlobalVariableOperatorWriteNode
3352 3353 3354 3355 3356 3357 3358 3359 3360 |
# File 'lib/yarp/node.rb', line 3352 def copy(**params) GlobalVariableOperatorWriteNode.new( params.fetch(:name_loc) { name_loc }, params.fetch(:operator_loc) { operator_loc }, params.fetch(:value) { value }, params.fetch(:operator) { operator }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
3366 3367 3368 |
# File 'lib/yarp/node.rb', line 3366 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location } end |
#name ⇒ Object
def name: () -> String
3371 3372 3373 |
# File 'lib/yarp/node.rb', line 3371 def name name_loc.slice end |