Class: YARP::PostExecutionNode

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

Overview

Represents the use of the END keyword.

END { foo }
^^^^^^^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

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



6034
6035
6036
6037
6038
6039
6040
# File 'lib/yarp/node.rb', line 6034

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



6031
6032
6033
# File 'lib/yarp/node.rb', line 6031

def closing_loc
  @closing_loc
end

#keyword_locObject (readonly)

attr_reader keyword_loc: Location



6025
6026
6027
# File 'lib/yarp/node.rb', line 6025

def keyword_loc
  @keyword_loc
end

#opening_locObject (readonly)

attr_reader opening_loc: Location



6028
6029
6030
# File 'lib/yarp/node.rb', line 6028

def opening_loc
  @opening_loc
end

#statementsObject (readonly)

attr_reader statements: StatementsNode?



6022
6023
6024
# File 'lib/yarp/node.rb', line 6022

def statements
  @statements
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



6043
6044
6045
# File 'lib/yarp/node.rb', line 6043

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

#child_nodesObject Also known as: deconstruct

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



6048
6049
6050
# File 'lib/yarp/node.rb', line 6048

def child_nodes
  [statements]
end

#closingObject

def closing: () -> String



6082
6083
6084
# File 'lib/yarp/node.rb', line 6082

def closing
  closing_loc.slice
end

#copy(**params) ⇒ Object

def copy: (**params) -> PostExecutionNode



6053
6054
6055
6056
6057
6058
6059
6060
6061
# File 'lib/yarp/node.rb', line 6053

def copy(**params)
  PostExecutionNode.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

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



6067
6068
6069
# File 'lib/yarp/node.rb', line 6067

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



6072
6073
6074
# File 'lib/yarp/node.rb', line 6072

def keyword
  keyword_loc.slice
end

#openingObject

def opening: () -> String



6077
6078
6079
# File 'lib/yarp/node.rb', line 6077

def opening
  opening_loc.slice
end