Skip to content


Handle when with a DNode just like a normal expression in IR.
Browse files Browse the repository at this point in the history
This is a gross fix, and we need to reexamine this code.

It will be a fix for #2423 in the interim.
  • Loading branch information
headius committed Jan 5, 2015
1 parent 32cdcfb commit 2eb920d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/main/java/org/jruby/ir/
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,14 @@ public Operand buildCase(CaseNode caseNode, IRScope s) {
Variable eqqResult = s.createTemporaryVariable();
Operand v1, v2;
if (whenNode.getExpressionNodes() instanceof ListNode) {
if (whenNode.getExpressionNodes() instanceof DNode) {
// DNode produces a proper result, so we don't want the special ListNode handling below
// FIXME: This is obviously gross, and we need a better way to filter out non-expression ListNode here
// See GH #2423
s.addInstr(new EQQInstr(eqqResult, build(whenNode.getExpressionNodes(), s), value));
v1 = eqqResult;
v2 = manager.getTrue();
} else if (whenNode.getExpressionNodes() instanceof ListNode) {
// Note about refactoring:
// - BEQInstr has a quick implementation when the second operand is a boolean literal
// If it can be fixed to do this even on the first operand, we can switch around
Expand Down

0 comments on commit 2eb920d

Please sign in to comment.