本文整理了Java中com.oracle.truffle.api.nodes.Node.accept()
方法的一些代码示例,展示了Node.accept()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.accept()
方法的具体详情如下:
包路径:com.oracle.truffle.api.nodes.Node
类名称:Node
方法名:accept
[英]Invokes the NodeVisitor#visit(Node) method for this node and recursively also for all child nodes.
[中]为此节点以及所有子节点递归调用NodeVisitor#visit(Node)方法。
代码示例来源:origin: org.graalvm.truffle/truffle-api
private static Node findFirstNode(Node contextNode, Set<Class<? extends Tag>> tags) {
Node[] first = new Node[]{null};
contextNode.accept(new NodeVisitor() {
@Override
public boolean visit(Node node) {
if (isTaggedWith(node, tags)) {
first[0] = node;
return false;
}
return true;
}
});
return first[0];
}
代码示例来源:origin: com.oracle/truffle
public void probeAST(Node node) {
node.accept(this);
}
}
代码示例来源:origin: com.oracle.truffle/truffle-api
private static Node findFirstNode(Node contextNode, Set<Class<? extends Tag>> tags) {
Node[] first = new Node[]{null};
contextNode.accept(new NodeVisitor() {
@Override
public boolean visit(Node node) {
if (isTaggedWith(node, tags)) {
first[0] = node;
return false;
}
return true;
}
});
return first[0];
}
代码示例来源:origin: com.oracle/truffle
public static <T> List<T> findAllNodeInstances(final Node root, final Class<T> clazz) {
final List<T> nodeList = new ArrayList<>();
root.accept(new NodeVisitor() {
public boolean visit(Node node) {
if (clazz.isInstance(node)) {
nodeList.add(clazz.cast(node));
}
return true;
}
});
return nodeList;
}
代码示例来源:origin: com.oracle.truffle/truffle-api
/** @since 0.8 or earlier */
public static <T> List<T> findAllNodeInstances(final Node root, final Class<T> clazz) {
final List<T> nodeList = new ArrayList<>();
root.accept(new NodeVisitor() {
public boolean visit(Node node) {
if (clazz.isInstance(node)) {
nodeList.add(clazz.cast(node));
}
return true;
}
});
return nodeList;
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
/** @since 0.8 or earlier */
public static <T> List<T> findAllNodeInstances(final Node root, final Class<T> clazz) {
final List<T> nodeList = new ArrayList<>();
root.accept(new NodeVisitor() {
public boolean visit(Node node) {
if (clazz.isInstance(node)) {
nodeList.add(clazz.cast(node));
}
return true;
}
});
return nodeList;
}
代码示例来源:origin: com.oracle/truffle
/**
* Like {@link #findAllNodeInstances(Node, Class)} but do not visit children of found nodes.
*/
public static <T> List<T> findNodeInstancesShallow(final Node root, final Class<T> clazz) {
final List<T> nodeList = new ArrayList<>();
root.accept(new NodeVisitor() {
public boolean visit(Node node) {
if (clazz.isInstance(node)) {
nodeList.add(clazz.cast(node));
return false;
}
return true;
}
});
return nodeList;
}
代码示例来源:origin: com.oracle.truffle/truffle-api
/** @since 0.8 or earlier */
public static int countNodes(Node root, NodeCountFilter filter) {
NodeCounter counter = new NodeCounter(filter);
root.accept(counter);
return counter.count;
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
/** @since 0.8 or earlier */
public static int countNodes(Node root, NodeCountFilter filter) {
NodeCounter counter = new NodeCounter(filter);
root.accept(counter);
return counter.count;
}
代码示例来源:origin: com.oracle/truffle
/**
* Walks an AST, looking for the first node with an assigned {@link SourceSection} and returning
* the {@link Source}.
*/
private static Source findSource(Node node) {
final FindSourceVisitor visitor = new FindSourceVisitor();
node.accept(visitor);
return visitor.source;
}
代码示例来源:origin: com.oracle/truffle
public static int countNodes(Node root, NodeCountFilter filter) {
NodeCounter counter = new NodeCounter(filter);
root.accept(counter);
return counter.count;
}
代码示例来源:origin: org.graalvm.compiler/compiler
public static int calculateNonTrivialNodes(Node node) {
NonTrivialNodeCountVisitor visitor = new NonTrivialNodeCountVisitor();
node.accept(visitor);
return visitor.nodeCount;
}
内容来源于网络,如有侵权,请联系作者删除!