Class: YARP::ReturnNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ReturnNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘return` keyword.
return 1
^^^^^^^^
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
attr_reader arguments: Node?.
-
#keyword_loc ⇒ Object
readonly
attr_reader keyword_loc: Location.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(keyword_loc, arguments, location) ⇒ ReturnNode
constructor
def initialize: (keyword_loc: Location, arguments: Node?, location: Location) -> void.
-
#keyword ⇒ Object
def keyword: () -> String.
Constructor Details
#initialize(keyword_loc, arguments, location) ⇒ ReturnNode
def initialize: (keyword_loc: Location, arguments: Node?, location: Location) -> void
5448 5449 5450 5451 5452 |
# File 'lib/yarp/node.rb', line 5448 def initialize(keyword_loc, arguments, location) @keyword_loc = keyword_loc @arguments = arguments @location = location end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
attr_reader arguments: Node?
5445 5446 5447 |
# File 'lib/yarp/node.rb', line 5445 def arguments @arguments end |
#keyword_loc ⇒ Object (readonly)
attr_reader keyword_loc: Location
5442 5443 5444 |
# File 'lib/yarp/node.rb', line 5442 def keyword_loc @keyword_loc end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
5455 5456 5457 |
# File 'lib/yarp/node.rb', line 5455 def accept(visitor) visitor.visit_return_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
5460 5461 5462 |
# File 'lib/yarp/node.rb', line 5460 def child_nodes [arguments] end |
#deconstruct_keys(keys) ⇒ Object
5468 5469 5470 |
# File 'lib/yarp/node.rb', line 5468 def deconstruct_keys(keys) { keyword_loc: keyword_loc, arguments: arguments, location: location } end |
#keyword ⇒ Object
def keyword: () -> String
5473 5474 5475 |
# File 'lib/yarp/node.rb', line 5473 def keyword keyword_loc.slice end |