com.google.javascript.jscomp.Compiler.getErrors()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 JavaScript  
字(3.7k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中com.google.javascript.jscomp.Compiler.getErrors()方法的一些代码示例,展示了Compiler.getErrors()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Compiler.getErrors()方法的具体详情如下:
包路径:com.google.javascript.jscomp.Compiler
类名称:Compiler
方法名:getErrors

Compiler.getErrors介绍

[英]Returns the array of errors (never null).
[中]返回错误数组(从不为null)。

代码示例

代码示例来源:origin: org.scala-js/closure-compiler-java-6

/**
 * Returns the result of the compilation.
 */
public Result getResult() {
 PassConfig.State state = getPassConfig().getIntermediateState();
 return new Result(getErrors(), getWarnings(), debugLog.toString(),
   state.variableMap, state.propertyMap,
   state.anonymousFunctionNameMap, state.stringMap, functionInformationMap,
   sourceMap, externExports, state.cssNames, state.idGeneratorMap);
}

代码示例来源:origin: com.google.javascript/closure-compiler

/**
 * Returns the result of the compilation.
 */
public Result getResult() {
 Set<SourceFile> transpiledFiles = new HashSet<>();
 if (jsRoot != null) {
  for (Node scriptNode : jsRoot.children()) {
   if (scriptNode.getBooleanProp(Node.TRANSPILED)) {
    transpiledFiles.add(getSourceFileByName(scriptNode.getSourceFileName()));
   }
  }
 }
 return new Result(getErrors(), getWarnings(),
   this.variableMap, this.propertyMap,
   this.anonymousFunctionNameMap, this.stringMap, this.functionInformationMap,
   this.sourceMap, this.externExports, this.cssNames, this.idGeneratorMap, transpiledFiles);
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

if (compiler.getErrors().length == 0) {
 extractCompilerPass.process(null, compiler.getRoot());
JSError[] errors = compiler.getErrors();

代码示例来源:origin: com.google.javascript/closure-compiler

if (compiler.getErrors().length == 0) {
 extractCompilerPass.process(null, compiler.getRoot());
JSError[] errors = compiler.getErrors();

代码示例来源: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: 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.samaxes.maven/minify-maven-plugin

JSError[] errors = compiler.getErrors();
if (errors.length > 0) {
  StringBuilder msg = new StringBuilder("JSCompiler errors\n");

代码示例来源:origin: samaxes/minify-maven-plugin

JSError[] errors = compiler.getErrors();
if (errors.length > 0) {
  StringBuilder msg = new StringBuilder("JSCompiler errors\n");

代码示例来源:origin: prezi/spaghetti

JSError[] errors = compiler.getErrors();
if (errors.length > 0) {
  for (JSError e : errors) {

代码示例来源:origin: org.scala-js/closure-compiler-java-6

if (fix) {
 List<SuggestedFix> fixes = new ArrayList<SuggestedFix>();
 for (JSError warning : concat(compiler.getErrors(), compiler.getWarnings(), JSError.class)) {
  SuggestedFix suggestedFix = ErrorToFixMapper.getFixForJsError(warning, compiler);
  if (suggestedFix != null) {

相关文章

微信公众号

Compiler类方法