class Prism::MultiWriteNode
Represents a write to a multi-target expression.
a, b, c = 1, 2, 3 ^^^^^^^^^^^^^^^^^
Represents a write to a multi-target expression.
a, b, c = 1, 2, 3 ^^^^^^^^^^^^^^^^^
Public Class Methods
(Source source, Integer node_id, Location location, Integer flags, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] rights, Location? lparen_loc, Location? rparen_loc, Location operator_loc, Prism::node value) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24153 def initialize(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value) @source = source @node_id = node_id @location = location @flags = flags @lefts = lefts @rest = rest @rights = rights @lparen_loc = lparen_loc @rparen_loc = rparen_loc @operator_loc = operator_loc @value = value end
Initialize a new MultiWriteNode node.
Initialize a new MultiWriteNode node.
: (Source source, Integer node_id, Location location, Integer flags, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] rights, Location? lparen_loc, Location? rparen_loc, Location operator_loc, Prism::node value) -> void
Public Instance Methods
(untyped other) → boolish
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 15728
def ===: (untyped other) -> boolish
: (untyped other) -> boolish
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 15532
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 15545
def inspect: () -> String
: () -> String
() → Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24294 def lefts @lefts end
Represents the targets expressions before a splat node.
a, b, * = 1, 2, 3, 4, 5 ^^^^
Explore code sample The splat node can be absent, in that case all target expressions are in the left field.
a, b, c = 1, 2, 3, 4, 5 ^^^^^^^
:call-seq: lefts -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
Represents the targets expressions before a splat node.
a, b, * = 1, 2, 3, 4, 5 ^^^^
Explore code sample The splat node can be absent, in that case all target expressions are in the left field.
a, b, c = 1, 2, 3, 4, 5 ^^^^^^^
: () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
(Array[bool] lines) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/parse_result/newlines.rbs, line 181
def newline_flag!: (Array[bool] lines) -> void
: (Array lines) -> void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24329 def rest @rest end
Represents a splat node in the target expression.
a, b, *c = 1, 2, 3, 4 ^^
Explore code sample The variable can be empty, this results in a SplatNode with a nil expression field.
a, b, * = 1, 2, 3, 4 ^
Explore code sample If the * is omitted, this field will contain an ImplicitRestNode
a, b, = 1, 2, 3, 4 ^
:call-seq: rest -> ImplicitRestNode | SplatNode | nil
Represents a splat node in the target expression.
a, b, *c = 1, 2, 3, 4 ^^
Explore code sample The variable can be empty, this results in a SplatNode with a nil expression field.
a, b, * = 1, 2, 3, 4 ^
Explore code sample If the * is omitted, this field will contain an ImplicitRestNode
a, b, = 1, 2, 3, 4 ^
: () -> (ImplicitRestNode | SplatNode)?
() → Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24346 def rights @rights end
Represents the targets expressions after a splat node.
a, *, b, c = 1, 2, 3, 4, 5 ^^^^
:call-seq: rights -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
Represents the targets expressions after a splat node.
a, *, b, c = 1, 2, 3, 4, 5 ^^^^
: () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
() → Prism::node
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24460 def value @value end
The value to write to the targets. It can be any non-void expression.
a, b, c = 1, 2, 3 ^^^^^^^
:call-seq: value -> Node
The value to write to the targets. It can be any non-void expression.
a, b, c = 1, 2, 3 ^^^^^^^
: () -> Prism::node
Locations
Public Instance Methods
() → Location?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24364 def lparen_loc location = @lparen_loc case location when nil nil when Location location else @lparen_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end end
The Location of the opening parenthesis.
(a, b, c) = 1, 2, 3 ^
:category: Locations :call-seq: lparen_loc -> Location | nil
The Location of the opening parenthesis.
(a, b, c) = 1, 2, 3 ^
: () -> Location?
() → Location
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24432 def operator_loc location = @operator_loc return location if location.is_a?(Location) @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
The Location of the operator.
a, b, c = 1, 2, 3 ^
:category: Locations :call-seq: operator_loc -> Location
The Location of the operator.
a, b, c = 1, 2, 3 ^
: () -> Location
() → Location?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24398 def rparen_loc location = @rparen_loc case location when nil nil when Location location else @rparen_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end end
The Location of the closing parenthesis.
(a, b, c) = 1, 2, 3 ^
:category: Locations :call-seq: rparen_loc -> Location | nil
The Location of the closing parenthesis.
(a, b, c) = 1, 2, 3 ^
: () -> Location?
Node Interface
These methods are present on all subclasses of Node. Read the node interface docs for more information.
Public Class Methods
Public Instance Methods
(_Visitor visitor) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24181 def accept(visitor) visitor.visit_multi_write_node(self) end
() → Array[node?]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24188 def child_nodes [*lefts, rest, *rights, value] end
() → Array[node]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24208 def compact_child_nodes compact = [] #: Array[Prism::node] compact.concat(lefts) if (rest = self.rest); compact << rest; end compact.concat(rights) compact << value compact end
(?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node) → MultiWriteNode
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24223 def copy(node_id: self.node_id, location: self.location, flags: self.flags, lefts: self.lefts, rest: self.rest, rights: self.rights, lparen_loc: self.lparen_loc, rparen_loc: self.rparen_loc, operator_loc: self.operator_loc, value: self.value) MultiWriteNode.new(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value) end
Creates a copy of self with the given fields, using self as the template.
:call-seq: copy(**fields) -> MultiWriteNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node) -> MultiWriteNode
() → Enumerator[node, void]
() { (node) → void } → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24196 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? lefts.each { |node| yield node } if (rest = self.rest); yield rest; end rights.each { |node| yield node } yield value end
See Node.each_child_node.
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
Repository
Methods related to Relocation.
Public Instance Methods
(_Repository repository) → Relocation::Entry?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24381 def save_lparen_loc(repository) repository.enter(node_id, :lparen_loc) unless @lparen_loc.nil? end
Save the lparen_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the lparen_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry?
(_Repository repository) → Relocation::Entry
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24443 def save_operator_loc(repository) repository.enter(node_id, :operator_loc) end
Save the operator_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the operator_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry
(_Repository repository) → Relocation::Entry?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24415 def save_rparen_loc(repository) repository.enter(node_id, :rparen_loc) unless @rparen_loc.nil? end
Save the rparen_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the rparen_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry?
Slicing
Public Instance Methods
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24472 def lparen lparen_loc&.slice end
Slice the location of lparen_loc from the source.
:call-seq: lparen -> String | nil
Slice the location of lparen_loc from the source.
: () -> String?
() → String
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24492 def operator operator_loc.slice end
Slice the location of operator_loc from the source.
:call-seq: operator -> String
Slice the location of operator_loc from the source.
: () -> String
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 24482 def rparen rparen_loc&.slice end
Slice the location of rparen_loc from the source.
:call-seq: rparen -> String | nil
Slice the location of rparen_loc from the source.
: () -> String?