Class: YARP::ConstantAndWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ConstantAndWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘&&=` operator for assignment to a constant.
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) -> ConstantAndWriteNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name_loc, operator_loc, value, location) ⇒ ConstantAndWriteNode
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) ⇒ ConstantAndWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1748 1749 1750 1751 1752 1753 |
# File 'lib/yarp/node.rb', line 1748 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
1739 1740 1741 |
# File 'lib/yarp/node.rb', line 1739 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
1742 1743 1744 |
# File 'lib/yarp/node.rb', line 1742 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
1745 1746 1747 |
# File 'lib/yarp/node.rb', line 1745 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1756 1757 1758 |
# File 'lib/yarp/node.rb', line 1756 def accept(visitor) visitor.visit_constant_and_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1761 1762 1763 |
# File 'lib/yarp/node.rb', line 1761 def child_nodes [value] end |
#copy(**params) ⇒ Object
def copy: (**params) -> ConstantAndWriteNode
1766 1767 1768 1769 1770 1771 1772 1773 |
# File 'lib/yarp/node.rb', line 1766 def copy(**params) ConstantAndWriteNode.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
1779 1780 1781 |
# File 'lib/yarp/node.rb', line 1779 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location } end |
#name ⇒ Object
def name: () -> String
1784 1785 1786 |
# File 'lib/yarp/node.rb', line 1784 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
1789 1790 1791 |
# File 'lib/yarp/node.rb', line 1789 def operator operator_loc.slice end |