本文整理了Java中com.google.javascript.jscomp.Compiler.report()
方法的一些代码示例,展示了Compiler.report()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Compiler.report()
方法的具体详情如下:
包路径:com.google.javascript.jscomp.Compiler
类名称:Compiler
方法名:report
暂无
代码示例来源:origin: com.google.javascript/closure-compiler
@Override
public void report(CheckLevel ignoredLevel, JSError error) {
report(error);
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
compiler.report(t.makeError(importDecl, NAMESPACE_IMPORT_CANNOT_USE_STAR,
child.getString(), moduleName));
代码示例来源:origin: com.google.javascript/closure-compiler
/**
* Verifies that at least one module has been provided and that the first one
* has at least one source code input.
*/
private void checkFirstModule(List<JSModule> modules) {
if (modules.isEmpty()) {
report(JSError.make(EMPTY_MODULE_LIST_ERROR));
} else if (modules.get(0).getInputs().isEmpty() && modules.size() > 1) {
// The root module may only be empty if there is exactly 1 module.
report(JSError.make(EMPTY_ROOT_MODULE_ERROR,
modules.get(0).getName()));
}
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
URI loadAddress = loader.locateCommonJsModule(requireName, t.getInput());
if (loadAddress == null) {
compiler.report(t.makeError(require, LOAD_ERROR, requireName));
return;
代码示例来源:origin: org.scala-js/closure-compiler-java-6
/**
* Verifies that at least one module has been provided and that the first one
* has at least one source code input.
*/
private void checkFirstModule(List<JSModule> modules) {
if (modules.isEmpty()) {
report(JSError.make(EMPTY_MODULE_LIST_ERROR));
} else if (modules.get(0).getInputs().isEmpty() && modules.size() > 1) {
// The root module may only be empty if there is exactly 1 module.
report(JSError.make(EMPTY_ROOT_MODULE_ERROR,
modules.get(0).getName()));
}
}
代码示例来源:origin: com.google.javascript/closure-compiler
private void renameModules(List<JSModule> newModules, List<JSModule> deserializedModules) {
if (newModules == null) {
return;
}
if (newModules.size() != deserializedModules.size()) {
report(JSError.make(INCONSISTENT_MODULE_DEFINITIONS));
return;
}
for (int i = 0; i < deserializedModules.size(); i++) {
JSModule deserializedModule = deserializedModules.get(i);
JSModule newModule = newModules.get(i);
deserializedModule.setName(newModule.getName());
}
return;
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
/**
* Creates a map to make looking up an input by name fast. Also checks for
* duplicate inputs.
*/
void initInputsByIdMap() {
inputsById = new HashMap<InputId, CompilerInput>();
for (CompilerInput input : externs) {
InputId id = input.getInputId();
CompilerInput previous = putCompilerInput(id, input);
if (previous != null) {
report(JSError.make(DUPLICATE_EXTERN_INPUT, input.getName()));
}
}
for (CompilerInput input : inputs) {
InputId id = input.getInputId();
CompilerInput previous = putCompilerInput(id, input);
if (previous != null) {
report(JSError.make(DUPLICATE_INPUT, input.getName()));
}
}
}
代码示例来源:origin: com.google.javascript/closure-compiler
compiler.report(error);
代码示例来源:origin: com.google.javascript/closure-compiler
/**
* Creates a map to make looking up an input by name fast. Also checks for
* duplicate inputs.
*/
void initInputsByIdMap() {
inputsById.clear();
for (CompilerInput input : externs) {
InputId id = input.getInputId();
CompilerInput previous = putCompilerInput(id, input);
if (previous != null) {
report(JSError.make(DUPLICATE_EXTERN_INPUT, input.getName()));
}
}
for (CompilerInput input : moduleGraph.getAllInputs()) {
InputId id = input.getInputId();
CompilerInput previous = putCompilerInput(id, input);
if (previous != null) {
report(JSError.make(DUPLICATE_INPUT, input.getName()));
}
}
}
代码示例来源: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
report(CheckLevel.ERROR, error);
report(CheckLevel.WARNING, warning);
代码示例来源: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: org.scala-js/closure-compiler-java-6
void orderInputs() {
hoistExterns();
// Check if the sources need to be re-ordered.
boolean staleInputs = false;
if (options.dependencyOptions.needsManagement()) {
for (CompilerInput input : inputs) {
// Forward-declare all the provided types, so that they
// are not flagged even if they are dropped from the process.
for (String provide : input.getProvides()) {
getTypeRegistry().forwardDeclareType(provide);
}
}
try {
inputs =
(moduleGraph == null ? new JSModuleGraph(modules) : moduleGraph)
.manageDependencies(options.dependencyOptions, inputs);
staleInputs = true;
} catch (MissingProvideException e) {
report(JSError.make(
MISSING_ENTRY_ERROR, e.getMessage()));
} catch (JSModuleGraph.MissingModuleException e) {
report(JSError.make(
MISSING_MODULE_ERROR, e.getMessage()));
}
}
hoistNoCompileFiles();
if (staleInputs) {
repartitionInputs();
}
}
代码示例来源:origin: com.google.javascript/closure-compiler
void orderInputs() {
hoistExterns();
// Check if the sources need to be re-ordered.
boolean staleInputs = false;
if (options.getDependencyOptions().needsManagement()) {
for (CompilerInput input : moduleGraph.getAllInputs()) {
// Forward-declare all the provided types, so that they
// are not flagged even if they are dropped from the process.
for (String provide : input.getProvides()) {
forwardDeclareType(provide);
}
}
try {
moduleGraph.manageDependencies(options.getDependencyOptions());
staleInputs = true;
} catch (MissingProvideException e) {
report(JSError.make(
MISSING_ENTRY_ERROR, e.getMessage()));
} catch (JSModuleGraph.MissingModuleException e) {
report(JSError.make(
MISSING_MODULE_ERROR, e.getMessage()));
}
}
// Manage dependencies may move weak sources around, and end up with empty modules.
fillEmptyModules(getModules());
hoistNoCompileFiles();
if (staleInputs) {
repartitionInputs();
}
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
compiler.report(JSError.make(NO_TREE_GENERATED_ERROR));
return 1;
} else {
DiagnosticType error = outputModuleBinaryAndSourceMaps(modules, options);
if (error != null) {
compiler.report(JSError.make(error));
return 1;
代码示例来源:origin: com.google.javascript/closure-compiler
/**
* Initializes the instance state needed for a compile job if the sources
* are in modules.
*/
public <T extends SourceFile> void initModules(
List<T> externs, List<JSModule> modules, CompilerOptions options) {
initOptions(options);
checkFirstModule(modules);
this.externs = makeExternInputs(externs);
// Generate the module graph, and report any errors in the module specification as errors.
try {
this.moduleGraph = new JSModuleGraph(modules);
} catch (JSModuleGraph.ModuleDependenceException e) {
// problems with the module format. Report as an error. The
// message gives all details.
report(JSError.make(MODULE_DEPENDENCY_ERROR,
e.getModule().getName(), e.getDependentModule().getName()));
return;
}
// Creating the module graph can move weak source around, and end up with empty modules.
fillEmptyModules(getModules());
this.commentsPerFile = new ConcurrentHashMap<>(moduleGraph.getInputCount());
initBasedOnOptions();
initInputsByIdMap();
initAST();
}
代码示例来源:origin: org.scala-js/closure-compiler-java-6
report(JSError.make(MODULE_DEPENDENCY_ERROR,
e.getModule().getName(), e.getDependentModule().getName()));
return;
代码示例来源:origin: com.google.javascript/closure-compiler
compiler.report(JSError.make(NO_TREE_GENERATED_ERROR));
return 1;
} else {
DiagnosticType error = outputModuleBinaryAndSourceMaps(compiler.getModules(), options);
if (error != null) {
compiler.report(JSError.make(error));
return 1;
代码示例来源:origin: angular/clutz
System.err.println("Failed while converting " + file.getSourceFileName());
t.printStackTrace(System.err);
compiler.report(
JSError.make(file.getSourceFileName(), -1, -1, GENTS_INTERNAL_ERROR, t.getMessage()));
代码示例来源:origin: org.scala-js/closure-compiler-java-6
String namespace = requireCall.getLastChild().getString();
if (!parent.getParent().isConst()) {
compiler.report(JSError.make(parent.getParent(), LHS_OF_GOOG_REQUIRE_MUST_BE_CONST));
内容来源于网络,如有侵权,请联系作者删除!