本文整理汇总了Java中com.google.javascript.jscomp.NodeTraversal.AbstractShallowCallback类的典型用法代码示例。如果您正苦于以下问题:Java AbstractShallowCallback类的具体用法?Java AbstractShallowCallback怎么用?Java AbstractShallowCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractShallowCallback类属于com.google.javascript.jscomp.NodeTraversal包,在下文中一共展示了AbstractShallowCallback类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findStorageLocationReferences
import com.google.javascript.jscomp.NodeTraversal.AbstractShallowCallback; //导入依赖的package包/类
/**
* Returns the set of references to storage locations (both variables
* and the heap) under {@code root}.
*/
private Set<Node> findStorageLocationReferences(Node root) {
final Set<Node> references = Sets.newHashSet();
NodeTraversal.traverse(compiler, root, new AbstractShallowCallback() {
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (NodeUtil.isGet(n)
|| (NodeUtil.isName(n) && !NodeUtil.isFunction(parent))) {
references.add(n);
}
}
});
return references;
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:20,代码来源:SideEffectsAnalysis.java
示例2: findStorageLocationReferences
import com.google.javascript.jscomp.NodeTraversal.AbstractShallowCallback; //导入依赖的package包/类
/**
* Returns the set of references to storage locations (both variables
* and the heap) under {@code root}.
*/
private Set<Node> findStorageLocationReferences(Node root) {
final Set<Node> references = Sets.newHashSet();
NodeTraversal.traverse(compiler, root, new AbstractShallowCallback() {
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (NodeUtil.isGet(n)
|| (n.isName() && !parent.isFunction())) {
references.add(n);
}
}
});
return references;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:SideEffectsAnalysis.java
示例3: findStorageLocationReferences
import com.google.javascript.jscomp.NodeTraversal.AbstractShallowCallback; //导入依赖的package包/类
/**
* Returns the set of references to storage locations (both variables
* and the heap) under {@code root}.
*/
private Set<Node> findStorageLocationReferences(Node root) {
final Set<Node> references = new HashSet<>();
NodeTraversal.traverseEs6(compiler, root, new AbstractShallowCallback() {
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (NodeUtil.isGet(n)
|| (n.isName() && !parent.isFunction())) {
references.add(n);
}
}
});
return references;
}
开发者ID:google,项目名称:closure-compiler,代码行数:20,代码来源:SideEffectsAnalysis.java
示例4: checkDefaultParam
import com.google.javascript.jscomp.NodeTraversal.AbstractShallowCallback; //导入依赖的package包/类
private void checkDefaultParam(
Var param, final Scope scope, final Set<String> varsInFunctionBody) {
NodeTraversal.traverseEs6(
compiler,
param.getParentNode().getSecondChild(),
/**
* Do a shallow check since cases like:
* function f(y = () => x, x = 5) { return y(); }
* is legal. We are going to miss cases like:
* function f(y = (() => x)(), x = 5) { return y(); }
* but this should be rare.
*/
new AbstractShallowCallback() {
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (!NodeUtil.isReferenceName(n)) {
return;
}
String refName = n.getString();
if (varsInFunctionBody.contains(refName) && !scope.isDeclared(refName, true)) {
compiler.report(JSError.make(n, EARLY_REFERENCE_ERROR, refName));
}
}
});
}
开发者ID:google,项目名称:closure-compiler,代码行数:26,代码来源:VariableReferenceCheck.java
注:本文中的com.google.javascript.jscomp.NodeTraversal.AbstractShallowCallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论