示例#1
0
 public Object visitStmtFor(StmtFor stmt) {
   // Only recurse into the body.
   Statement newBody = (Statement) stmt.getBody().accept(this);
   if (newBody == stmt.getBody()) return stmt;
   return new StmtFor(
       stmt, stmt.getInit(), stmt.getCond(), stmt.getIncr(), newBody, stmt.isCanonical());
 }
  public Object visitStmtFor(StmtFor stmt) {

    Statement newInit = null;
    if (stmt.getInit() != null) {
      newInit = (Statement) stmt.getInit().accept(this);
    }
    if (stmt.getCond() != null) {
      stmt.getCond().accept(new UpgradeStarToInt(this, TypePrimitive.bittype, nres));
    }
    Expression newCond = stmt.getCond();
    Statement newIncr = null;
    if (stmt.getIncr() != null) {
      newIncr = (Statement) stmt.getIncr().accept(this);
    }
    Statement tmp = stmt.getBody();
    Statement newBody = StmtEmpty.EMPTY;
    if (tmp != null) {
      newBody = (Statement) tmp.accept(this);
    }

    if (newInit == stmt.getInit()
        && newCond == stmt.getCond()
        && newIncr == stmt.getIncr()
        && newBody == stmt.getBody()) return stmt;
    return new StmtFor(stmt, newInit, newCond, newIncr, newBody, stmt.isCanonical());
  }