class Prism::NumberedReferenceReadNode

表示读取先前匹配中对捕获的编号引用。

$1
^^

属性

number[R]

捕获组的(从左开始,从 1 开始索引)编号。过大的编号引用会导致此值为 ‘0’。

$1          # number `1`

$5432       # number `5432`

$4294967296 # number `0`

公共类方法

new(source, node_id, location, flags, number) 点击切换源码

初始化一个新的 NumberedReferenceReadNode 节点。

# File prism/node.rb, line 13736
def initialize(source, node_id, location, flags, number)
  @source = source
  @node_id = node_id
  @location = location
  @flags = flags
  @number = number
end
type() 点击切换源码

返回此节点类型的符号表示形式。请参阅 ‘Node::type’。

# File prism/node.rb, line 13797
def self.type
  :numbered_reference_read_node
end

公共实例方法

===(other) 点击切换源码

为节点实现 case-equality。这实际上是 ==,但不比较位置的值。仅检查位置是否存在。

# File prism/node.rb, line 13803
def ===(other)
  other.is_a?(NumberedReferenceReadNode) &&
    (number === other.number)
end
accept(visitor) 点击切换源码

def accept: (Visitor visitor) -> void

# File prism/node.rb, line 13745
def accept(visitor)
  visitor.visit_numbered_reference_read_node(self)
end
child_nodes() 点击切换源码

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

# File prism/node.rb, line 13750
def child_nodes
  []
end
也别名为: deconstruct
comment_targets() 点击切换源码

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

# File prism/node.rb, line 13760
def comment_targets
  [] #: Array[Prism::node | Location]
end
compact_child_nodes() 点击切换源码

def compact_child_nodes: () -> Array

# File prism/node.rb, line 13755
def compact_child_nodes
  []
end
copy(node_id: self.node_id, location: self.location, flags: self.flags, number: self.number) 点击切换源码

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?number: Integer) -> NumberedReferenceReadNode

# File prism/node.rb, line 13765
def copy(node_id: self.node_id, location: self.location, flags: self.flags, number: self.number)
  NumberedReferenceReadNode.new(source, node_id, location, flags, number)
end
deconstruct()

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

别名为: child_nodes
deconstruct_keys(keys) 点击切换源码

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, number: Integer }

# File prism/node.rb, line 13773
def deconstruct_keys(keys)
  { node_id: node_id, location: location, number: number }
end
inspect() 点击切换源码

def inspect -> String

# File prism/node.rb, line 13787
def inspect
  InspectVisitor.compose(self)
end
type() 点击切换源码

返回此节点类型的符号表示形式。请参阅 ‘Node#type’。

# File prism/node.rb, line 13792
def type
  :numbered_reference_read_node
end