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.



15177
15178
15179
15180
15181
15182
# File 'lib/prism/node.rb', line 15177

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`.



15228
15229
15230
# File 'lib/prism/node.rb', line 15228

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.



15234
15235
15236
# File 'lib/prism/node.rb', line 15234

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



15185
15186
15187
# File 'lib/prism/node.rb', line 15185

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

#child_nodesObject Also known as: deconstruct

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



15190
15191
15192
# File 'lib/prism/node.rb', line 15190

def child_nodes
  []
end

#comment_targetsObject

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



15200
15201
15202
# File 'lib/prism/node.rb', line 15200

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



15195
15196
15197
# File 'lib/prism/node.rb', line 15195

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



15205
15206
15207
# File 'lib/prism/node.rb', line 15205

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 }



15213
15214
15215
# File 'lib/prism/node.rb', line 15213

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

#inspectObject

def inspect -> String



15218
15219
15220
# File 'lib/prism/node.rb', line 15218

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



15223
15224
15225
# File 'lib/prism/node.rb', line 15223

def type
  :redo_node
end