Class: YARP::SuperNode

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

Overview

Represents the use of the ‘super` keyword with parentheses or arguments.

super()
^^^^^^^

super foo, bar
^^^^^^^^^^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keyword_loc, lparen_loc, arguments, rparen_loc, block, location) ⇒ SuperNode

def initialize: (keyword_loc: Location, lparen_loc: Location?, arguments: Node?, rparen_loc: Location?, block: Node?, location: Location) -> void



5828
5829
5830
5831
5832
5833
5834
5835
# File 'lib/yarp/node.rb', line 5828

def initialize(keyword_loc, lparen_loc, arguments, rparen_loc, block, location)
  @keyword_loc = keyword_loc
  @lparen_loc = lparen_loc
  @arguments = arguments
  @rparen_loc = rparen_loc
  @block = block
  @location = location
end

Instance Attribute Details

#argumentsObject (readonly)

attr_reader arguments: Node?



5819
5820
5821
# File 'lib/yarp/node.rb', line 5819

def arguments
  @arguments
end

#blockObject (readonly)

attr_reader block: Node?



5825
5826
5827
# File 'lib/yarp/node.rb', line 5825

def block
  @block
end

#keyword_locObject (readonly)

attr_reader keyword_loc: Location



5813
5814
5815
# File 'lib/yarp/node.rb', line 5813

def keyword_loc
  @keyword_loc
end

#lparen_locObject (readonly)

attr_reader lparen_loc: Location?



5816
5817
5818
# File 'lib/yarp/node.rb', line 5816

def lparen_loc
  @lparen_loc
end

#rparen_locObject (readonly)

attr_reader rparen_loc: Location?



5822
5823
5824
# File 'lib/yarp/node.rb', line 5822

def rparen_loc
  @rparen_loc
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



5838
5839
5840
# File 'lib/yarp/node.rb', line 5838

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

#child_nodesObject Also known as: deconstruct

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



5844
5845
5846
# File 'lib/yarp/node.rb', line 5844

def child_nodes
  [arguments, block]
end

#deconstruct_keys(keys) ⇒ Object

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



5852
5853
5854
# File 'lib/yarp/node.rb', line 5852

def deconstruct_keys(keys)
  { keyword_loc: keyword_loc, lparen_loc: lparen_loc, arguments: arguments, rparen_loc: rparen_loc, block: block, location: location }
end

#keywordObject

def keyword: () -> String



5857
5858
5859
# File 'lib/yarp/node.rb', line 5857

def keyword
  keyword_loc.slice
end

#lparenObject

def lparen: () -> String?



5862
5863
5864
# File 'lib/yarp/node.rb', line 5862

def lparen
  lparen_loc&.slice
end

#rparenObject

def rparen: () -> String?



5867
5868
5869
# File 'lib/yarp/node.rb', line 5867

def rparen
  rparen_loc&.slice
end