class Prism::ReturnNode
Represents the use of the return keyword.
return 1 ^^^^^^^^
Represents the use of the return keyword.
return 1 ^^^^^^^^
Public Class Methods
(Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, ArgumentsNode? arguments) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29579 def initialize(source, node_id, location, flags, keyword_loc, arguments) @source = source @node_id = node_id @location = location @flags = flags @keyword_loc = keyword_loc @arguments = arguments end
Initialize a new ReturnNode node.
Initialize a new ReturnNode node.
: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, ArgumentsNode? arguments) -> void
Public Instance Methods
(untyped other) → boolish
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 18969
def ===: (untyped other) -> boolish
: (untyped other) -> boolish
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29708 def arguments @arguments end
Returns the arguments attribute.
:call-seq: arguments -> ArgumentsNode | nil
Returns the arguments attribute.
: () -> ArgumentsNode?
Locations
Public Instance Methods
() → Location
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29687 def keyword_loc location = @keyword_loc return location if location.is_a?(Location) @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
Returns the Location represented by keyword_loc.
:category: Locations :call-seq: keyword_loc -> Location
Returns the Location represented by keyword_loc.
: () -> Location
Node Interface
These methods are present on all subclasses of Node. Read the node interface docs for more information.
Public Class Methods
Public Instance Methods
(_Visitor visitor) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29602 def accept(visitor) visitor.visit_return_node(self) end
() → Array[node?]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29609 def child_nodes [arguments] end
() → Array[node]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29626 def compact_child_nodes compact = [] #: Array[Prism::node] if (arguments = self.arguments); compact << arguments; end compact end
(?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?arguments: ArgumentsNode?) → ReturnNode
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29638 def copy(node_id: self.node_id, location: self.location, flags: self.flags, keyword_loc: self.keyword_loc, arguments: self.arguments) ReturnNode.new(source, node_id, location, flags, keyword_loc, arguments) end
Creates a copy of self with the given fields, using self as the template.
:call-seq: copy(**fields) -> ReturnNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?arguments: ArgumentsNode?) -> ReturnNode
() → Enumerator[node, void]
() { (node) → void } → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29617 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? if (arguments = self.arguments); yield arguments; end end
See Node.each_child_node.
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
Repository
Methods related to Relocation.
Public Instance Methods
(_Repository repository) → Relocation::Entry
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29698 def save_keyword_loc(repository) repository.enter(node_id, :keyword_loc) end
Save the keyword_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the keyword_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry
Slicing
Public Instance Methods
() → String
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 29720 def keyword keyword_loc.slice end
Slice the location of keyword_loc from the source.
:call-seq: keyword -> String
Slice the location of keyword_loc from the source.
: () -> String