anchor.diff:                _resolvedUnitResult =
                     await context.currentSession.getResolvedUnit(filePath);
   
  -              var error = getFirstErrorOrNull(resolvedUnitResult);
  -              if (error != null) {
  +              var analysisError = getFirstErrorOrNull(_resolvedUnitResult);
  +              if (analysisError != null) {
                   print('File $filePath skipped due to errors such as:');
  -                print('  ${error.toString()}');
  +                print('  ${analysisError.toString()}');
                   print('');
  +                resultCode = 1;
                   continue;
                 }
   
                 // Use the ExpectedCompletionsVisitor to compute the set of expected
                 // completions for this CompilationUnit.
                 final visitor = ExpectedCompletionsVisitor();
  -              resolvedUnitResult.unit.accept(visitor);
  +              _resolvedUnitResult.unit.accept(visitor);
   
                 for (var expectedCompletion in visitor.expectedCompletions) {
  -                // Call forEachExpectedCompletion, passing in the computed
  -                // suggestions only if doComputeCompletionsFromAnalysisServer is
  -                // true:
                   forEachExpectedCompletion(
                       expectedCompletion,
                       doComputeCompletionsFromAnalysisServer
                           ? await _computeCompletionSuggestions(
  -                            resolvedUnitResult,
  +                            _resolvedUnitResult,
                               expectedCompletion.offset,
                               declarationsTracker)
                           : null);
  
positive.code:   }
    var corpus = args[0] == '--corpus';
    var rootPath = corpus ? args[1] : args[0];
    await CompletionCoverageMetrics(rootPath).compute(corpus: corpus);
    io.exit(0);
  }
  
  /// This is the main metrics computer class for code completions. After the
  /// object is constructed, [computeCompletionMetrics] is executed to do analysis
  /// and print a summary of the metrics gathered from the completion tests.
  abstract class AbstractCompletionMetricsComputer {
    // TODO(brianwilkerson) Consider merging this class into the single concrete
    //  subclass.
    final String _rootPath;
  
    String _currentFilePath;
  
    ResolvedUnitResult _resolvedUnitResult;
  
    AbstractCompletionMetricsComputer(this._rootPath);
  
    /// The path to the current file.
    String get currentFilePath => _currentFilePath;
  
negative.code:             } catch (e) {
                print('Exception caught analyzing: $filePath');
                print(e.toString());
                resultCode = 1;
              }
            }
          }
        }
      }
      printAndClearComputers();
      return resultCode;
    }
  
    void forEachExpectedCompletion(ExpectedCompletion expectedCompletion,
        List<CompletionSuggestion> suggestions) {
      assert(suggestions != null);
  
      var place = placementInSuggestionList(suggestions, expectedCompletion);
  
      mRRComputer.addRank(place.rank);
  
      if (place.denominator != 0) {
        includedCount++;
      } else {
        notIncludedCount++;
  
        completionMissedTokenCounter.count(expectedCompletion.completion);
        completionKindCounter.count(expectedCompletion.kind.toString());
        completionElementKindCounter
            .count(expectedCompletion.elementKind.toString());
  
        // The format "/file/path/foo.dart:3:4" makes for easier input
        // with the Files dialog in IntelliJ
        print(
            '$currentFilePath:${expectedCompletion.lineNumber}:${expectedCompletion.columnNumber}');
        print(
            '\tdid not include the expected completion: \"${expectedCompletion.completion}\", completion kind: ${expectedCompletion.kind.toString()}, element kind: ${expectedCompletion.elementKind.toString()}');
        print('');
      }
    }
  
    void printAndClearComputers() {
      final totalCompletionCount = includedCount + notIncludedCount;
      final percentIncluded = includedCount / totalCompletionCount;
      final percentNotIncluded = 1 - percentIncluded;
  
      completionMissedTokenCounter.printCounterValues();
      print('');
  
      completionKindCounter.printCounterValues();
      print('');
  
      completionElementKindCounter.printCounterValues();
      print('');
  
      mRRComputer.printMean();
      print('');
  
      print('Summary for $_rootPath:');
      print('Total number of completion tests   = $totalCompletionCount');
      print(
          'Number of successful completions   = $includedCount (${printPercentage(percentIncluded)})');
      print(
          'Number of unsuccessful completions = $notIncludedCount (${printPercentage(percentNotIncluded)})');
  
      includedCount = 0;
      notIncludedCount = 0;
      completionMissedTokenCounter.clear();
      completionKindCounter.clear();
      completionElementKindCounter.clear();
      mRRComputer.clear();
    }
  
    Future<List<CompletionSuggestion>> _computeCompletionSuggestions(
        ResolvedUnitResult resolvedUnitResult, int offset,
  