当前位置: 首页>>代码示例>>Java>>正文


Java Callback类代码示例

本文整理汇总了Java中com.google.javascript.jscomp.NodeTraversal.Callback的典型用法代码示例。如果您正苦于以下问题:Java Callback类的具体用法?Java Callback怎么用?Java Callback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Callback类属于com.google.javascript.jscomp.NodeTraversal包,在下文中一共展示了Callback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
@Override
protected CompilerPass create(AbstractCompiler compiler) {
  return new CombinedCompilerPass(
      compiler,
      ImmutableList.<Callback>of(
          new CheckDuplicateCase(compiler),
          new CheckEmptyStatements(compiler),
          new CheckEnums(compiler),
          new CheckJSDocStyle(compiler),
          new CheckJSDoc(compiler),
          new CheckMissingSemicolon(compiler),
          new CheckMissingSuper(compiler),
          new CheckPrimitiveAsObject(compiler),
          new CheckRequiresAndProvidesSorted(compiler),
          new CheckMissingAndExtraRequires(
              compiler, CheckMissingAndExtraRequires.Mode.SINGLE_FILE),
          new CheckUnusedLabels(compiler),
          new CheckUselessBlocks(compiler),
          new ClosureCheckModule(compiler),
          new Es6SuperCheck(compiler),
          new CheckSetTestOnly(state, compiler),
          new CheckStrictDeps.FirstPass(state, compiler)));
}
 
开发者ID:bazelbuild,项目名称:rules_closure,代码行数:24,代码来源:JsCheckerPassConfig.java

