break now works; support generation of == for integers
This commit is contained in:
@@ -480,6 +480,21 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (className.equals("Hashable")) {
|
||||||
|
if (op.getName().equals("equals")) {
|
||||||
|
final Type leftType = typeMapper.mapType(bindingContext.getExpressionType(expression.getLeft()));
|
||||||
|
final Type rightType = typeMapper.mapType(bindingContext.getExpressionType(expression.getRight()));
|
||||||
|
if (leftType == Type.INT_TYPE && rightType == Type.INT_TYPE) {
|
||||||
|
gen(expression.getLeft(), Type.INT_TYPE);
|
||||||
|
gen(expression.getRight(), Type.INT_TYPE);
|
||||||
|
myStack.push(StackValue.icmp(JetTokens.EQEQ));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new UnsupportedOperationException("Don't know how to generate equality for these types");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
throw new UnsupportedOperationException("Don't know how to generate binary op for class " + className);
|
throw new UnsupportedOperationException("Don't know how to generate binary op for class " + className);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,10 @@ public abstract class StackValue {
|
|||||||
@Override
|
@Override
|
||||||
public void condJump(Label label, boolean jumpIfFalse, InstructionAdapter v) {
|
public void condJump(Label label, boolean jumpIfFalse, InstructionAdapter v) {
|
||||||
int opcode;
|
int opcode;
|
||||||
if (opToken == JetTokens.GT) {
|
if (opToken == JetTokens.EQEQ) {
|
||||||
|
opcode = jumpIfFalse ? Opcodes.IF_ICMPNE : Opcodes.IF_ICMPEQ;
|
||||||
|
}
|
||||||
|
else if (opToken == JetTokens.GT) {
|
||||||
opcode = jumpIfFalse ? Opcodes.IF_ICMPLE : Opcodes.IF_ICMPGT;
|
opcode = jumpIfFalse ? Opcodes.IF_ICMPLE : Opcodes.IF_ICMPGT;
|
||||||
}
|
}
|
||||||
else if (opToken == JetTokens.LT) {
|
else if (opToken == JetTokens.LT) {
|
||||||
|
|||||||
Reference in New Issue
Block a user