Class: YARP::YieldNode

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

Overview

Represents the use of the ‘yield` keyword.

yield 1
^^^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keyword_loc, lparen_loc, arguments, rparen_loc, location) ⇒ YieldNode

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



6360
6361
6362
6363
6364
6365
6366
# File 'lib/yarp/node.rb', line 6360

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

Instance Attribute Details

#argumentsObject (readonly)

attr_reader arguments: Node?



6354
6355
6356
# File 'lib/yarp/node.rb', line 6354

def arguments
  @arguments
end

#keyword_locObject (readonly)

attr_reader keyword_loc: Location



6348
6349
6350
# File 'lib/yarp/node.rb', line 6348

def keyword_loc
  @keyword_loc
end

#lparen_locObject (readonly)

attr_reader lparen_loc: Location?



6351
6352
6353
# File 'lib/yarp/node.rb', line 6351

def lparen_loc
  @lparen_loc
end

#rparen_locObject (readonly)

attr_reader rparen_loc: Location?



6357
6358
6359
# File 'lib/yarp/node.rb', line 6357

def rparen_loc
  @rparen_loc
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



6369
6370
6371
# File 'lib/yarp/node.rb', line 6369

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

#child_nodesObject Also known as: deconstruct

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



6374
6375
6376
# File 'lib/yarp/node.rb', line 6374

def child_nodes
  [arguments]
end

#deconstruct_keys(keys) ⇒ Object

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



6382
6383
6384
# File 'lib/yarp/node.rb', line 6382

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

#keywordObject

def keyword: () -> String



6387
6388
6389
# File 'lib/yarp/node.rb', line 6387

def keyword
  keyword_loc.slice
end

#lparenObject

def lparen: () -> String?



6392
6393
6394
# File 'lib/yarp/node.rb', line 6392

def lparen
  lparen_loc&.slice
end

#rparenObject

def rparen: () -> String?



6397
6398
6399
# File 'lib/yarp/node.rb', line 6397

def rparen
  rparen_loc&.slice
end