Class: YARP::MissingNode

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

Overview

Represents a node that is missing from the source and results in a syntax error.

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ MissingNode

def initialize: (location: Location) -> void



7043
7044
7045
# File 'lib/yarp/node.rb', line 7043

def initialize(location)
  @location = location
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



7048
7049
7050
# File 'lib/yarp/node.rb', line 7048

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

#child_nodesObject Also known as: deconstruct

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



7053
7054
7055
# File 'lib/yarp/node.rb', line 7053

def child_nodes
  []
end

#comment_targetsObject

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



7058
7059
7060
# File 'lib/yarp/node.rb', line 7058

def comment_targets
  []
end

#copy(**params) ⇒ Object

def copy: (**params) -> MissingNode



7063
7064
7065
7066
7067
# File 'lib/yarp/node.rb', line 7063

def copy(**params)
  MissingNode.new(
    params.fetch(:location) { location },
  )
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]



7073
7074
7075
# File 'lib/yarp/node.rb', line 7073

def deconstruct_keys(keys)
  { location: location }
end

#inspect(inspector = NodeInspector.new) ⇒ Object



7077
7078
7079
7080
# File 'lib/yarp/node.rb', line 7077

def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector.to_str
end