1. Prism::
  2. BlockArgumentNode

class Prism::BlockArgumentNode

Represents a block argument using&.

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

Attributes

expression[R]

The expression that is being passed as a block argument. This can be anynon-void expression.

foo(&args)    ^^^^^

Public Class Methods

Source
# File lib/prism/node.rb, line 1660definitialize(source,node_id,location,flags,expression,operator_loc)@source =source@node_id =node_id@location =location@flags =flags@expression =expression@operator_loc =operator_locend

Initialize a newBlockArgumentNode node.

Source
# File lib/prism/node.rb, line 1742defself.type:block_argument_nodeend

Return a symbol representation of this node type. SeeNode::type.

Public Instance Methods

Source
# File lib/prism/node.rb, line 1748def===(other)other.is_a?(BlockArgumentNode)&&    (expression===other.expression)&&    (operator_loc.nil?==other.operator_loc.nil?)end

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

Source
# File lib/prism/node.rb, line 1670defaccept(visitor)visitor.visit_block_argument_node(self)end

def accept: (Visitor visitor) -> void

Source
# File lib/prism/node.rb, line 1675defchild_nodes  [expression]end

defchild_nodes: () ->Array

Also aliased as:deconstruct
Source
# File lib/prism/node.rb, line 1687defcomment_targets  [*expression,operator_loc]#: Array[Prism::node | Location]end

defcomment_targets: () -> Array[Node | Location]

Source
# File lib/prism/node.rb, line 1680defcompact_child_nodescompact = []#: Array[Prism::node]compact<<expressionifexpressioncompactend

defcompact_child_nodes: () ->Array

Source
# File lib/prism/node.rb, line 1692defcopy(node_id:self.node_id,location:self.location,flags:self.flags,expression:self.expression,operator_loc:self.operator_loc)BlockArgumentNode.new(source,node_id,location,flags,expression,operator_loc)end

def copy: (?node_id:Integer, ?location:Location, ?flags:Integer, ?expression: Prism::node?, ?operator_loc:Location) ->BlockArgumentNode

def deconstruct: () ->Array

Alias for:child_nodes
Source
# File lib/prism/node.rb, line 1700defdeconstruct_keys(keys)  {node_id:node_id,location:location,expression:expression,operator_loc:operator_loc }end

defdeconstruct_keys: (Array keys) -> { node_id:Integer, location:Location, expression: Prism::node?,operator_loc:Location }

Source
# File lib/prism/node.rb, line 1732definspectInspectVisitor.compose(self)end

def inspect ->String

Source
# File lib/prism/node.rb, line 1727defoperatoroperator_loc.sliceend

def operator: () ->String

Source
# File lib/prism/node.rb, line 1714defoperator_loclocation =@operator_locreturnlocationiflocation.is_a?(Location)@operator_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end

Represents the location of the& operator.

foo(&args)    ^
Source
# File lib/prism/node.rb, line 1722defsave_operator_loc(repository)repository.enter(node_id,:operator_loc)end

Save theoperator_loc location using the given saved source so that it can be retrieved later.

Source
# File lib/prism/node.rb, line 1737deftype:block_argument_nodeend

Return a symbol representation of this node type. SeeNode#type.