示例#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();
 }
示例#2
0
文件: IfStmt.java 项目: h-inoue/JCop
 public void typeCheck() {
   TypeDecl cond = getCondition().type();
   if (!cond.isBoolean()) {
     error("the type of \"" + getCondition() + "\" is " + cond.name() + " which is not boolean");
   }
 }