Beispiel #1
0
  @VisibleForTesting
  static CompilerOptions createOptions(
      FileSystem fileSystem, TypeRegistry typeRegistry, DossierCompiler compiler) {
    CompilerOptions options = new CompilerOptions();

    options.setCodingConvention(new ClosureCodingConvention());
    CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
    CompilationLevel.ADVANCED_OPTIMIZATIONS.setTypeBasedOptimizationOptions(options);

    // IDE mode must be enabled or all of the jsdoc info will be stripped from the AST.
    options.setIdeMode(true);

    // For easier debugging.
    options.setPrettyPrint(true);

    ProvidedSymbolsCollectionPass providedNamespacesPass =
        new ProvidedSymbolsCollectionPass(compiler, typeRegistry, fileSystem);
    options.addCustomPass(CustomPassExecutionTime.BEFORE_CHECKS, providedNamespacesPass);
    options.addCustomPass(
        CustomPassExecutionTime.BEFORE_OPTIMIZATIONS,
        new DocPass(compiler, typeRegistry, fileSystem));

    return options;
  }
 @Override
 void apply(CompilerOptions options, boolean value) {
   options.setPrettyPrint(value);
 }