diff options
author | Kevin Newton <kddnewton@gmail.com> | 2024-03-05 21:29:27 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-03-06 16:42:50 +0000 |
commit | 6b76a765abcb328be1e89a6380df71d2b09f4eff (patch) | |
tree | 653455593e21617c2249fc4e9cc9af63932d3507 /lib/prism/translation/ripper.rb | |
parent | 31ef2f43a77c515371fbfb921a6935bd67ac74a2 (diff) |
[ruby/prism] Fix up yield arguments in ripper translation
https://github.com/ruby/prism/commit/22b9f3ccd9
Diffstat (limited to 'lib/prism/translation/ripper.rb')
-rw-r--r-- | lib/prism/translation/ripper.rb | 15 |
1 files changed, 13 insertions, 2 deletions
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) |