class YARP::StatementsNode

Represents a set of statements contained within some scope.

foo; bar; baz
^^^^^^^^^^^^^

Attributes

body[R]

attr_reader body: Array

Public Class Methods

new(body, location) click to toggle source

def initialize: (body: Array, location: Location) -> void

# File yarp/node.rb, line 9866
def initialize(body, location)
  @body = body
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

# File yarp/node.rb, line 9872
def accept(visitor)
  visitor.visit_statements_node(self)
end
child_nodes() click to toggle source

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

# File yarp/node.rb, line 9877
def child_nodes
  [*body]
end
Also aliased as: deconstruct
comment_targets() click to toggle source

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

# File yarp/node.rb, line 9882
def comment_targets
  [*body]
end
copy(**params) click to toggle source

def copy: (**params) -> StatementsNode

# File yarp/node.rb, line 9887
def copy(**params)
  StatementsNode.new(
    params.fetch(:body) { body },
    params.fetch(:location) { location },
  )
end
deconstruct()

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

Alias for: child_nodes
deconstruct_keys(keys) click to toggle source

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]

# File yarp/node.rb, line 9898
def deconstruct_keys(keys)
  { body: body, location: location }
end
inspect(inspector = NodeInspector.new) click to toggle source
# File yarp/node.rb, line 9902
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector << "└── body: #{inspector.list("#{inspector.prefix}    ", body)}"
  inspector.to_str
end