Skip to content

Commit 76cf29e

Browse files
committed
Handle single splat in rescue in ripper translation
1 parent 0c008fc commit 76cf29e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/prism/translation/ripper.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,12 @@ def visit_rescue_node(node)
23062306
when 0
23072307
nil
23082308
when 1
2309-
[visit(node.exceptions.first)]
2309+
if (exception = node.exceptions.first).is_a?(SplatNode)
2310+
bounds(exception.location)
2311+
on_mrhs_add_star(on_mrhs_new, visit(exception))
2312+
else
2313+
[visit(node.exceptions.first)]
2314+
end
23102315
else
23112316
bounds(node.location)
23122317
length = node.exceptions.length

test/prism/ripper_test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class RipperTest < TestCase
5757
]
5858

5959
skips = incorrect | heredocs | %w[
60-
rescue.txt
6160
seattlerb/TestRubyParserShared.txt
6261
seattlerb/block_call_dot_op2_brace_block.txt
6362
seattlerb/block_command_operation_colon.txt

0 commit comments

Comments
 (0)