示例2: create

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
@Override
protected HotSwapCompilerPass create(final AbstractCompiler compiler) {
  List<Callback> sharedCallbacks = Lists.newArrayList();
  if (options.checkSuspiciousCode) {
    sharedCallbacks.add(new CheckSuspiciousCode());
  }

  if (options.enables(DiagnosticGroups.GLOBAL_THIS)) {
    sharedCallbacks.add(new CheckGlobalThis(compiler));
  }

  if (options.enables(DiagnosticGroups.DEBUGGER_STATEMENT_PRESENT)) {
    sharedCallbacks.add(new CheckDebuggerStatement(compiler));
  }

  return combineChecks(compiler, sharedCallbacks);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:18,代码来源:DefaultPassConfig.java

示例3: processTranspile

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
/**
 * Process transpilations if the input language needs transpilation from certain features, on any
 * JS file that has ES6 features.
 *
 * @param compiler An AbstractCompiler
 * @param combinedRoot The combined root for all JS files.
 * @param featureSet The features which this pass helps transpile.
 * @param callbacks The callbacks that should be invoked if a file has ES6 features.
 */
static void processTranspile(
    AbstractCompiler compiler, Node combinedRoot, FeatureSet featureSet, Callback... callbacks) {
  if (compiler.getOptions().needsTranspilationFrom(featureSet)) {
    for (Node singleRoot : combinedRoot.children()) {
      // TODO(lharker): Only run callbacks if the script has features from the given featureSet,
      // instead of whenever the script has any ES6+ features. We can't do this until ensuring
      // that all passes correctly update the script's associated FeatureSet.
      // The same applies in hotSwapTranspile, hotSwapCheck, and processCheck.
      if (isScriptEs6OrHigher(singleRoot)) {
        for (Callback callback : callbacks) {
          singleRoot.putBooleanProp(Node.TRANSPILED, true);
          NodeTraversal.traverseEs6(compiler, singleRoot, callback);
        }
      }
    }
  }
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:27,代码来源:TranspilationPasses.java

示例4: create

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
@Override
protected HotSwapCompilerPass create(final AbstractCompiler compiler) {
  List<Callback> sharedCallbacks = new ArrayList<>();
  if (options.checkSuspiciousCode) {
    sharedCallbacks.add(new CheckSuspiciousCode());
    sharedCallbacks.add(new CheckDuplicateCase(compiler));
  }

  if (options.enables(DiagnosticGroups.GLOBAL_THIS)) {
    sharedCallbacks.add(new CheckGlobalThis(compiler));
  }

  if (options.enables(DiagnosticGroups.DEBUGGER_STATEMENT_PRESENT)) {
    sharedCallbacks.add(new CheckDebuggerStatement(compiler));
  }

  return combineChecks(compiler, sharedCallbacks);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:19,代码来源:DefaultPassConfig.java

示例5: create

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
@Override
protected CompilerPass create(AbstractCompiler compiler) {
  return new CombinedCompilerPass(
      compiler,
      ImmutableList.<Callback>of(
          new CheckDuplicateCase(compiler),
          new CheckEmptyStatements(compiler),
          new CheckEnums(compiler),
          new CheckJSDocStyle(compiler),
          new CheckJSDoc(compiler),
          new CheckMissingSemicolon(compiler),
          new CheckMissingSuper(compiler),
          new CheckPrimitiveAsObject(compiler),
          new ClosureCheckModule(compiler),
          new CheckRequiresAndProvidesSorted(compiler),
          new CheckSideEffects(
              compiler, /* report */ true, /* protectSideEffectFreeCode */ false),
          new CheckUnusedLabels(compiler),
          new CheckUselessBlocks(compiler),
          new Es6SuperCheck(compiler)));
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:22,代码来源:LintPassConfig.java

示例6: CombinedCompilerPass

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
/**
 * Creates a combined compiler pass.
 * @param compiler the compiler
 */
CombinedCompilerPass(
    AbstractCompiler compiler, Callback... callbacks) {
  this.compiler = compiler;
  this.callbacks = new CallbackWrapper[callbacks.length];
  for (int i = 0; i < callbacks.length; i++) {
    this.callbacks[i] = new CallbackWrapper(callbacks[i]);
  }
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:13,代码来源:CombinedCompilerPass.java

示例7: CallbackWrapper

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
private CallbackWrapper(Callback callback) {
  this.callback = callback;
  if (callback instanceof ScopedCallback) {
    scopedCallback = (ScopedCallback) callback;
  } else {
    scopedCallback = null;
  }
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:9,代码来源:CombinedCompilerPass.java

示例8: createInternal

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
@Override
protected CompilerPass createInternal(final AbstractCompiler compiler) {
  List<Callback> sharedCallbacks = Lists.newArrayList();
  sharedCallbacks.add(new CheckAccidentalSemicolon(CheckLevel.WARNING));
  sharedCallbacks.add(new CheckSideEffects(CheckLevel.WARNING));
  if (options.checkGlobalThisLevel.isOn()) {
    sharedCallbacks.add(
        new CheckGlobalThis(compiler, options.checkGlobalThisLevel));
  }
  return combineChecks(compiler, sharedCallbacks);
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:12,代码来源:DefaultPassConfig.java

示例9: combineChecks

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
/** Executes the given callbacks with a {@link CombinedCompilerPass}. */
private static CompilerPass combineChecks(AbstractCompiler compiler,
    List<Callback> callbacks) {
  Preconditions.checkArgument(callbacks.size() > 0);
  Callback[] array = callbacks.toArray(new Callback[callbacks.size()]);
  return new CombinedCompilerPass(compiler, array);
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:8,代码来源:DefaultPassConfig.java

示例10: removeDuplicateDeclarations

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
/**
 * Remove duplicate VAR declarations.
 */
private void removeDuplicateDeclarations(Node root) {
  Callback tickler = new ScopeTicklingCallback();
  ScopeCreator scopeCreator =  new SyntacticScopeCreator(
      compiler, new DuplicateDeclarationHandler());
  NodeTraversal t = new NodeTraversal(compiler, tickler, scopeCreator);
  t.traverse(root);
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:11,代码来源:Normalize.java

示例11: CombinedCompilerPass

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
CombinedCompilerPass(
    AbstractCompiler compiler, List<Callback> callbacks) {
  this.compiler = compiler;
  this.callbacks = new CallbackWrapper[callbacks.size()];
  for (int i = 0; i < callbacks.size(); i++) {
    this.callbacks[i] = new CallbackWrapper(callbacks.get(i));
  }
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:9,代码来源:CombinedCompilerPass.java

示例12: traverse

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
static void traverse(AbstractCompiler compiler, Node root,
    List<Callback> callbacks) {
  if (callbacks.size() == 1) {
    NodeTraversal.traverse(compiler, root, callbacks.get(0));
  } else {
    (new CombinedCompilerPass(compiler, callbacks)).process(null, root);
  }
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:9,代码来源:CombinedCompilerPass.java

示例13: createInternal

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
@Override
protected CompilerPass createInternal(final AbstractCompiler compiler) {
  List<Callback> sharedCallbacks = Lists.newArrayList();
  if (options.checkSuspiciousCode) {
    sharedCallbacks.add(new CheckAccidentalSemicolon(CheckLevel.WARNING));
    sharedCallbacks.add(new CheckSideEffects(CheckLevel.WARNING));
  }

  CheckLevel checkGlobalThisLevel = options.checkGlobalThisLevel;
  if (checkGlobalThisLevel.isOn()) {
    sharedCallbacks.add(
        new CheckGlobalThis(compiler, checkGlobalThisLevel));
  }
  return combineChecks(compiler, sharedCallbacks);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:16,代码来源:DefaultPassConfig.java

示例14: process

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
@Override
public void process(Node externs, Node root) {
  List<Callback> passes = Lists.newArrayList();
  if (removeAbstractMethods) {
    passes.add(new FindAbstractMethods());
  }
  if (removeAssertionCalls) {
    passes.add(new FindAssertionCalls());
  }
  CombinedCompilerPass.traverse(compiler, root, passes);

  for (RemovableAssignment assignment : abstractMethodAssignmentNodes) {
    assignment.remove();
  }

  for (Node call : assertionCalls) {
    // If the assertion is an expression, just strip the whole thing.
    Node parent = call.getParent();
    if (NodeUtil.isExpressionNode(parent)) {
      parent.getParent().removeChild(parent);
    } else {
      // Otherwise, replace the assertion with its first argument,
      // which is the return value of the assertion.
      Node firstArg = call.getFirstChild().getNext();
      if (firstArg == null) {
        parent.replaceChild(call, NodeUtil.newUndefinedNode(call));
      } else {
        parent.replaceChild(call, firstArg.detachFromParent());
      }
    }
    compiler.reportCodeChange();
  }
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:34,代码来源:ClosureCodeRemoval.java

示例15: combineChecks

import com.google.javascript.jscomp.NodeTraversal.Callback; //导入依赖的package包/类
/** Executes the given callbacks with a {@link CombinedCompilerPass}. */
private static HotSwapCompilerPass combineChecks(AbstractCompiler compiler,
    List<Callback> callbacks) {
  Preconditions.checkArgument(callbacks.size() > 0);
  Callback[] array = callbacks.toArray(new Callback[callbacks.size()]);
  return new CombinedCompilerPass(compiler, array);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:DefaultPassConfig.java


注:本文中的com.google.javascript.jscomp.NodeTraversal.Callback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。