From 6b76a765abcb328be1e89a6380df71d2b09f4eff Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 5 Mar 2024 21:29:27 -0500 Subject: [ruby/prism] Fix up yield arguments in ripper translation https://github.com/ruby/prism/commit/22b9f3ccd9 --- lib/prism/translation/ripper.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb index 12fa2a5cc8..a088165dde 100644 --- a/lib/prism/translation/ripper.rb +++ b/lib/prism/translation/ripper.rb @@ -2500,11 +2500,22 @@ module Prism # yield 1 # ^^^^^^^ def visit_yield_node(node) - if node.arguments.nil? + if node.arguments.nil? && node.lparen_loc.nil? bounds(node.location) on_yield0 else - arguments = visit(node.arguments) + arguments = + if node.arguments.nil? + bounds(node.location) + on_args_new + else + visit(node.arguments) + end + + unless node.lparen_loc.nil? + bounds(node.lparen_loc) + arguments = on_paren(arguments) + end bounds(node.location) on_yield(arguments) -- cgit v1.2.3