class Prism::ProgramNode
The top level node of any parse tree.
The top level node of any parse tree.
Public Class Methods
(Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, StatementsNode statements) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27458 def initialize(source, node_id, location, flags, locals, statements) @source = source @node_id = node_id @location = location @flags = flags @locals = locals @statements = statements end
Initialize a new ProgramNode node.
Initialize a new ProgramNode node.
: (Source source, Integer node_id, Location location, Integer flags, Array locals, StatementsNode statements) -> void
Public Instance Methods
(untyped other) → boolish
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 17639
def ===: (untyped other) -> boolish
: (untyped other) -> boolish
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 17607
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 17620
def inspect: () -> String
: () -> String
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27562 def locals @locals end
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27572 def statements @statements end
Returns the statements attribute.
:call-seq: statements -> StatementsNode
Returns the statements attribute.
: () -> StatementsNode
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 vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27481 def accept(visitor) visitor.visit_program_node(self) end
() → Array[node?]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27488 def child_nodes [statements] end
() → Array[node]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27505 def compact_child_nodes [statements] end
(?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?statements: StatementsNode) → ProgramNode
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27515 def copy(node_id: self.node_id, location: self.location, flags: self.flags, locals: self.locals, statements: self.statements) ProgramNode.new(source, node_id, location, flags, locals, statements) end
Creates a copy of self with the given fields, using self as the template.
:call-seq: copy(**fields) -> ProgramNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array, ?statements: StatementsNode) -> ProgramNode
() → Enumerator[node, void]
() { (node) → void } → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27496 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? yield statements end
See Node.each_child_node.
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
Repository
Methods related to Relocation.