Search in sources :

Example 1 with DefaultPassConfig

use of com.google.javascript.jscomp.DefaultPassConfig in project ow by vtst.

the class CompilerRun method compile.

/**
   * Run the initial compilation.
   */
private void compile(ErrorManager errorManager) {
    // Set-up the compiler
    compiler = CompilerUtils.makeCompiler(errorManager);
    compiler.initOptions(options);
    passes = new DefaultPassConfig(options);
    CompilerUtils.addCustomCompilerPass(options, new NamespaceProvidersPass(compiler, namespaceToScriptNode), CustomPassExecutionTime.BEFORE_CHECKS);
    compiler.setPassConfig(passes);
    // Store the modification info
    lastModifiedMapForFullCompile = buildLastModifiedMap(sortedUnits);
    lastModifiedMapForFastCompile = Maps.newHashMap(lastModifiedMapForFullCompile);
    // Run compilation
    JSModule module = buildJSModule();
    // For avoiding the magic, we could do:
    // compiler.compileModules(
    //   Collections.<SourceFile> emptyList(), Lists.newArrayList(DefaultExternsProvider.getAsModule(), module), options);
    // but this would be less efficient.
    MagicCompiler.compile(compiler, getExternsAsCompilerInputs(), module, options);
    // Set-up post-compilation state
    if (keepCompilationResultsInMemory) {
        scopeCreator = new MagicScopeCreator(compiler);
    } else {
        compiler = null;
        passes = null;
        options = null;
    }
}
Also used : MagicScopeCreator(net.vtst.ow.closure.compiler.magic.MagicScopeCreator) JSModule(com.google.javascript.jscomp.JSModule) DefaultPassConfig(com.google.javascript.jscomp.DefaultPassConfig)

Aggregations

DefaultPassConfig (com.google.javascript.jscomp.DefaultPassConfig)1 JSModule (com.google.javascript.jscomp.JSModule)1 MagicScopeCreator (net.vtst.ow.closure.compiler.magic.MagicScopeCreator)1