anchor.diff:    void printMetrics() {
       print('');
       print('Node classes by context');
  -    _printContextMap(data.byNodeClass, (className) => className);
  +    _printContextMap(data.byNodeClass);
       print('');
       print('Element kinds by context');
  -    _printContextMap(data.byElementKind, (kind) => kind.name);
  +    _printContextMap(data.byElementKind);
       print('');
       print('Token types by context');
  -    _printContextMap(data.byTokenType, (type) => type.name);
  +    _printContextMap(data.byTokenType);
       print('');
       print('Argument types match');
  -    _printContextMap(data.byTypeMatch, (match) => match.toString());
  +    _printContextMap(data.byTypeMatch);
       print('');
       print('Distance from reference to declaration');
  -    _printContextMap(data.byDistance, (distance) => distance.toString());
  +    _printContextMap(data.byDistance);
     }
   
     /// Print a [contextMap] containing one kind of metric data, using the
     /// [getName] function to print the second-level keys.
  -  void _printContextMap<T>(
  -      Map<String, Map<T, int>> contextMap, String Function(T) getName) {
  +  void _printContextMap(Map<String, Map<String, int>> contextMap) {
       var contexts = contextMap.keys.toList()..sort();
       for (var context in contexts) {
         var kindMap = contextMap[context];
  
positive.code:   /// Record that a token of the given [type] was found in the given [context].
    void recordTokenType(String context, TokenType type) {
      var contextMap = byTokenType.putIfAbsent(context, () => {});
      contextMap[type] = (contextMap[type] ?? 0) + 1;
    }
  
    /// Record whether the given [kind] or type match applied to a given argument
    /// (that is, whether [matches] is `true`).
    void recordTypeMatch(String kind, bool matches) {
      var contextMap = byTypeMatch.putIfAbsent(kind, () => {});
      contextMap[matches] = (contextMap[matches] ?? 0) + 1;
    }
  
    /// Return a JSON encoded string representing the data that was collected.
    String toJson() {
      return json.encode({
        'version': currentVersion,
        'byDistance': _encodeMap(byDistance, (distance) => distance.toString()),
        'byElementKind': _encodeMap(byElementKind, (kind) => kind.name),
        'byNodeClass': _encodeMap(byNodeClass, (className) => className),
        'byTokenType': _encodeMap(byTokenType, (type) => type.name),
        'byTypeMatch': _encodeMap(byTypeMatch, (match) => match.toString()),
      });
    }
  
    /// Add the data in the [source] map to the [target] map.
    void _addToMap<T>(
        Map<String, Map<T, int>> target, Map<String, Map<T, int>> source) {
      for (var outerEntry in source.entries) {
        var innerTarget = target.putIfAbsent(outerEntry.key, () => {});
        for (var innerEntry in outerEntry.value.entries) {
  
negative.code:   await computer.compute(rootPath);
    stopwatch.stop();
    var duration = Duration(milliseconds: stopwatch.elapsedMilliseconds);
    print('  Metrics computed in $duration');
    computer.printMetrics();
    io.exit(0);
  }
  
  /// An object that records the data used to compute the metrics.
  class RelevanceData {
    /// A number identifying the version of this code that produced a given JSON
    /// encoded file. The number should be incremented whenever the shape of the
    /// JSON file is changed.
    static const String currentVersion = '1';
  
    /// A table mapping match distances to counts.
    Map<String, Map<String, int>> byDistance = {};
  
    /// A table mapping element kinds to counts by context.
    Map<String, Map<String, int>> byElementKind = {};
  
    /// A table mapping AST node classes to counts by context.
    Map<String, Map<String, int>> byNodeClass = {};
  
    /// A table mapping token types to counts by context.
    Map<String, Map<String, int>> byTokenType = {};
  
    /// A table mapping match types to counts.
    Map<String, Map<String, int>> byTypeMatch = {};
  
    /// Initialize a newly created set of relevance data to be empty.
    RelevanceData();
  