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.



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

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



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

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.



15240
15241
15242
# File 'lib/prism/node.rb', line 15240

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



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

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

#child_nodesObject Also known as: deconstruct

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



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

def child_nodes
  []
end

#comment_targetsObject

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



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

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



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

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



15211
15212
15213
# File 'lib/prism/node.rb', line 15211

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 }



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

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

#inspectObject

def inspect -> String



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

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



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

def type
  :redo_node
end