anchor.diff:            final int i = localVars.length;
             // TODO (felih): update to use new type system. Add types like
             // LIST_STRING etc.
  -          emit('for (int $localName$i ');
  -          // For-loop (induction, list, set).
  -          localVars.add(null); // declared, but don't use
  -          switch (choose(3)) {
  -            case 0:
  -              emit('= 0; $localName$i < ');
  -              emitSmallPositiveInt(limit: 16);
  -              emit('; $localName$i++) ');
  -              break;
  -            case 1:
  -              emit('in ');
  -              emitCollection(depth + 1, DartType.LIST_INT,
  -                  rhsFilter: rhsFilter);
  -              emit(') ');
  -              break;
  -            default:
  -              emit('in ');
  -              emitCollection(depth + 1, DartType.SET_INT, rhsFilter: rhsFilter);
  -              emit(') ');
  -              break;
  -          }
  -          localVars.removeLast(); // will get type
  +          emitLn('for ', newline: false);
  +          emitParenWrapped(() {
  +            final local = '$localName$i';
  +            iterVars.add(local);
  +            // For-loop (induction, list, set).
  +            localVars.add(null); // declared, but don't use
  +            switch (choose(3)) {
  +              case 0:
  +                emitVariableDeclaration(local, DartType.INT,
  +                    initializerEmitter: emitZero, indent: false);
  +                emitBinaryComparison(() => emit(local), '<',
  +                    () => emitSmallPositiveInt(limit: 16),
  +                    includeSemicolon: true);
  +                emit('$local++');
  +                break;
  +              case 1:
  +                emitVariableDeclaration(local, DartType.INT,
  +                    includeSemicolon: false, indent: false);
  +                emit(' in ');
  +                emitCollection(depth + 1, DartType.LIST_INT,
  +                    rhsFilter: rhsFilter);
  +                break;
  +              default:
  +                emitVariableDeclaration(local, DartType.INT,
  +                    includeSemicolon: false, indent: false);
  +                emit(' in ');
  +                emitCollection(depth + 1, DartType.SET_INT,
  +                    rhsFilter: rhsFilter);
  +                break;
  +            }
  +            localVars.removeLast(); // will get type
  +          });
             nest++;
  -          iterVars.add("$localName$i");
             localVars.add(DartType.INT);
  +          emitNewline();
             emitCollectionElement(depth + 1, tp, rhsFilter: rhsFilter);
             localVars.removeLast();
             iterVars.removeLast();
  
positive.code:   void emitHeader() {
      emitLn('// The Dart Project Fuzz Tester ($version).');
      emitLn('// Program generated as:');
      emitLn('//   dart dartfuzz.dart --seed $seed --${fp ? "" : "no-"}fp ' +
          '--${ffi ? "" : "no-"}ffi --${flatTp ? "" : "no-"}flat');
      emitLn('');
      emitLn("import 'dart:async';");
      emitLn("import 'dart:cli';");
      emitLn("import 'dart:collection';");
      emitLn("import 'dart:convert';");
      emitLn("import 'dart:core';");
      emitLn("import 'dart:io';");
      emitLn("import 'dart:isolate';");
      emitLn("import 'dart:math';");
      emitLn("import 'dart:typed_data';");
      if (ffi) {
        emitLn("import 'dart:ffi' as ffi;");
        emitLn(DartFuzzFfiApi.ffiapi);
      }
    }
  
    void emitFfiCast(String dartFuncName, String ffiFuncName, String typeName,
        List<DartType> pars) {
      emit("${pars[0].name} Function(");
      _emitCommaSeparated((int i) => emit('${pars[i].name}'), pars.length,
          start: 1);
      emit(') ${dartFuncName} = ' +
          'ffi.Pointer.fromFunction<${typeName}>(${ffiFuncName}, ');
      emitLiteral(0, pars[0], smallPositiveValue: true);
      emitLn(').cast<ffi.NativeFunction<${typeName}>>().asFunction();');
    }
  
    void emitMethod(
        String name, int index, List<DartType> method, bool isFfiMethod) {
      if (isFfiMethod) {
        emitFfiTypedef("${name}Ffi${index}Type", method);
        emitLn('${method[0].name} ${name}Ffi$index(', newline: false);
      } else {
        emitLn('${method[0].name} $name$index(', newline: false);
      }
      emitParDecls(method);
      if (!isFfiMethod && rollDice(10)) {
        // Emit a method using "=>" syntax.
        emit(') => ');
        emitExpr(0, method[0], includeSemicolon: true);
        return;
      }
      emit(') ', newline: true);
      _emitBraceWrapped(() {
        assert(localVars.isEmpty);
        if (emitStatements(0)) {
          emitReturn();
        }
        assert(localVars.isEmpty);
      });
      if (isFfiMethod) {
        emitFfiCast("${name}${index}", "${name}Ffi${index}",
            "${name}Ffi${index}Type", method);
      }
      emit('', newline: true);
    }
  
    void emitMethods(String name, List<List<DartType>> methods,
  
negative.code:           }
          }
        }
        emitBraceWrapped(() {
          emitVariableDeclarations('$fieldName${i}_', classFields[i]);
          currentClass = i;
          emitVirtualMethods();
          emitMethods('$methodName${i}_', classMethods[i]);
          emitFunctionDefinition('run', () {
            if (i > 0) {
              // FIXME(bkonyi): fix potential issue where we try to apply a class
              // as a mixin when it calls super.
  