本文整理了Java中com.google.javascript.jscomp.Compiler.addNewSourceAst()
方法的一些代码示例,展示了Compiler.addNewSourceAst()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Compiler.addNewSourceAst()
方法的具体详情如下:
包路径:com.google.javascript.jscomp.Compiler
类名称:Compiler
方法名:addNewSourceAst
[英]Add a new source input dynamically. Intended for incremental compilation.
If the new source input doesn't parse, it will not be added, and a false will be returned.
[中]动态添加新的源输入。用于增量编译。
如果新的源输入没有解析,它将不会被添加,并且将返回false。
代码示例来源:origin: com.google.javascript/closure-compiler
/**
* Adds a new Script AST to the compile state. If a script for the same file
* already exists the script will not be added, instead a call to
* #replaceScript should be used.
*
* @param ast the ast of the new file
*/
public void addNewScript(JsAst ast) {
if (!addNewSourceAst(ast)) {
return;
}
Node emptyScript = new Node(Token.SCRIPT);
InputId inputId = ast.getInputId();
emptyScript.setInputId(inputId);
emptyScript.setStaticSourceFile(
SourceFile.fromCode(inputId.getIdName(), ""));
processNewScript(ast, emptyScript);
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
/**
* Adds a new Script AST to the compile state. If a script for the same file
* already exists the script will not be added, instead a call to
* #replaceScript should be used.
*
* @param ast the ast of the new file
*/
public void addNewScript(JsAst ast) {
if (!addNewSourceAst(ast)) {
return;
}
Node emptyScript = new Node(Token.SCRIPT);
InputId inputId = ast.getInputId();
emptyScript.setInputId(inputId);
emptyScript.setStaticSourceFile(
SourceFile.fromCode(inputId.getIdName(), ""));
processNewScript(ast, emptyScript);
}
内容来源于网络,如有侵权,请联系作者删除!