class Prism::StatementsNode
Represents a set of statements contained within some scope.
foo; bar; baz ^^^^^^^^^^^^^
Public Class Methods
(Source source, Integer node_id, Location location, Integer flags, Array[Prism::node] body) → void
Source
# File lib/prism/node.rb, line 30861 def initialize(source, node_id, location, flags, body) @source = source @node_id = node_id @location = location @flags = flags @body = body end
Initialize a new StatementsNode node.
Public Instance Methods
() → Array[Prism::node]
Source
# File lib/prism/node.rb, line 30979 def body @body end
Returns the body attribute.
Flags
Public Instance Methods
() → bool
Source
# File lib/prism/node.rb, line 30961 def contains_pre_execution? flags.anybits?(StatementsFlags::CONTAINS_PRE_EXECUTION) end
the statement list directly contains a BEGIN block
() → bool
Source
# File lib/prism/node.rb, line 30969 def leading_semicolon? flags.anybits?(StatementsFlags::LEADING_SEMICOLON) end
a semicolon precedes the first statement in the list
Node Interface
These methods are present on all subclasses of Node. Read the node interface docs for more information.
Public Class Methods
Public Instance Methods
(_Visitor visitor) → untyped
Source
# File lib/prism/node.rb, line 30883 def accept(visitor) visitor.visit_statements_node(self) end
See Node.accept.
() → Array[node?]
Source
# File lib/prism/node.rb, line 30890 def child_nodes [*body] end
See Node.child_nodes.
Also aliased as: deconstruct
() → Array[node]
Source
# File lib/prism/node.rb, line 30907 def compact_child_nodes [*body] end
(?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Array[Prism::node]) → StatementsNode
Source
# File lib/prism/node.rb, line 30917 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
Creates a copy of self with the given fields, using self as the template.
() → Enumerator[node, void]
() { (node) → void } → void
Source
# File lib/prism/node.rb, line 30898 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? body.each { |node| yield node } end
See Node.each_child_node.
Repository
Methods related to Relocation.