This commit is contained in:
Dmitry Jemerov
2011-04-07 13:21:28 +02:00
parent 0af4b3b4c1
commit b722300db7
2 changed files with 8 additions and 0 deletions
@@ -138,6 +138,9 @@ public abstract class StackValue {
else if (opToken == JetTokens.GT) {
opcode = jumpIfFalse ? Opcodes.IF_ICMPLE : Opcodes.IF_ICMPGT;
}
else if (opToken == JetTokens.GTEQ) {
opcode = jumpIfFalse ? Opcodes.IF_ICMPLT : Opcodes.IF_ICMPGE;
}
else if (opToken == JetTokens.LT) {
opcode = jumpIfFalse ? Opcodes.IF_ICMPGE : Opcodes.IF_ICMPLT;
}
@@ -185,6 +185,11 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
binOpTest("fun foo(a: Int, b: Int): Int = if (a != b) 1 else 0", 5, 3, 1);
}
public void testGE() throws Exception {
binOpTest("fun foo(a: Int, b: Int): Int = if (a >= b) 1 else 0", 5, 5, 1);
binOpTest("fun foo(a: Int, b: Int): Int = if (a >= b) 1 else 0", 3, 5, 0);
}
public void testIfNoElse() throws Exception {
loadFile("ifNoElse.jet");
System.out.println(generateToText());