instance method
Prism::Translation::Parser::Compiler#visit_splat_node
visit_splat_node(node)
lib/prism/translation/parser/compiler.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/translation/parser/compiler.rb, line 1694
def visit_splat_node(node)
if node.expression.nil? && forwarding.include?(:*)
builder.forwarded_restarg(token(node.operator_loc))
elsif in_destructure
builder.restarg(token(node.operator_loc), token(node.expression&.location))
elsif in_pattern
builder.match_rest(token(node.operator_loc), token(node.expression&.location))
else
builder.splat(token(node.operator_loc), visit(node.expression))
end
end
foo(*bar) ^^^^
def foo((bar, *baz)); end ^^^^
def foo(); bar(); end ^