Skip to content

Commit

Permalink
Support elsif in ripper translation
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Mar 6, 2024
1 parent 1729e8a commit 0c008fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/prism/translation/ripper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,11 @@ def visit_if_node(node)
consequent = visit(node.consequent)

bounds(node.location)
on_if(predicate, statements, consequent)
if node.if_keyword == "if"
on_if(predicate, statements, consequent)
else
on_elsif(predicate, statements, consequent)
end
else
statements = visit(node.statements.body.first)
predicate = visit(node.predicate)
Expand Down
3 changes: 0 additions & 3 deletions test/prism/ripper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,13 @@ class RipperTest < TestCase
]

skips = incorrect | heredocs | %w[
if.txt
rescue.txt
seattlerb/TestRubyParserShared.txt
seattlerb/block_call_dot_op2_brace_block.txt
seattlerb/block_command_operation_colon.txt
seattlerb/block_command_operation_dot.txt
seattlerb/if_elsif.txt
unparser/corpus/literal/block.txt
unparser/corpus/literal/kwbegin.txt
whitequark/if_elsif.txt
whitequark/send_block_chain_cmd.txt
]

Expand Down

0 comments on commit 0c008fc

Please sign in to comment.