本文整理了Java中com.google.javascript.jscomp.Compiler.getRoot()
方法的一些代码示例,展示了Compiler.getRoot()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Compiler.getRoot()
方法的具体详情如下:
包路径:com.google.javascript.jscomp.Compiler
类名称:Compiler
方法名:getRoot
暂无
代码示例来源:origin: org.scala-js/closure-compiler-java-6
private RefactoringDriver(
Scanner scanner,
List<SourceFile> inputs,
List<SourceFile> externs,
CompilerOptions compilerOptions) {
this.scanner = scanner;
this.compiler = createCompiler(inputs, externs, compilerOptions);
this.rootNode = this.compiler.getRoot();
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
new ExtractMessagesVisitor(compiler);
if (compiler.getErrors().length == 0) {
extractCompilerPass.process(null, compiler.getRoot());
代码示例来源:origin: com.google.javascript/closure-compiler
new ExtractMessagesVisitor(compiler);
if (compiler.getErrors().length == 0) {
extractCompilerPass.process(null, compiler.getRoot());
代码示例来源:origin: com.google.javascript/closure-compiler
/**
* Add a new source input dynamically. Intended for incremental compilation.
* <p>
* If the new source input doesn't parse, it will not be added, and a false
* will be returned.
*
* @param ast the JS Source to add.
* @return true if the source was added successfully, false otherwise.
* @throws IllegalStateException if an input for this ast already exists.
*/
boolean addNewSourceAst(JsAst ast) {
CompilerInput oldInput = getInput(ast.getInputId());
if (oldInput != null) {
throw new IllegalStateException(
"Input already exists: " + ast.getInputId().getIdName());
}
Node newRoot = checkNotNull(ast.getAstRoot(this));
getRoot().getLastChild().addChildToBack(newRoot);
CompilerInput newInput = new CompilerInput(ast);
// TODO(tylerg): handle this for multiple modules at some point.
JSModule firstModule = Iterables.getFirst(getModules(), null);
if (firstModule.getName().equals(JSModule.STRONG_MODULE_NAME)) {
firstModule.add(newInput);
}
putCompilerInput(ast.getInputId(), newInput);
return true;
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
/**
* Add a new source input dynamically. Intended for incremental compilation.
* <p>
* If the new source input doesn't parse, it will not be added, and a false
* will be returned.
*
* @param ast the JS Source to add.
* @return true if the source was added successfully, false otherwise.
* @throws IllegalStateException if an input for this ast already exists.
*/
boolean addNewSourceAst(JsAst ast) {
CompilerInput oldInput = getInput(ast.getInputId());
if (oldInput != null) {
throw new IllegalStateException(
"Input already exists: " + ast.getInputId().getIdName());
}
Node newRoot = ast.getAstRoot(this);
if (newRoot == null) {
return false;
}
getRoot().getLastChild().addChildToBack(newRoot);
CompilerInput newInput = new CompilerInput(ast);
// TODO(tylerg): handle this for multiple modules at some point.
if (moduleGraph == null && !modules.isEmpty()) {
// singleton module
modules.get(0).add(newInput);
}
putCompilerInput(ast.getInputId(), newInput);
return true;
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
if (compiler.getRoot() == null) {
return 1;
} else {
if (compiler.getRoot() == null) {
return 1;
} else {
ControlFlowGraph<Node> cfg = compiler.computeCFG();
DotFormatter.appendDot(
compiler.getRoot().getLastChild(), cfg, jsOutput);
jsOutput.append('\n');
closeAppendable(jsOutput);
if (compiler.getRoot() == null) {
compiler.report(JSError.make(NO_TREE_GENERATED_ERROR));
return 1;
} else {
Appendable jsOutput = createDefaultOutput();
compiler.getRoot().appendStringTree(jsOutput);
jsOutput.append("\n");
closeAppendable(jsOutput);
代码示例来源:origin: com.google.javascript/closure-compiler
int processResults(Result result, List<JSModule> modules, B options) throws IOException {
if (config.printPassGraph) {
if (compiler.getRoot() == null) {
return 1;
} else {
if (compiler.getRoot() == null) {
return 1;
} else {
ControlFlowGraph<Node> cfg = compiler.computeCFG();
DotFormatter.appendDot(
compiler.getRoot().getLastChild(), cfg, jsOutput);
jsOutput.append('\n');
closeAppendable(jsOutput);
if (compiler.getRoot() == null) {
compiler.report(JSError.make(NO_TREE_GENERATED_ERROR));
return 1;
} else {
Appendable jsOutput = createDefaultOutput();
compiler.getRoot().appendStringTree(jsOutput);
jsOutput.append("\n");
closeAppendable(jsOutput);
代码示例来源:origin: org.scala-js/closure-compiler-java-6
oldRoot.getParent().replaceChild(oldRoot, newRoot);
} else {
getRoot().getLastChild().addChildToBack(newRoot);
代码示例来源:origin: angular/clutz
Node externRoot = compiler.getRoot().getFirstChild();
Node srcRoot = compiler.getRoot().getLastChild();
代码示例来源:origin: org.scala-js/closure-compiler-java-6
new ReferenceCollectingCallback(
this, ReferenceCollectingCallback.DO_NOTHING_BEHAVIOR);
NodeTraversal.traverse(this, getRoot(), refCollector);
symbolTable.addSymbolsFrom(refCollector);
代码示例来源:origin: com.google.javascript/closure-compiler
ReferenceCollectingCallback.DO_NOTHING_BEHAVIOR,
new Es6SyntacticScopeCreator(this));
refCollector.process(getRoot());
symbolTable.addSymbolsFrom(refCollector);
内容来源于网络,如有侵权,请联系作者删除!