instance method
Prism::Translation::Parser::Compiler#find_forwarding
find_forwarding(node)
lib/prism/translation/parser/compiler.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/translation/parser/compiler.rb, line 1950
def find_forwarding(node)
return [] if node.nil?
forwarding = []
forwarding << :* if node.rest.is_a?(RestParameterNode) && node.rest.name.nil?
forwarding << :** if node.keyword_rest.is_a?(KeywordRestParameterNode) && node.keyword_rest.name.nil?
forwarding << :& if !node.block.nil? && node.block.name.nil?
forwarding |= [:&, :"..."] if node.keyword_rest.is_a?(ForwardingParameterNode)
forwarding
end
When , *, &, or … are used as an argument in a method call, we check if they were allowed by the current context. To determine that we build this lookup table.