Class: YARP::ConstantOperatorWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ConstantOperatorWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents assigning to a constant 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].
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name_loc, operator_loc, value, operator, location) ⇒ ConstantOperatorWriteNode
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) ⇒ ConstantOperatorWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
1526 1527 1528 1529 1530 1531 1532 |
# File 'lib/yarp/node.rb', line 1526 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
1514 1515 1516 |
# File 'lib/yarp/node.rb', line 1514 def name_loc @name_loc end |
#operator ⇒ Object (readonly)
attr_reader operator: Symbol
1523 1524 1525 |
# File 'lib/yarp/node.rb', line 1523 def operator @operator end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
1517 1518 1519 |
# File 'lib/yarp/node.rb', line 1517 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
1520 1521 1522 |
# File 'lib/yarp/node.rb', line 1520 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1535 1536 1537 |
# File 'lib/yarp/node.rb', line 1535 def accept(visitor) visitor.visit_constant_operator_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1540 1541 1542 |
# File 'lib/yarp/node.rb', line 1540 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
1548 1549 1550 |
# File 'lib/yarp/node.rb', line 1548 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location } end |
#name ⇒ Object
def name: () -> String
1553 1554 1555 |
# File 'lib/yarp/node.rb', line 1553 def name name_loc.slice end |