@Override
    public ForStatement toForStatement(ForStatement statement) {
      Scope nestedScope = scope.nest();
      nestedScope.declareForIterationAccess(Identifier.of(ITERATION_ACCESS_VARIABLE));
      Transformer nested = new Transformer(nestedScope);
      return statement
          .withDeclaration(nested.asForStatementDeclarationElements(statement, statement.declaration()))
          .withParts(nested.asForStatementPartsElements(statement, statement.parts()));
    }
Overriden to specify order in which we process declaration first, and then parts.
generator-processor/src/org/immutables/generator/processor/TypeResolver.java