Class: YARP::NextNode

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

Overview

Represents the use of the ‘next` keyword.

next 1
^^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments, keyword_loc, location) ⇒ NextNode

def initialize: (arguments: Node?, keyword_loc: Location, location: Location) -> void



4321
4322
4323
4324
4325
# File 'lib/yarp/node.rb', line 4321

def initialize(arguments, keyword_loc, location)
  @arguments = arguments
  @keyword_loc = keyword_loc
  @location = location
end

Instance Attribute Details

#argumentsObject (readonly)

attr_reader arguments: Node?



4315
4316
4317
# File 'lib/yarp/node.rb', line 4315

def arguments
  @arguments
end

#keyword_locObject (readonly)

attr_reader keyword_loc: Location



4318
4319
4320
# File 'lib/yarp/node.rb', line 4318

def keyword_loc
  @keyword_loc
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



4328
4329
4330
# File 'lib/yarp/node.rb', line 4328

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

#child_nodesObject Also known as: deconstruct

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



4333
4334
4335
# File 'lib/yarp/node.rb', line 4333

def child_nodes
  [arguments]
end

#deconstruct_keys(keys) ⇒ Object

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



4341
4342
4343
# File 'lib/yarp/node.rb', line 4341

def deconstruct_keys(keys)
  { arguments: arguments, keyword_loc: keyword_loc, location: location }
end

#keywordObject

def keyword: () -> String



4346
4347
4348
# File 'lib/yarp/node.rb', line 4346

def keyword
  keyword_loc.slice
end