class YARP::ReturnNode
Represents the use of the ‘return` keyword.
return 1 ^^^^^^^^
Attributes
arguments[R]
attr_reader arguments: ArgumentsNode
?
keyword_loc[R]
attr_reader keyword_loc
: Location
Public Class Methods
new(keyword_loc, arguments, location)
click to toggle source
def initialize: (keyword_loc
: Location
, arguments: ArgumentsNode
?, location: Location
) -> void
# File yarp/node.rb, line 9440 def initialize(keyword_loc, arguments, location) @keyword_loc = keyword_loc @arguments = arguments @location = location end
Public Instance Methods
accept(visitor)
click to toggle source
def accept: (visitor: Visitor
) -> void
# File yarp/node.rb, line 9447 def accept(visitor) visitor.visit_return_node(self) end
child_nodes()
click to toggle source
def child_nodes
: () -> Array[nil | Node]
# File yarp/node.rb, line 9452 def child_nodes [arguments] end
Also aliased as: deconstruct
comment_targets()
click to toggle source
def comment_targets
: () -> Array[Node | Location]
# File yarp/node.rb, line 9457 def comment_targets [keyword_loc, *arguments] end
copy(**params)
click to toggle source
def copy: (**params) -> ReturnNode
# File yarp/node.rb, line 9462 def copy(**params) ReturnNode.new( params.fetch(:keyword_loc) { keyword_loc }, params.fetch(:arguments) { arguments }, params.fetch(:location) { location }, ) end
deconstruct_keys(keys)
click to toggle source
inspect(inspector = NodeInspector.new)
click to toggle source
# File yarp/node.rb, line 9483 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n" if (arguments = self.arguments).nil? inspector << "└── arguments: ∅\n" else inspector << "└── arguments:\n" inspector << arguments.inspect(inspector.child_inspector(" ")).delete_prefix(inspector.prefix) end inspector.to_str end
keyword()
click to toggle source
def keyword: () -> String
# File yarp/node.rb, line 9479 def keyword keyword_loc.slice end