class Prism::StatementsNode
表示包含在某个作用域内的一组语句。
foo; bar; baz ^^^^^^^^^^^^^
属性
公共类方法
源代码
# File lib/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
初始化一个新的 StatementsNode
节点。
源代码
# File lib/prism/node.rb, line 16821 def self.type :statements_node end
返回此节点类型的符号表示。 请参阅 “Node::type”。
公共实例方法
源代码
# File lib/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
为节点实现 case-equality。这实际上与 == 相同,但不比较 location 的值。仅检查是否存在 location。
源代码
# File lib/prism/node.rb, line 16775 def accept(visitor) visitor.visit_statements_node(self) end
def accept: (Visitor
visitor) -> void
源代码
# File lib/prism/node.rb, line 16780 def child_nodes [*body] end
def child_nodes
: () -> Array[nil | Node]
也别名为:deconstruct
源代码
# File lib/prism/node.rb, line 16790 def comment_targets [*body] #: Array[Prism::node | Location] end
def comment_targets
: () -> Array[Node | Location]
源代码
# File lib/prism/node.rb, line 16785 def compact_child_nodes [*body] end
def compact_child_nodes
: () -> Array
源代码
# File lib/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
def copy: (?node_id: Integer
, ?location: Location
, ?flags: Integer
, ?body: Array) -> StatementsNode
源代码
# File lib/prism/node.rb, line 16803 def deconstruct_keys(keys) { node_id: node_id, location: location, body: body } end
def deconstruct_keys
: (Array keys) -> { node_id: Integer
, location: Location
, body: Array }
源代码
# File lib/prism/node.rb, line 16811 def inspect InspectVisitor.compose(self) end
def inspect -> String
源代码
# File lib/prism/node.rb, line 16816 def type :statements_node end
返回此节点类型的符号表示。 请参阅“Node#type”。