Skip to content

Commit

Permalink
Handle single splat in rescue in ripper translation
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Mar 6, 2024
1 parent 0c008fc commit 76cf29e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/prism/translation/ripper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2306,7 +2306,12 @@ def visit_rescue_node(node)
when 0
nil
when 1
[visit(node.exceptions.first)]
if (exception = node.exceptions.first).is_a?(SplatNode)
bounds(exception.location)
on_mrhs_add_star(on_mrhs_new, visit(exception))
else
[visit(node.exceptions.first)]
end
else
bounds(node.location)
length = node.exceptions.length
Expand Down
1 change: 0 additions & 1 deletion test/prism/ripper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class RipperTest < TestCase
]

skips = incorrect | heredocs | %w[
rescue.txt
seattlerb/TestRubyParserShared.txt
seattlerb/block_call_dot_op2_brace_block.txt
seattlerb/block_command_operation_colon.txt
Expand Down

0 comments on commit 76cf29e

Please sign in to comment.