From 507ffc9686a2fbf796fb5401323f613ba373a3f6 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Wed, 6 Mar 2024 01:40:07 -0500 Subject: [ruby/prism] Better handle splats in MRHS in rescues in ripper translation https://github.com/ruby/prism/commit/36a0b2e45a --- lib/prism/translation/ripper.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb index be7157512b..08fd2d14b4 100644 --- a/lib/prism/translation/ripper.rb +++ b/lib/prism/translation/ripper.rb @@ -2318,12 +2318,22 @@ module Prism node.exceptions.each_with_index.inject(on_args_new) do |mrhs, (exception, index)| arg = visit(exception) + bounds(exception.location) + mrhs = on_mrhs_new_from_args(mrhs) if index == length - 1 - if index == length - 1 - on_mrhs_add(on_mrhs_new_from_args(mrhs), arg) + if exception.is_a?(SplatNode) + if index == length - 1 + on_mrhs_add_star(mrhs, arg) + else + on_args_add_star(mrhs, arg) + end else - on_args_add(mrhs, arg) + if index == length - 1 + on_mrhs_add(mrhs, arg) + else + on_args_add(mrhs, arg) + end end end end -- cgit v1.2.3