Beispiel #1
0
 /** @apilevel internal */
 private TypeDecl binaryNumericPromotedType_compute() {
   TypeDecl leftType = left().type();
   TypeDecl rightType = right().type();
   if (leftType.isString()) return leftType;
   if (rightType.isString()) return rightType;
   if (leftType.isNumericType() && rightType.isNumericType())
     return leftType.binaryNumericPromotion(rightType);
   if (leftType.isBoolean() && rightType.isBoolean()) return leftType;
   return unknownType();
 }
Beispiel #2
0
 public void typeCheck() {
   TypeDecl cond = getCondition().type();
   if (!cond.isBoolean()) {
     error("the type of \"" + getCondition() + "\" is " + cond.name() + " which is not boolean");
   }
 }