class YARP::MultiWriteNode

Represents a write to a multi-target expression.

a, b, c = 1, 2, 3
^^^^^^^^^^^^^^^^^

Attributes

lparen_loc[R]

attr_reader lparen_loc: Location?

operator_loc[R]

attr_reader operator_loc: Location

rparen_loc[R]

attr_reader rparen_loc: Location?

targets[R]

attr_reader targets: Array

value[R]

attr_reader value: Node

Public Class Methods

new(targets, lparen_loc, rparen_loc, operator_loc, value, location) click to toggle source

def initialize: (targets: Array, lparen_loc: Location?, rparen_loc: Location?, operator_loc: Location, value: Node, location: Location) -> void

# File yarp/node.rb, line 7642
def initialize(targets, lparen_loc, rparen_loc, operator_loc, value, location)
  @targets = targets
  @lparen_loc = lparen_loc
  @rparen_loc = rparen_loc
  @operator_loc = operator_loc
  @value = value
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

# File yarp/node.rb, line 7652
def accept(visitor)
  visitor.visit_multi_write_node(self)
end
child_nodes() click to toggle source

def child_nodes: () -> Array[nil | Node]

# File yarp/node.rb, line 7657
def child_nodes
  [*targets, value]
end
Also aliased as: deconstruct
comment_targets() click to toggle source

def comment_targets: () -> Array[Node | Location]

# File yarp/node.rb, line 7662
def comment_targets
  [*targets, *lparen_loc, *rparen_loc, operator_loc, value]
end
copy(**params) click to toggle source

def copy: (**params) -> MultiWriteNode

# File yarp/node.rb, line 7667
def copy(**params)
  MultiWriteNode.new(
    params.fetch(:targets) { targets },
    params.fetch(:lparen_loc) { lparen_loc },
    params.fetch(:rparen_loc) { rparen_loc },
    params.fetch(:operator_loc) { operator_loc },
    params.fetch(:value) { value },
    params.fetch(:location) { location },
  )
end
deconstruct()

def deconstruct: () -> Array[nil | Node]

Alias for: child_nodes
deconstruct_keys(keys) click to toggle source

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]

# File yarp/node.rb, line 7682
def deconstruct_keys(keys)
  { targets: targets, lparen_loc: lparen_loc, rparen_loc: rparen_loc, operator_loc: operator_loc, value: value, location: location }
end
inspect(inspector = NodeInspector.new) click to toggle source
# File yarp/node.rb, line 7701
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector << "├── targets: #{inspector.list("#{inspector.prefix}│   ", targets)}"
  inspector << "├── lparen_loc: #{inspector.location(lparen_loc)}\n"
  inspector << "├── rparen_loc: #{inspector.location(rparen_loc)}\n"
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
  inspector << "└── value:\n"
  inspector << inspector.child_node(value, "    ")
  inspector.to_str
end
lparen() click to toggle source

def lparen: () -> String?

# File yarp/node.rb, line 7687
def lparen
  lparen_loc&.slice
end
operator() click to toggle source

def operator: () -> String

# File yarp/node.rb, line 7697
def operator
  operator_loc.slice
end
rparen() click to toggle source

def rparen: () -> String?

# File yarp/node.rb, line 7692
def rparen
  rparen_loc&.slice
end