Represents the use of the super keyword without parentheses or arguments, but which might have a block.
super
^^^^^
super { 123 }
^^^^^^^^^^^^^
If it has any other arguments, it would be a SuperNode instead.
All other arguments are forwarded as normal, except the original block is replaced with the new block.
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7582
def initialize(source, node_id, location, flags, block)
@source = source
@node_id = node_id
@location = location
@flags = flags
@block = block
end
Initialize a new ForwardingSuperNode node.
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7639
def self.type
:forwarding_super_node
end
Return a symbol representation of this node type. See Node::type.
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7645
def ===(other)
other.is_a?(ForwardingSuperNode) &&
(block === other.block)
end
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7591
def accept(visitor)
visitor.visit_forwarding_super_node(self)
end
def accept: (Visitor visitor) -> void
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7596
def child_nodes
[block]
end
def child_nodes: () -> Array
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7608
def comment_targets
[*block] #: Array[Prism::node | Location]
end
def comment_targets: () -> Array[Node | Location]
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7601
def compact_child_nodes
compact = [] #: Array[Prism::node]
compact << block if block
compact
end
def compact_child_nodes: () -> Array
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7613
def copy(node_id: self.node_id, location: self.location, flags: self.flags, block: self.block)
ForwardingSuperNode.new(source, node_id, location, flags, block)
end
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?block: BlockNode?) -> ForwardingSuperNode
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7621
def deconstruct_keys(keys)
{ node_id: node_id, location: location, block: block }
end
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, block: BlockNode? }
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7629
def inspect
InspectVisitor.compose(self)
end
def inspect -> String
# File tmp/rubies/ruby-4.0.0/lib/prism/node.rb, line 7634
def type
:forwarding_super_node
end
Return a symbol representation of this node type. See Node#type.