本文整理了Java中com.google.javascript.jscomp.Compiler.getResult()
方法的一些代码示例,展示了Compiler.getResult()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Compiler.getResult()
方法的具体详情如下:
包路径:com.google.javascript.jscomp.Compiler
类名称:Compiler
方法名:getResult
[英]Returns the result of the compilation.
[中]返回编译的结果。
代码示例来源:origin: org.scala-js/closure-compiler-java-6
@Override
public Result call() throws Exception {
compileInternal();
return getResult();
}
});
代码示例来源:origin: com.google.javascript/closure-compiler
@GwtIncompatible("Unnecessary")
private Result restoreAndPerformStage2(String filename) {
Result result;
try (BufferedInputStream serializedInputStream =
new BufferedInputStream(new FileInputStream(filename))) {
compiler.restoreState(serializedInputStream);
if (!compiler.hasErrors()) {
compiler.stage2Passes();
}
compiler.performPostCompilationTasks();
} catch (IOException | ClassNotFoundException e) {
compiler.report(JSError.make(COULD_NOT_DESERIALIZE_AST, filename));
} finally {
// Make sure we generate a report of errors and warnings even if the compiler throws an
// exception somewhere.
compiler.generateReport();
}
result = compiler.getResult();
return result;
}
代码示例来源:origin: com.google.javascript/closure-compiler
@GwtIncompatible("Unnecessary")
private Result instrumentForCoverage() {
Result result;
try {
compiler.parseForCompilation();
if (!compiler.hasErrors()) {
compiler.instrumentForCoverage();
}
} finally {
compiler.generateReport();
}
result = compiler.getResult();
return result;
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
private Compiler mockRealJsCompiler(JSError error, Result res, String toSource) {
Compiler result = createMock(Compiler.class);
expect(result.compile(EasyMock.<List<JSSourceFile>>anyObject(),
EasyMock.<List<JSSourceFile>>anyObject(),
isA(CompilerOptions.class))).andReturn(res);
if (error != null) {
expect(result.hasErrors()).andReturn(true);
expect(result.getErrors()).andReturn(new JSError[] { error });
} else {
expect(result.hasErrors()).andReturn(false);
}
expect(result.getResult()).andReturn(res);
expect(result.toSource()).andReturn(toSource);
replay(result);
return result;
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
/**
* Compiles a list of inputs.
*/
public <T1 extends SourceFile, T2 extends SourceFile> Result compile(
List<T1> externs, List<T2> inputs, CompilerOptions options) {
// The compile method should only be called once.
Preconditions.checkState(jsRoot == null);
try {
init(externs, inputs, options);
if (hasErrors()) {
return getResult();
}
return compile();
} finally {
Tracer t = newTracer("generateReport");
errorManager.generateReport();
stopTracer(t, "generateReport");
}
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
/**
* Compiles a list of modules.
*/
public <T extends SourceFile> Result compileModules(List<T> externs,
List<JSModule> modules, CompilerOptions options) {
// The compile method should only be called once.
Preconditions.checkState(jsRoot == null);
try {
initModules(externs, modules, options);
if (hasErrors()) {
return getResult();
}
return compile();
} finally {
Tracer t = newTracer("generateReport");
errorManager.generateReport();
stopTracer(t, "generateReport");
}
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets
private Compiler mockRealJsCompiler(JSError error, Result res, String toSource) {
Compiler result = createMock(Compiler.class);
expect(result.compile(EasyMock.<List<JSSourceFile>>anyObject(),
EasyMock.<List<JSSourceFile>>anyObject(),
isA(CompilerOptions.class))).andReturn(res);
if (error != null) {
expect(result.hasErrors()).andReturn(true);
expect(result.getErrors()).andReturn(new JSError[] { error });
} else {
expect(result.hasErrors()).andReturn(false);
}
expect(result.getResult()).andReturn(res);
expect(result.toSource()).andReturn(toSource);
replay(result);
return result;
}
代码示例来源:origin: com.google.javascript/closure-compiler
@GwtIncompatible("Unnecessary")
private Result performStage1andSave(String filename) {
Result result;
try (BufferedOutputStream serializedOutputStream =
new BufferedOutputStream(new FileOutputStream(filename))) {
compiler.parseForCompilation();
if (!compiler.hasErrors()) {
compiler.stage1Passes();
}
if (!compiler.hasErrors()) {
compiler.saveState(serializedOutputStream);
}
compiler.performPostCompilationTasks();
} catch (IOException e) {
compiler.report(JSError.make(COULD_NOT_SERIALIZE_AST, filename));
} finally {
// Make sure we generate a report of errors and warnings even if the compiler throws an
// exception somewhere.
compiler.generateReport();
}
result = compiler.getResult();
return result;
}
代码示例来源:origin: com.google.javascript/closure-compiler
result = compiler.getResult();
} else if (options.getInstrumentForCoverageOnly()) {
result = instrumentForCoverage();
代码示例来源:origin: com.google.javascript/closure-compiler
@GwtIncompatible("Unnecessary")
private Result performFullCompilation() {
Result result;
try {
compiler.parseForCompilation();
if (!compiler.hasErrors()) {
compiler.stage1Passes();
if (!compiler.hasErrors()) {
compiler.stage2Passes();
}
compiler.performPostCompilationTasks();
}
} finally {
// Make sure we generate a report of errors and warnings even if the compiler throws an
// exception somewhere.
compiler.generateReport();
}
result = compiler.getResult();
return result;
}
代码示例来源:origin: com.google.javascript/closure-compiler
generateReport();
return getResult();
代码示例来源:origin: com.google.javascript/closure-compiler
generateReport();
return getResult();
内容来源于网络,如有侵权,请联系作者删除!