Class: YARP::ConstantPathWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ConstantPathWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents writing to a constant path.
::Foo = 1
^^^^^^^^^
Foo::Bar = 1
^^^^^^^^^^^^
::Foo::Bar = 1
^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location?.
-
#target ⇒ Object
readonly
attr_reader target: Node.
-
#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(target, operator_loc, value, location) ⇒ ConstantPathWriteNode
constructor
def initialize: (target: Node, operator_loc: Location?, value: Node?, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String?.
Constructor Details
#initialize(target, operator_loc, value, location) ⇒ ConstantPathWriteNode
def initialize: (target: Node, operator_loc: Location?, value: Node?, location: Location) -> void
1762 1763 1764 1765 1766 1767 |
# File 'lib/yarp/node.rb', line 1762 def initialize(target, operator_loc, value, location) @target = target @operator_loc = operator_loc @value = value @location = location end |
Instance Attribute Details
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location?
1756 1757 1758 |
# File 'lib/yarp/node.rb', line 1756 def operator_loc @operator_loc end |
#target ⇒ Object (readonly)
attr_reader target: Node
1753 1754 1755 |
# File 'lib/yarp/node.rb', line 1753 def target @target end |
#value ⇒ Object (readonly)
attr_reader value: Node?
1759 1760 1761 |
# File 'lib/yarp/node.rb', line 1759 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1770 1771 1772 |
# File 'lib/yarp/node.rb', line 1770 def accept(visitor) visitor.visit_constant_path_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1775 1776 1777 |
# File 'lib/yarp/node.rb', line 1775 def child_nodes [target, value] end |
#deconstruct_keys(keys) ⇒ Object
1783 1784 1785 |
# File 'lib/yarp/node.rb', line 1783 def deconstruct_keys(keys) { target: target, operator_loc: operator_loc, value: value, location: location } end |
#operator ⇒ Object
def operator: () -> String?
1788 1789 1790 |
# File 'lib/yarp/node.rb', line 1788 def operator operator_loc&.slice end |