summaryrefslogtreecommitdiff
path: root/lib/prism/translation/ripper.rb
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-03-05 20:16:38 -0500
committergit <svn-admin@ruby-lang.org>2024-03-06 16:42:47 +0000
commit8f7db7e64c7bd34e75fdac5794e7a4e32a2f2df1 (patch)
tree719f968c630b36f191449b997030d6fe192795a6 /lib/prism/translation/ripper.rb
parente97b364adb0e4447c1c361c438dacc25ca757c95 (diff)
[ruby/prism] Fix up forwarding arguments for ripper translation
https://github.com/ruby/prism/commit/9dbad71aa3
Diffstat (limited to 'lib/prism/translation/ripper.rb')
-rw-r--r--lib/prism/translation/ripper.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb
index ea1a1882e4..ae7ba6d536 100644
--- a/lib/prism/translation/ripper.rb
+++ b/lib/prism/translation/ripper.rb
@@ -248,7 +248,6 @@ module Prism
# Visit a list of elements, like the elements of an array or arguments.
private def visit_arguments(elements)
bounds(elements.first.location)
-
elements.inject(on_args_new) do |args, element|
arg = visit(element)
bounds(element.location)
@@ -626,10 +625,12 @@ module Prism
end
arguments =
- if arguments.any?
+ if arguments.length == 1 && arguments.first.is_a?(ForwardingArgumentsNode)
+ visit(arguments.first)
+ elsif arguments.any?
args = visit_arguments(arguments)
- if block.is_a?(BlockArgumentNode)
+ if block.is_a?(BlockArgumentNode) || arguments.last.is_a?(ForwardingArgumentsNode)
args
else
bounds(arguments.first.location)
@@ -1208,7 +1209,8 @@ module Prism
# def foo(...); bar(...); end
# ^^^
def visit_forwarding_arguments_node(node)
- raise NoMethodError, __method__
+ bounds(node.location)
+ on_args_forward
end
# def foo(...); end