Class: YARP::ConstantWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ConstantWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents writing to a constant.
Foo = 1
^^^^^^^
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].
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name_loc, value, operator_loc, location) ⇒ ConstantWriteNode
constructor
def initialize: (name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String.
-
#operator ⇒ Object
def operator: () -> String?.
Constructor Details
#initialize(name_loc, value, operator_loc, location) ⇒ ConstantWriteNode
def initialize: (name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void
1862 1863 1864 1865 1866 1867 |
# File 'lib/yarp/node.rb', line 1862 def initialize(name_loc, value, operator_loc, location) @name_loc = name_loc @value = value @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
1853 1854 1855 |
# File 'lib/yarp/node.rb', line 1853 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location?
1859 1860 1861 |
# File 'lib/yarp/node.rb', line 1859 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node?
1856 1857 1858 |
# File 'lib/yarp/node.rb', line 1856 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1870 1871 1872 |
# File 'lib/yarp/node.rb', line 1870 def accept(visitor) visitor.visit_constant_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1876 1877 1878 |
# File 'lib/yarp/node.rb', line 1876 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
1884 1885 1886 |
# File 'lib/yarp/node.rb', line 1884 def deconstruct_keys(keys) { name_loc: name_loc, value: value, operator_loc: operator_loc, location: location } end |
#name ⇒ Object
def name: () -> String
1889 1890 1891 |
# File 'lib/yarp/node.rb', line 1889 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String?
1894 1895 1896 |
# File 'lib/yarp/node.rb', line 1894 def operator operator_loc&.slice end |