coerce condition value to Type.BOOLEAN (KT-2147)

This commit is contained in:
Dmitry Jemerov
2012-05-31 13:59:42 +02:00
parent 33f0a3cee0
commit b03966e8d0
3 changed files with 19 additions and 9 deletions
@@ -72,17 +72,13 @@ public abstract class StackValue {
}
public void condJump(Label label, boolean jumpIfFalse, InstructionAdapter v) {
if (this.type == Type.BOOLEAN_TYPE) {
put(Type.BOOLEAN_TYPE, v);
if (jumpIfFalse) {
v.ifeq(label);
}
else {
v.ifne(label);
}
put(this.type, v);
coerce(Type.BOOLEAN_TYPE, v);
if (jumpIfFalse) {
v.ifeq(label);
}
else {
throw new UnsupportedOperationException("can't generate a cond jump for a non-boolean value");
v.ifne(label);
}
}