Skip to content

Commit 0c008fc

Browse files
committed
Support elsif in ripper translation
1 parent 1729e8a commit 0c008fc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/prism/translation/ripper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,11 @@ def visit_if_node(node)
14881488
consequent = visit(node.consequent)
14891489

14901490
bounds(node.location)
1491-
on_if(predicate, statements, consequent)
1491+
if node.if_keyword == "if"
1492+
on_if(predicate, statements, consequent)
1493+
else
1494+
on_elsif(predicate, statements, consequent)
1495+
end
14921496
else
14931497
statements = visit(node.statements.body.first)
14941498
predicate = visit(node.predicate)

test/prism/ripper_test.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,13 @@ class RipperTest < TestCase
5757
]
5858

5959
skips = incorrect | heredocs | %w[
60-
if.txt
6160
rescue.txt
6261
seattlerb/TestRubyParserShared.txt
6362
seattlerb/block_call_dot_op2_brace_block.txt
6463
seattlerb/block_command_operation_colon.txt
6564
seattlerb/block_command_operation_dot.txt
66-
seattlerb/if_elsif.txt
6765
unparser/corpus/literal/block.txt
6866
unparser/corpus/literal/kwbegin.txt
69-
whitequark/if_elsif.txt
7067
whitequark/send_block_chain_cmd.txt
7168
]
7269

0 commit comments

Comments
 (0)