Skip to content

Commit 2eb920d

Browse files
committed
Handle when with a DNode just like a normal expression in IR.
This is a gross fix, and we need to reexamine this code. It will be a fix for #2423 in the interim.
1 parent 32cdcfb commit 2eb920d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/src/main/java/org/jruby/ir/IRBuilder.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,14 @@ public Operand buildCase(CaseNode caseNode, IRScope s) {
10341034
Variable eqqResult = s.createTemporaryVariable();
10351035
labels.add(bodyLabel);
10361036
Operand v1, v2;
1037-
if (whenNode.getExpressionNodes() instanceof ListNode) {
1037+
if (whenNode.getExpressionNodes() instanceof DNode) {
1038+
// DNode produces a proper result, so we don't want the special ListNode handling below
1039+
// FIXME: This is obviously gross, and we need a better way to filter out non-expression ListNode here
1040+
// See GH #2423
1041+
s.addInstr(new EQQInstr(eqqResult, build(whenNode.getExpressionNodes(), s), value));
1042+
v1 = eqqResult;
1043+
v2 = manager.getTrue();
1044+
} else if (whenNode.getExpressionNodes() instanceof ListNode) {
10381045
// Note about refactoring:
10391046
// - BEQInstr has a quick implementation when the second operand is a boolean literal
10401047
// If it can be fixed to do this even on the first operand, we can switch around

0 commit comments

Comments
 (0)