Class: YARP::StatementsNode

Inherits:
YARPNode
  • Object
show all
Defined in:
lib/yarp/node.rb,
ext/yarp/api_node.c

Overview

Represents a set of statements contained within some scope.

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, location) ⇒ StatementsNode

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



5673
5674
5675
5676
# File 'lib/yarp/node.rb', line 5673

def initialize(body, location)
  @body = body
  @location = location
end

Instance Attribute Details

#bodyObject (readonly)

attr_reader body: Array



5670
5671
5672
# File 'lib/yarp/node.rb', line 5670

def body
  @body
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



5679
5680
5681
# File 'lib/yarp/node.rb', line 5679

def accept(visitor)
  visitor.visit_statements_node(self)
end

#child_nodesObject Also known as: deconstruct

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



5685
5686
5687
# File 'lib/yarp/node.rb', line 5685

def child_nodes
  [*body]
end

#deconstruct_keys(keys) ⇒ Object

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



5693
5694
5695
# File 'lib/yarp/node.rb', line 5693

def deconstruct_keys(keys)
  { body: body, location: location }
end