summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/prism/translation/ripper.rb15
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)