本文整理了Java中org.mozilla.javascript.Node.getNext()
方法的一些代码示例,展示了Node.getNext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getNext()
方法的具体详情如下:
包路径:org.mozilla.javascript.Node
类名称:Node
方法名:getNext
暂无
代码示例来源:origin: konsoletyper/teavm
private void handle(AstNode block) {
Node child = block.getFirstChild();
while (child != null) {
Node next = child.getNext();
if (child instanceof ExpressionStatement) {
ExpressionStatement statement = (ExpressionStatement) child;
if (statement.getExpression() instanceof StringLiteral) {
block.removeChild(child);
}
}
child = next;
}
}
}
代码示例来源:origin: konsoletyper/teavm
private void print(Scope node) throws IOException {
writer.append('{').softNewLine().indent();
for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
print((AstNode) child);
writer.softNewLine();
}
writer.outdent().append('}');
}
代码示例来源:origin: konsoletyper/teavm
private void print(Block node) throws IOException {
writer.append('{').softNewLine().indent();
for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
print((AstNode) child);
writer.softNewLine();
}
writer.outdent().append('}');
}
代码示例来源:origin: io.apigee/rhino
/**
* Returns a copy of the child list, with each child cast to an
* {@link AstNode}.
* @throws ClassCastException if any non-{@code AstNode} objects are
* in the child list, e.g. if this method is called after the code
* generator begins the tree transformation.
*/
public List<AstNode> getStatements() {
List<AstNode> stmts = new ArrayList<AstNode>();
Node n = getFirstChild();
while (n != null) {
stmts.add((AstNode)n);
n = n.getNext();
}
return stmts;
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Returns a copy of the child list, with each child cast to an
* {@link AstNode}.
* @throws ClassCastException if any non-{@code AstNode} objects are
* in the child list, e.g. if this method is called after the code
* generator begins the tree transformation.
*/
public List<AstNode> getStatements() {
List<AstNode> stmts = new ArrayList<AstNode>();
Node n = getFirstChild();
while (n != null) {
stmts.add((AstNode)n);
n = n.getNext();
}
return stmts;
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Returns a copy of the child list, with each child cast to an
* {@link AstNode}.
* @throws ClassCastException if any non-{@code AstNode} objects are
* in the child list, e.g. if this method is called after the code
* generator begins the tree transformation.
*/
public List<AstNode> getStatements() {
List<AstNode> stmts = new ArrayList<AstNode>();
Node n = getFirstChild();
while (n != null) {
stmts.add((AstNode)n);
n = n.getNext();
}
return stmts;
}
代码示例来源:origin: geogebra/geogebra
/**
* Returns a copy of the child list, with each child cast to an
* {@link AstNode}.
* @throws ClassCastException if any non-{@code AstNode} objects are
* in the child list, e.g. if this method is called after the code
* generator begins the tree transformation.
*/
public List<AstNode> getStatements() {
List<AstNode> stmts = new ArrayList<AstNode>();
Node n = getFirstChild();
while (n != null) {
stmts.add((AstNode)n);
n = n.getNext();
}
return stmts;
}
代码示例来源:origin: rhino/js
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: geogebra/geogebra
private static void buildStatementList_r(Node node, ObjArray statements)
{
int type = node.getType();
if (type == Token.BLOCK
|| type == Token.LOCAL_BLOCK
|| type == Token.LOOP
|| type == Token.FUNCTION)
{
Node child = node.getFirstChild();
while (child != null) {
buildStatementList_r(child, statements);
child = child.getNext();
}
} else {
statements.add(node);
}
}
代码示例来源:origin: geogebra/geogebra
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: io.apigee/rhino
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: com.github.tntim96/rhino
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: ro.isdc.wro4j/rhino
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: geogebra/geogebra
private void visitSetConst(Node node, Node child)
{
String name = node.getFirstChild().getString();
while (child != null) {
generateExpression(child, node);
child = child.getNext();
}
cfw.addALoad(contextLocal);
cfw.addPush(name);
addScriptRuntimeInvoke(
"setConst",
"(Lorg/mozilla/javascript/Scriptable;"
+"Ljava/lang/Object;"
+"Lorg/mozilla/javascript/Context;"
+"Ljava/lang/String;"
+")Ljava/lang/Object;");
}
代码示例来源:origin: rhino/js
private void visitSetConst(Node node, Node child)
{
String name = node.getFirstChild().getString();
while (child != null) {
generateExpression(child, node);
child = child.getNext();
}
cfw.addALoad(contextLocal);
cfw.addPush(name);
addScriptRuntimeInvoke(
"setConst",
"(Lorg/mozilla/javascript/Scriptable;"
+"Ljava/lang/Object;"
+"Lorg/mozilla/javascript/Context;"
+"Ljava/lang/String;"
+")Ljava/lang/Object;");
}
代码示例来源:origin: org.teavm/teavm-jso-impl
private static AstNode isSingleStatement(AstNode ast) {
if (ast.getFirstChild() == null || ast.getFirstChild().getNext() != null) {
return null;
}
if (ast.getFirstChild().getType() == Token.BLOCK) {
return isSingleStatement((AstNode) ast.getFirstChild());
}
return (AstNode) ast.getFirstChild();
}
代码示例来源:origin: org.teavm/teavm-jso-impl
private void print(Block node) throws IOException {
writer.append('{').softNewLine().indent();
for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
print((AstNode) child);
writer.softNewLine();
}
writer.outdent().append('}');
}
代码示例来源:origin: org.teavm/teavm-jso-impl
private void print(Scope node) throws IOException {
writer.append('{').softNewLine().indent();
for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
print((AstNode) child);
writer.softNewLine();
}
writer.outdent().append('}');
}
代码示例来源:origin: rhino/js
private void visitStandardNew(Node node, Node child)
{
if (node.getType() != Token.NEW) throw Codegen.badTree();
Node firstArgChild = child.getNext();
generateExpression(child, node);
// stack: ... functionObj
cfw.addALoad(contextLocal);
cfw.addALoad(variableObjectLocal);
// stack: ... functionObj cx scope
generateCallArgArray(node, firstArgChild, false);
addScriptRuntimeInvoke(
"newObject",
"(Ljava/lang/Object;"
+"Lorg/mozilla/javascript/Context;"
+"Lorg/mozilla/javascript/Scriptable;"
+"[Ljava/lang/Object;"
+")Lorg/mozilla/javascript/Scriptable;");
}
内容来源于网络,如有侵权,请联系作者删除!