Class: Prism::RedoNode

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

Overview

Represents the use of the ‘redo` keyword.

redo
^^^^

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, node_id, location, flags) ⇒ RedoNode

Initialize a new RedoNode node.



15354
15355
15356
15357
15358
15359
# File 'lib/prism/node.rb', line 15354

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

Class Method Details

.typeObject

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



15405
15406
15407
# File 'lib/prism/node.rb', line 15405

def self.type
  :redo_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.



15411
15412
15413
# File 'lib/prism/node.rb', line 15411

def ===(other)
  other.is_a?(RedoNode)
end

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



15362
15363
15364
# File 'lib/prism/node.rb', line 15362

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

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array



15367
15368
15369
# File 'lib/prism/node.rb', line 15367

def child_nodes
  []
end

#comment_targetsObject

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



15377
15378
15379
# File 'lib/prism/node.rb', line 15377

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



15372
15373
15374
# File 'lib/prism/node.rb', line 15372

def compact_child_nodes
  []
end

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

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> RedoNode



15382
15383
15384
# File 'lib/prism/node.rb', line 15382

def copy(node_id: self.node_id, location: self.location, flags: self.flags)
  RedoNode.new(source, node_id, location, flags)
end

#deconstruct_keys(keys) ⇒ Object

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



15390
15391
15392
# File 'lib/prism/node.rb', line 15390

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

#inspectObject

def inspect -> String



15395
15396
15397
# File 'lib/prism/node.rb', line 15395

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



15400
15401
15402
# File 'lib/prism/node.rb', line 15400

def type
  :redo_node
end