class Prism::StatementsNode
表示包含在某个作用域内的一组语句。
foo; bar; baz ^^^^^^^^^^^^^
属性
body[R]
attr_reader body: Array
公共类方法
new(source, node_id, location, flags, body) 点击切换源代码
初始化一个新的 StatementsNode
节点。
# File prism/node.rb, line 16766 def initialize(source, node_id, location, flags, body) @source = source @node_id = node_id @location = location @flags = flags @body = body end
type() 点击切换源代码
返回此节点类型的符号表示。请参见 `Node::type`。
# File prism/node.rb, line 16821 def self.type :statements_node end
公共实例方法
===(other) 点击切换源代码
为节点实现 case 相等性。这实际上是 == ,但不比较位置的值。仅检查位置是否存在。
# File prism/node.rb, line 16827 def ===(other) other.is_a?(StatementsNode) && (body.length == other.body.length) && body.zip(other.body).all? { |left, right| left === right } end
accept(visitor) 点击切换源代码
def accept: (Visitor
visitor) -> void
# File prism/node.rb, line 16775 def accept(visitor) visitor.visit_statements_node(self) end
child_nodes() 点击切换源代码
def child_nodes
: () -> Array[nil | Node]
# File prism/node.rb, line 16780 def child_nodes [*body] end
也别名为: deconstruct
comment_targets() 点击切换源代码
def comment_targets
: () -> Array[Node | Location]
# File prism/node.rb, line 16790 def comment_targets [*body] #: Array[Prism::node | Location] end
compact_child_nodes() 点击切换源代码
def compact_child_nodes
: () -> Array
# File prism/node.rb, line 16785 def compact_child_nodes [*body] end
copy(node_id: self.node_id, location: self.location, flags: self.flags, body: self.body) 点击切换源代码
def copy: (?node_id: Integer, ?location: Location
, ?flags: Integer, ?body: Array) -> StatementsNode
# File prism/node.rb, line 16795 def copy(node_id: self.node_id, location: self.location, flags: self.flags, body: self.body) StatementsNode.new(source, node_id, location, flags, body) end
deconstruct_keys(keys) 点击切换源代码
def deconstruct_keys
: (Array keys) -> { node_id: Integer, location: Location
, body: Array }
# File prism/node.rb, line 16803 def deconstruct_keys(keys) { node_id: node_id, location: location, body: body } end
inspect() 点击切换源代码
def inspect -> String
# File prism/node.rb, line 16811 def inspect InspectVisitor.compose(self) end
type() 点击切换源代码
返回此节点类型的符号表示。请参见 'Node#type`。
# File prism/node.rb, line 16816 def type :statements_node end