anchor.diff:  
     // write the content
     resourcesFile.writeAsStringSync(content);
  +}
  +
  +void fail(String message) {
  +  stderr.writeln(message);
  +  exit(1);
  +}
  +
  +/// Fail the script, and print out a message indicating how to regenerate the
  +/// resources file.
  +void failGenerate(String message) {
  +  stderr.writeln('$message.');
  +  stderr.writeln();
  +  stderr.writeln('''
  +To re-generate lib/src/edit/nnbd_migration/resources/resources.g.dart, run:
  +
  +  dart pkg/analysis_server/tool/nnbd_migration/generate_resources.dart
  +''');
  +  exit(1);
   }
   
   String generateResourceFile(Iterable<File> resources) {
  
positive.code:   }
  }
  
  final Directory resourceDir = Directory(path.join('pkg', 'analysis_server',
      'lib', 'src', 'edit', 'nnbd_migration', 'resources'));
  final File resourcesFile = File(path.join('pkg', 'analysis_server', 'lib',
      'src', 'edit', 'nnbd_migration', 'resources', 'resources.g.dart'));
  
  final File dartSources = File(path.join('pkg', 'analysis_server', 'lib', 'src',
      'edit', 'nnbd_migration', 'web', 'migration.dart'));
  final javascriptOutput = File(path.join('pkg', 'analysis_server', 'lib', 'src',
      'edit', 'nnbd_migration', 'resources', 'migration.js'));
  
  final List<String> resourceTypes = [
    '.css',
  
negative.code:   return md5.convert(str.codeUnits).toString();
  }
  
  void verifyResourcesGDartGenerated({
    VerificationFunction failVerification = failGenerate,
  }) {
    print('Verifying that ${path.basename(resourcesFile.path)} is up-to-date...');
  
    // Find the hashes for the last generated version of resources.g.dart.
    Map<String, String> resourceHashes = {};
    // highlight_css md5 is 'fb012626bafd286510d32da815dae448'
    RegExp hashPattern = RegExp(r"// (\S+) md5 is '(\S+)'");
    for (RegExpMatch match
        in hashPattern.allMatches(resourcesFile.readAsStringSync())) {
      resourceHashes[match.group(1)] = match.group(2);
    }
  
    // For all resources (modulo compiled JS ones), verify the hash.
    for (FileSystemEntity entity in resourceDir.listSync()) {
      String name = path.basename(entity.path);
      if (!resourceTypes.contains(path.extension(name))) {
        continue;
      }
  
      if (name == 'migration.js') {
        // skip the compiled js
        continue;
      }
  
      String key = name.replaceAll('.', '_');
      if (!resourceHashes.containsKey(key)) {
        failVerification('No entry on resources.g.dart for $name');
      } else {
        String hash = md5String((entity as File).readAsStringSync());
        if (hash != resourceHashes[key]) {
          failVerification('$name not up to date in resources.g.dart');
        }
      }
    }
  
    // verify the compiled dart code
    StringBuffer sourceCode = StringBuffer();
    for (FileSystemEntity entity in dartSources.parent.listSync()) {
      if (entity.path.endsWith('.dart')) {
        sourceCode.write((entity as File).readAsStringSync());
      }
    }
    String hash = md5String(sourceCode.toString());
    if (hash != resourceHashes['migration_dart']) {
      failVerification('Compiled javascript not up to date in resources.g.dart');
    }
  
    print('Generated resources up to date.');
  }
  
  typedef VerificationFunction = void Function(String);
  