Updated TypedBinary

This commit is contained in:
ahmad 2024-06-28 17:55:53 +02:00
parent adf00a1803
commit 3ca35151a4

View File

@ -55,14 +55,7 @@ public class TypedBinary implements TypedExpression {
} else {
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);
}
} else if(op == Operator.EQ || op == Operator.NE){
} else if(op == Operator.EQ || op == Operator.NE || op == Operator.AND || op == Operator.OR){
if(leftType == Type.INT && rightType == Type.INT || leftType == Type.BOOL && rightType == Type.BOOL){
type = Type.BOOL;
return Type.BOOL;