Beispiel #1
0
 @Override
 public Verification verifySelf() {
   return Valid.create();
   //		BreakableStatement ancestor = nearestAncestor(BreakableStatement.class);
   //		return checkNull(ancestor, "The break statement is not nested in a breakable statement",
   // Valid.create());
 }
 @Override
 public Verification verifySelf() {
   Verification result = Valid.create();
   try {
     Expression var = variableExpression();
     if (var == null) {
       result =
           result.and(
               new BasicProblem(this, "The assignment has no variable at the left-hand side"));
     }
     Expression value = getValue();
     if (value == null) {
       result =
           result.and(
               new BasicProblem(
                   this, "The assignment has no valid expression at the right-hand side"));
     }
     Type varType = var.getType();
     Type exprType = value.getType();
     if (!exprType.subtypeOf(varType)) {
       result = result.and(new InvalidType(this, varType, exprType));
     }
   } catch (LookupException e) {
     result =
         result.and(
             new BasicProblem(
                 this,
                 "The type of the expression is not assignable to the type of the variable."));
   }
   return result;
 }
Beispiel #3
0
 @Override
 public Verification verifySelf() {
   return Valid.create();
 }