Class: YARP::PreExecutionNode

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

Overview

Represents the use of the ‘BEGIN` keyword.

BEGIN { foo }
^^^^^^^^^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(statements, keyword_loc, opening_loc, closing_loc, location) ⇒ PreExecutionNode

def initialize: (statements: Node?, keyword_loc: Location, opening_loc: Location, closing_loc: Location, location: Location) -> void



4854
4855
4856
4857
4858
4859
4860
# File 'lib/yarp/node.rb', line 4854

def initialize(statements, keyword_loc, opening_loc, closing_loc, location)
  @statements = statements
  @keyword_loc = keyword_loc
  @opening_loc = opening_loc
  @closing_loc = closing_loc
  @location = location
end

Instance Attribute Details

#closing_locObject (readonly)

attr_reader closing_loc: Location



4851
4852
4853
# File 'lib/yarp/node.rb', line 4851

def closing_loc
  @closing_loc
end

#keyword_locObject (readonly)

attr_reader keyword_loc: Location



4845
4846
4847
# File 'lib/yarp/node.rb', line 4845

def keyword_loc
  @keyword_loc
end

#opening_locObject (readonly)

attr_reader opening_loc: Location



4848
4849
4850
# File 'lib/yarp/node.rb', line 4848

def opening_loc
  @opening_loc
end

#statementsObject (readonly)

attr_reader statements: Node?



4842
4843
4844
# File 'lib/yarp/node.rb', line 4842

def statements
  @statements
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



4863
4864
4865
# File 'lib/yarp/node.rb', line 4863

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

#child_nodesObject Also known as: deconstruct

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



4868
4869
4870
# File 'lib/yarp/node.rb', line 4868

def child_nodes
  [statements]
end

#closingObject

def closing: () -> String



4891
4892
4893
# File 'lib/yarp/node.rb', line 4891

def closing
  closing_loc.slice
end

#deconstruct_keys(keys) ⇒ Object

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



4876
4877
4878
# File 'lib/yarp/node.rb', line 4876

def deconstruct_keys(keys)
  { statements: statements, keyword_loc: keyword_loc, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
end

#keywordObject

def keyword: () -> String



4881
4882
4883
# File 'lib/yarp/node.rb', line 4881

def keyword
  keyword_loc.slice
end

#openingObject

def opening: () -> String



4886
4887
4888
# File 'lib/yarp/node.rb', line 4886

def opening
  opening_loc.slice
end