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].
-
#copy(**params) ⇒ Object
def copy: (**params) -> ConstantWriteNode.
- #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
2345 2346 2347 2348 2349 2350 |
# File 'lib/yarp/node.rb', line 2345 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
2336 2337 2338 |
# File 'lib/yarp/node.rb', line 2336 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
2342 2343 2344 |
# File 'lib/yarp/node.rb', line 2342 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
2339 2340 2341 |
# File 'lib/yarp/node.rb', line 2339 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
2353 2354 2355 |
# File 'lib/yarp/node.rb', line 2353 def accept(visitor) visitor.visit_constant_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
2358 2359 2360 |
# File 'lib/yarp/node.rb', line 2358 def child_nodes [value] end |
#copy(**params) ⇒ Object
def copy: (**params) -> ConstantWriteNode
2363 2364 2365 2366 2367 2368 2369 2370 |
# File 'lib/yarp/node.rb', line 2363 def copy(**params) ConstantWriteNode.new( params.fetch(:name_loc) { name_loc }, params.fetch(:value) { value }, params.fetch(:operator_loc) { operator_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
2376 2377 2378 |
# File 'lib/yarp/node.rb', line 2376 def deconstruct_keys(keys) { name_loc: name_loc, value: value, operator_loc: operator_loc, location: location } end |
#name ⇒ Object
def name: () -> String
2381 2382 2383 |
# File 'lib/yarp/node.rb', line 2381 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
2386 2387 2388 |
# File 'lib/yarp/node.rb', line 2386 def operator operator_loc.slice end |