[ruby/prism] Fix up yield arguments in ripper translation

22b9f3ccd9
This commit is contained in:
Kevin Newton 2024-03-05 21:29:27 -05:00 committed by git
parent 31ef2f43a7
commit 6b76a765ab
2 changed files with 13 additions and 6 deletions

View file

@ -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)

View file

@ -167,7 +167,6 @@ module Prism
seattlerb/str_single_double_escaped_newline.txt
seattlerb/thingy.txt
seattlerb/yield_call_assocs.txt
seattlerb/yield_empty_parens.txt
single_method_call_with_bang.txt
spanning_heredoc.txt
spanning_heredoc_newlines.txt
@ -197,7 +196,6 @@ module Prism
unparser/corpus/literal/since/27.txt
unparser/corpus/literal/since/31.txt
unparser/corpus/literal/while.txt
unparser/corpus/literal/yield.txt
unparser/corpus/semantic/dstr.txt
unparser/corpus/semantic/literal.txt
unparser/corpus/semantic/while.txt
@ -276,9 +274,7 @@ module Prism
whitequark/ternary.txt
whitequark/ternary_ambiguous_symbol.txt
whitequark/trailing_forward_arg.txt
whitequark/yield.txt
xstring.txt
yield.txt
]
relatives.each do |relative|