예제 #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");
   }
 }