Class: YARP::SourceLineNode

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

Overview

Represents the use of the ‘__LINE__` keyword.

__LINE__
^^^^^^^^

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ SourceLineNode

def initialize: (location: Location) -> void



9381
9382
9383
# File 'lib/yarp/node.rb', line 9381

def initialize(location)
  @location = location
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



9386
9387
9388
# File 'lib/yarp/node.rb', line 9386

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

#child_nodesObject Also known as: deconstruct

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



9391
9392
9393
# File 'lib/yarp/node.rb', line 9391

def child_nodes
  []
end

#comment_targetsObject

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



9396
9397
9398
# File 'lib/yarp/node.rb', line 9396

def comment_targets
  []
end

#copy(**params) ⇒ Object

def copy: (**params) -> SourceLineNode



9401
9402
9403
9404
9405
# File 'lib/yarp/node.rb', line 9401

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

#deconstruct_keys(keys) ⇒ Object

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



9411
9412
9413
# File 'lib/yarp/node.rb', line 9411

def deconstruct_keys(keys)
  { location: location }
end

#inspect(inspector = NodeInspector.new) ⇒ Object



9415
9416
9417
9418
# File 'lib/yarp/node.rb', line 9415

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