anchor.diff:                'a full stack trace');
         emitLn('// which, in turn, flags the problem prominently');
         emitLn('if (ffiTestFunctions == null) {');
  -      indent += 2;
  -      emitLn('print(\'Did not load ffi test functions\');');
  -      indent -= 2;
  +      incIndent();
  +      emitPrint('Did not load ffi test functions');
  +      decIndent();
         emitLn('}');
       }
     }
   
  -  void emitTryCatchFinally(Function tryBody, Function catchBody,
  -      {Function finallyBody}) {
  -    emitLn('try {');
  -    indent += 2;
  -    emitLn("", newline: false);
  -    tryBody();
  -    emit(";", newline: true);
  -    indent -= 2;
  -    emitLn('} on OutOfMemoryError {');
  -    indent += 2;
  -    emitLn("exit(${oomExitCode});");
  -    indent -= 2;
  -    emitLn('} catch (e, st) {');
  -    indent += 2;
  -    catchBody();
  -    indent -= 2;
  -    if (finallyBody != null) {
  -      emitLn('} finally {');
  -      indent += 2;
  -      finallyBody();
  -      indent -= 2;
  -    }
  -    emitLn('}');
  -  }
  -
  -  void emitMain() {
  -    emitLn('main() {');
  -    indent += 2;
  -
  -    emitLoadFfiLib();
  -
  -    // Call each global method once.
  -    for (int i = 0; i < globalMethods.length; i++) {
  -      emitTryCatchFinally(() {
  -        emitCall(1, "$methodName${i}", globalMethods[i]);
  -      }, () {
  -        emitLn("print('$methodName$i throws');");
  -      });
  -    }
  -
  -    // Call each class method once.
  -    for (int i = 0; i < classMethods.length; i++) {
  -      for (int j = 0; j < classMethods[i].length; j++) {
  -        emitTryCatchFinally(() {
  -          emitCall(1, "X${i}().$methodName${i}_${j}", classMethods[i][j]);
  -        }, () {
  -          emitLn("print('X${i}().$methodName${i}_${j}() throws');");
  -        });
  -      }
  -      // Call each virtual class method once.
  -      int parentClass = classParents[i];
  -      while (parentClass >= 0) {
  -        if (virtualClassMethods[i].containsKey(parentClass)) {
  -          for (int j = 0; j < virtualClassMethods[i][parentClass].length; j++) {
  +  void emitMain() => _emitFunctionDefinition('main', () {
  +        emitLoadFfiLib();
  +
  +        // Call each global method once.
  +        for (int i = 0; i < globalMethods.length; i++) {
  +          emitTryCatchFinally(() {
  +            emitCall(1, "$methodName${i}", globalMethods[i],
  +                includeSemicolon: true);
  +          }, () {
  +            emitPrint('$methodName$i throws');
  +          });
  +        }
  +
  +        // Call each class method once.
  +        for (int i = 0; i < classMethods.length; i++) {
  +          for (int j = 0; j < classMethods[i].length; j++) {
               emitTryCatchFinally(() {
  -              emitCall(1, "X${i}().$methodName${parentClass}_${j}",
  -                  classMethods[parentClass][j]);
  +              emitCall(1, "X${i}().$methodName${i}_${j}", classMethods[i][j],
  +                  includeSemicolon: true);
               }, () {
  -              emitLn(
  -                  "print('X${i}().$methodName${parentClass}_${j}() throws');");
  +              emitPrint('X${i}().$methodName${i}_${j}() throws');
               });
             }
  +          // Call each virtual class method once.
  +          int parentClass = classParents[i];
  +          while (parentClass >= 0) {
  +            if (virtualClassMethods[i].containsKey(parentClass)) {
  +              for (int j = 0;
  +                  j < virtualClassMethods[i][parentClass].length;
  +                  j++) {
  +                emitTryCatchFinally(
  +                    () => emitCall(1, "X${i}().$methodName${parentClass}_${j}",
  +                        classMethods[parentClass][j], includeSemicolon: true),
  +                    () => emitPrint(
  +                        'X${i}().$methodName${parentClass}_${j}() throws'));
  +              }
  +            }
  +            parentClass = classParents[parentClass];
  +          }
           }
  -        parentClass = classParents[parentClass];
  -      }
  -    }
  -
  -    emitTryCatchFinally(() {
  -      emit('X${classFields.length - 1}().run()');
  -    }, () {
  -      emitLn("print('X${classFields.length - 1}().run() throws');");
  -    });
  -
  -    emitTryCatchFinally(() {
  -      emit("print('", newline: false);
  -      for (int i = 0; i < globalVars.length; i++) {
  -        emit('\$$varName$i\\n');
  -      }
  -      emit("')");
  -    }, () {
  -      emitLn("print('print throws');");
  -    });
  -
  -    indent -= 2;
  -    emitLn('}');
  -  }
  +
  +        emitTryCatchFinally(() {
  +          emit('X${classFields.length - 1}().run();');
  +        }, () {
  +          emitPrint('X${classFields.length - 1}().run() throws');
  +        });
  +
  +        emitTryCatchFinally(() {
  +          String body = '';
  +          for (int i = 0; i < globalVars.length; i++) {
  +            body += '\$$varName$i\\n';
  +          }
  +          emitPrint('$body');
  +        }, () => emitPrint('print throws'));
  +      });
   
     //
     // Declarations.
  
positive.code: 
    String emitVar(int depth, DartType tp,
        {bool isLhs = false, RhsFilter rhsFilter}) {
      switch (rand.nextInt(2)) {
        case 0:
          return emitScalarVar(tp, isLhs: isLhs, rhsFilter: rhsFilter);
          break;
  
negative.code: 
    // Emit a constructor for a type, this can either be a trivial constructor
    // (i.e. parsed from a literal) or an actual function invocation.
    void emitConstructorOrLiteral(int depth, DartType tp,
        {RhsFilter rhsFilter, bool includeSemicolon = false}) {
      // If there is at least one non trivial constructor for the type tp
      // select one of these constructors.
      if (dartType.hasConstructor(tp)) {
  