use of net.vtst.ow.closure.compiler.magic.MagicScopeCreator 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;
}
}
Aggregations