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

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

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

Compiler.runCustomPasses介绍

[英]Runs custom passes that are designated to run at a particular time.
[中]运行指定在特定时间运行的自定义过程。

代码示例

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

void check() {
 runCustomPasses(CustomPassExecutionTime.BEFORE_CHECKS);
 // We are currently only interested in check-passes for progress reporting
 // as it is used for IDEs, that's why the maximum progress is set to 1.0.
 phaseOptimizer = createPhaseOptimizer().withProgress(
   new PhaseOptimizer.ProgressRange(getProgress(), 1.0));
 phaseOptimizer.consume(getPassConfig().getChecks());
 phaseOptimizer.process(externsRoot, jsRoot);
 if (hasErrors()) {
  return;
 }
 runCustomPasses(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS);
 phaseOptimizer = null;
}

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

public void whitespaceOnlyPasses() {
 runCustomPasses(CustomPassExecutionTime.BEFORE_CHECKS);
 Tracer t = newTracer("runWhitespaceOnlyPasses");
 try {
  for (PassFactory pf : getPassConfig().getWhitespaceOnlyPasses()) {
   pf.create(this).process(externsRoot, jsRoot);
  }
 } finally {
  stopTracer(t, "runWhitespaceOnlyPasses");
 }
}

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

public void check() {
 runCustomPasses(CustomPassExecutionTime.BEFORE_CHECKS);
 // We are currently only interested in check-passes for progress reporting
 // as it is used for IDEs, that's why the maximum progress is set to 1.0.
 phaseOptimizer = new PhaseOptimizer(this, tracker,
   new PhaseOptimizer.ProgressRange(getProgress(), 1.0));
 if (options.devMode == DevMode.EVERY_PASS) {
  phaseOptimizer.setSanityCheck(sanityCheck);
 }
 if (options.getCheckDeterminism()) {
  phaseOptimizer.setPrintAstHashcodes(true);
 }
 phaseOptimizer.consume(getPassConfig().getChecks());
 phaseOptimizer.process(externsRoot, jsRoot);
 if (hasErrors()) {
  return;
 }
 if (options.getTweakProcessing().shouldStrip() ||
   !options.stripTypes.isEmpty() ||
   !options.stripNameSuffixes.isEmpty() ||
   !options.stripTypePrefixes.isEmpty() ||
   !options.stripNamePrefixes.isEmpty()) {
  stripCode(options.stripTypes, options.stripNameSuffixes,
    options.stripTypePrefixes, options.stripNamePrefixes);
 }
 runCustomPasses(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS);
 phaseOptimizer = null;
}

相关文章

Compiler类方法