summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/prism/translation/ripper.rb10
-rw-r--r--test/prism/ripper_test.rb3
2 files changed, 6 insertions, 7 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
diff --git a/test/prism/ripper_test.rb b/test/prism/ripper_test.rb
index 1883fc1e49..50785b4baa 100644
--- a/test/prism/ripper_test.rb
+++ b/test/prism/ripper_test.rb
@@ -90,7 +90,6 @@ module Prism
seattlerb/defn_arg_forward_args.txt
seattlerb/defn_args_forward_args.txt
seattlerb/defn_forward_args.txt
- seattlerb/defn_forward_args__no_parens.txt
seattlerb/defn_kwarg_lvar.txt
seattlerb/defn_oneliner_eq2.txt
seattlerb/defn_oneliner_rescue.txt
@@ -311,11 +310,9 @@ module Prism
whitequark/empty_stmt.txt
whitequark/endless_method.txt
whitequark/endless_method_command_syntax.txt
- whitequark/endless_method_forwarded_args_legacy.txt
whitequark/endless_method_with_rescue_mod.txt
whitequark/endless_method_without_args.txt
whitequark/forward_arg.txt
- whitequark/forward_arg_with_open_args.txt
whitequark/forward_args_legacy.txt
whitequark/forwarded_argument_with_kwrestarg.txt
whitequark/forwarded_argument_with_restarg.txt