mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-27 15:48:03 +00:00
Fixed error in TypedBinary
This commit is contained in:
parent
80b58ef5dd
commit
d0b98054a5
@ -52,13 +52,20 @@ public class TypedBinary implements TypedExpression {
|
|||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Type mismatch in " + op);
|
throw new RuntimeException("Type mismatch in " + op);
|
||||||
}
|
}
|
||||||
} else if (op == Operator.EQ || op == Operator.NE || op == Operator.AND || op == Operator.OR) {
|
} else if (op == Operator.EQ || op == Operator.NE ) {
|
||||||
if (leftType == Type.INT && rightType == Type.INT || leftType == Type.BOOL && rightType == Type.BOOL) {
|
if (leftType == Type.INT && rightType == Type.INT || leftType == Type.BOOL && rightType == Type.BOOL) {
|
||||||
type = Type.BOOL;
|
type = Type.BOOL;
|
||||||
return Type.BOOL;
|
return Type.BOOL;
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Type mismatch in " + op);
|
throw new RuntimeException("Type mismatch in " + op);
|
||||||
}
|
}
|
||||||
|
} else if (op == Operator.AND || op == Operator.OR ){
|
||||||
|
if (leftType == Type.BOOL && rightType == Type.BOOL) {
|
||||||
|
type = Type.BOOL;
|
||||||
|
return Type.BOOL;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Type mismatch in " + op);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leftType == rightType && leftType != Type.VOID) {
|
if (leftType == rightType && leftType != Type.VOID) {
|
||||||
|
Loading…
Reference in New Issue
Block a user