Class: YARP::MultiWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::MultiWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a multi-target expression.
a, b, c = 1, 2, 3
^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#lparen_loc ⇒ Object
readonly
attr_reader lparen_loc: Location?.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location?.
-
#rparen_loc ⇒ Object
readonly
attr_reader rparen_loc: Location?.
-
#targets ⇒ Object
readonly
attr_reader targets: Array.
-
#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) -> MultiWriteNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(targets, operator_loc, value, lparen_loc, rparen_loc, location) ⇒ MultiWriteNode
constructor
def initialize: (targets: Array, operator_loc: Location?, value: Node?, lparen_loc: Location?, rparen_loc: Location?, location: Location) -> void.
-
#lparen ⇒ Object
def lparen: () -> String?.
-
#operator ⇒ Object
def operator: () -> String?.
-
#rparen ⇒ Object
def rparen: () -> String?.
Constructor Details
#initialize(targets, operator_loc, value, lparen_loc, rparen_loc, location) ⇒ MultiWriteNode
def initialize: (targets: Array, operator_loc: Location?, value: Node?, lparen_loc: Location?, rparen_loc: Location?, location: Location) -> void
5397 5398 5399 5400 5401 5402 5403 5404 |
# File 'lib/yarp/node.rb', line 5397 def initialize(targets, operator_loc, value, lparen_loc, rparen_loc, location) @targets = targets @operator_loc = operator_loc @value = value @lparen_loc = lparen_loc @rparen_loc = rparen_loc @location = location end |
Instance Attribute Details
#lparen_loc ⇒ Object (readonly)
attr_reader lparen_loc: Location?
5391 5392 5393 |
# File 'lib/yarp/node.rb', line 5391 def lparen_loc @lparen_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location?
5385 5386 5387 |
# File 'lib/yarp/node.rb', line 5385 def operator_loc @operator_loc end |
#rparen_loc ⇒ Object (readonly)
attr_reader rparen_loc: Location?
5394 5395 5396 |
# File 'lib/yarp/node.rb', line 5394 def rparen_loc @rparen_loc end |
#targets ⇒ Object (readonly)
attr_reader targets: Array
5382 5383 5384 |
# File 'lib/yarp/node.rb', line 5382 def targets @targets end |
#value ⇒ Object (readonly)
attr_reader value: Node?
5388 5389 5390 |
# File 'lib/yarp/node.rb', line 5388 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
5407 5408 5409 |
# File 'lib/yarp/node.rb', line 5407 def accept(visitor) visitor.visit_multi_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
5412 5413 5414 |
# File 'lib/yarp/node.rb', line 5412 def child_nodes [*targets, value] end |
#copy(**params) ⇒ Object
def copy: (**params) -> MultiWriteNode
5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 |
# File 'lib/yarp/node.rb', line 5417 def copy(**params) MultiWriteNode.new( params.fetch(:targets) { targets }, params.fetch(:operator_loc) { operator_loc }, params.fetch(:value) { value }, params.fetch(:lparen_loc) { lparen_loc }, params.fetch(:rparen_loc) { rparen_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
5432 5433 5434 |
# File 'lib/yarp/node.rb', line 5432 def deconstruct_keys(keys) { targets: targets, operator_loc: operator_loc, value: value, lparen_loc: lparen_loc, rparen_loc: rparen_loc, location: location } end |
#lparen ⇒ Object
def lparen: () -> String?
5442 5443 5444 |
# File 'lib/yarp/node.rb', line 5442 def lparen lparen_loc&.slice end |
#operator ⇒ Object
def operator: () -> String?
5437 5438 5439 |
# File 'lib/yarp/node.rb', line 5437 def operator operator_loc&.slice end |
#rparen ⇒ Object
def rparen: () -> String?
5447 5448 5449 |
# File 'lib/yarp/node.rb', line 5447 def rparen rparen_loc&.slice end |