class Prism::YieldNode
Represents the use of the yield keyword.
yield 1 ^^^^^^^
Represents the use of the yield keyword.
yield 1 ^^^^^^^
Public Class Methods
(Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 33516 def initialize(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc) @source = source @node_id = node_id @location = location @flags = flags @keyword_loc = keyword_loc @lparen_loc = lparen_loc @arguments = arguments @rparen_loc = rparen_loc end
Initialize a new YieldNode node.
Initialize a new YieldNode node.
: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc) -> 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 21442
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 33678 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 33630 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
() → Location?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 33652 def lparen_loc location = @lparen_loc case location when nil nil when Location location else @lparen_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end end
Returns the Location represented by lparen_loc.
:category: Locations :call-seq: lparen_loc -> Location | nil
Returns the Location represented by lparen_loc.
: () -> Location?
() → Location?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 33689 def rparen_loc location = @rparen_loc case location when nil nil when Location location else @rparen_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end end
Returns the Location represented by rparen_loc.
:category: Locations :call-seq: rparen_loc -> Location | nil
Returns the Location represented by rparen_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 33541 def accept(visitor) visitor.visit_yield_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 33548 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 33565 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, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?) → YieldNode
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 33577 def copy(node_id: self.node_id, location: self.location, flags: self.flags, keyword_loc: self.keyword_loc, lparen_loc: self.lparen_loc, arguments: self.arguments, rparen_loc: self.rparen_loc) YieldNode.new(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc) end
Creates a copy of self with the given fields, using self as the template.
:call-seq: copy(**fields) -> YieldNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?) -> YieldNode
() → 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 33556 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 33641 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
(_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 33669 def save_lparen_loc(repository) repository.enter(node_id, :lparen_loc) unless @lparen_loc.nil? end
Save the lparen_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the lparen_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry?
(_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 33706 def save_rparen_loc(repository) repository.enter(node_id, :rparen_loc) unless @rparen_loc.nil? end
Save the rparen_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the rparen_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 33717 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
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 33727 def lparen lparen_loc&.slice end
Slice the location of lparen_loc from the source.
:call-seq: lparen -> String | nil
Slice the location of lparen_loc from the source.
: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 33737 def rparen rparen_loc&.slice end
Slice the location of rparen_loc from the source.
:call-seq: rparen -> String | nil
Slice the location of rparen_loc from the source.
: () -> String?