Class: Prism::ForwardingSuperNode

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

Overview

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

super
^^^^^

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, node_id, location, flags, block) ⇒ ForwardingSuperNode

Initialize a new ForwardingSuperNode node.



6586
6587
6588
6589
6590
6591
6592
# File 'lib/prism/node.rb', line 6586

def initialize(source, node_id, location, flags, block)
  @source = source
  @node_id = node_id
  @location = location
  @flags = flags
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

attr_reader block: BlockNode?



6630
6631
6632
# File 'lib/prism/node.rb', line 6630

def block
  @block
end

Class Method Details

.typeObject

Return a symbol representation of this node type. See ‘Node::type`.



6643
6644
6645
# File 'lib/prism/node.rb', line 6643

def self.type
  :forwarding_super_node
end

Instance Method Details

#===(other) ⇒ Object

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.



6649
6650
6651
6652
# File 'lib/prism/node.rb', line 6649

def ===(other)
  other.is_a?(ForwardingSuperNode) &&
    (block === other.block)
end

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



6595
6596
6597
# File 'lib/prism/node.rb', line 6595

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

#child_nodesObject Also known as: deconstruct

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



6600
6601
6602
# File 'lib/prism/node.rb', line 6600

def child_nodes
  [block]
end

#comment_targetsObject

def comment_targets: () -> Array[Node | Location]



6612
6613
6614
# File 'lib/prism/node.rb', line 6612

def comment_targets
  [*block] #: Array[Prism::node | Location]
end

#compact_child_nodesObject

def compact_child_nodes: () -> Array



6605
6606
6607
6608
6609
# File 'lib/prism/node.rb', line 6605

def compact_child_nodes
  compact = [] #: Array[Prism::node]
  compact << block if block
  compact
end

#copy(node_id: self.node_id, location: self.location, flags: self.flags, block: self.block) ⇒ Object

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?block: BlockNode?) -> ForwardingSuperNode



6617
6618
6619
# File 'lib/prism/node.rb', line 6617

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

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, block: BlockNode? }



6625
6626
6627
# File 'lib/prism/node.rb', line 6625

def deconstruct_keys(keys)
  { node_id: node_id, location: location, block: block }
end

#inspectObject

def inspect -> String



6633
6634
6635
# File 'lib/prism/node.rb', line 6633

def inspect
  InspectVisitor.compose(self)
end

#typeObject

Return a symbol representation of this node type. See ‘Node#type`.



6638
6639
6640
# File 'lib/prism/node.rb', line 6638

def type
  :forwarding_super_node
end