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

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

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

Compiler.hoistExterns介绍

[英]Hoists inputs with the @externs annotation into the externs list.
[中]将带有@externs注释的输入提升到externs列表中。

代码示例

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

hoistExterns();
List<CompilerInput> entryPoints = new ArrayList<>();
Map<String, CompilerInput> inputsByProvide = new HashMap<>();

代码示例来源: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();
 }
}

相关文章

微信公众号

Compiler类方法