Class: YARP::PreExecutionNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::PreExecutionNode
- 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
-
#closing_loc ⇒ Object
readonly
attr_reader closing_loc: Location.
-
#keyword_loc ⇒ Object
readonly
attr_reader keyword_loc: Location.
-
#opening_loc ⇒ Object
readonly
attr_reader opening_loc: Location.
-
#statements ⇒ Object
readonly
attr_reader statements: StatementsNode?.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#closing ⇒ Object
def closing: () -> String.
-
#copy(**params) ⇒ Object
def copy: (**params) -> PreExecutionNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(statements, keyword_loc, opening_loc, closing_loc, location) ⇒ PreExecutionNode
constructor
def initialize: (statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location, location: Location) -> void.
-
#keyword ⇒ Object
def keyword: () -> String.
-
#opening ⇒ Object
def opening: () -> String.
Constructor Details
#initialize(statements, keyword_loc, opening_loc, closing_loc, location) ⇒ PreExecutionNode
def initialize: (statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location, location: Location) -> void
6105 6106 6107 6108 6109 6110 6111 |
# File 'lib/yarp/node.rb', line 6105 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_loc ⇒ Object (readonly)
attr_reader closing_loc: Location
6102 6103 6104 |
# File 'lib/yarp/node.rb', line 6102 def closing_loc @closing_loc end |
#keyword_loc ⇒ Object (readonly)
attr_reader keyword_loc: Location
6096 6097 6098 |
# File 'lib/yarp/node.rb', line 6096 def keyword_loc @keyword_loc end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location
6099 6100 6101 |
# File 'lib/yarp/node.rb', line 6099 def opening_loc @opening_loc end |
#statements ⇒ Object (readonly)
attr_reader statements: StatementsNode?
6093 6094 6095 |
# File 'lib/yarp/node.rb', line 6093 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
6114 6115 6116 |
# File 'lib/yarp/node.rb', line 6114 def accept(visitor) visitor.visit_pre_execution_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
6119 6120 6121 |
# File 'lib/yarp/node.rb', line 6119 def child_nodes [statements] end |
#closing ⇒ Object
def closing: () -> String
6153 6154 6155 |
# File 'lib/yarp/node.rb', line 6153 def closing closing_loc.slice end |
#copy(**params) ⇒ Object
def copy: (**params) -> PreExecutionNode
6124 6125 6126 6127 6128 6129 6130 6131 6132 |
# File 'lib/yarp/node.rb', line 6124 def copy(**params) PreExecutionNode.new( params.fetch(:statements) { statements }, params.fetch(:keyword_loc) { keyword_loc }, params.fetch(:opening_loc) { opening_loc }, params.fetch(:closing_loc) { closing_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
6138 6139 6140 |
# File 'lib/yarp/node.rb', line 6138 def deconstruct_keys(keys) { statements: statements, keyword_loc: keyword_loc, opening_loc: opening_loc, closing_loc: closing_loc, location: location } end |
#keyword ⇒ Object
def keyword: () -> String
6143 6144 6145 |
# File 'lib/yarp/node.rb', line 6143 def keyword keyword_loc.slice end |
#opening ⇒ Object
def opening: () -> String
6148 6149 6150 |
# File 'lib/yarp/node.rb', line 6148 def opening opening_loc.slice end |