class YARP::BlockArgumentNode

Represents block method arguments.

bar(&args)
^^^^^^^^^^

Attributes

expression[R]

attr_reader expression: Node?

operator_loc[R]

attr_reader operator_loc: Location

Public Class Methods

new(expression, operator_loc, location) click to toggle source

def initialize: (expression: Node?, operator_loc: Location, location: Location) -> void

# File yarp/node.rb, line 853
def initialize(expression, operator_loc, location)
  @expression = expression
  @operator_loc = operator_loc
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

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

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

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

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

# File yarp/node.rb, line 870
def comment_targets
  [*expression, operator_loc]
end
copy(**params) click to toggle source

def copy: (**params) -> BlockArgumentNode

# File yarp/node.rb, line 875
def copy(**params)
  BlockArgumentNode.new(
    params.fetch(:expression) { expression },
    params.fetch(:operator_loc) { operator_loc },
    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 887
def deconstruct_keys(keys)
  { expression: expression, operator_loc: operator_loc, location: location }
end
inspect(inspector = NodeInspector.new) click to toggle source
# File yarp/node.rb, line 896
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  if (expression = self.expression).nil?
    inspector << "├── expression: ∅\n"
  else
    inspector << "├── expression:\n"
    inspector << expression.inspect(inspector.child_inspector("│   ")).delete_prefix(inspector.prefix)
  end
  inspector << "└── operator_loc: #{inspector.location(operator_loc)}\n"
  inspector.to_str
end
operator() click to toggle source

def operator: () -> String

# File yarp/node.rb, line 892
def operator
  operator_loc.slice
end