org.mozilla.javascript.Node.getNext()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 JavaScript  
字(7.5k)|赞(0)|评价(0)|浏览(327)

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

Node.getNext介绍

暂无

代码示例

代码示例来源:origin: konsoletyper/teavm

  1. private void handle(AstNode block) {
  2. Node child = block.getFirstChild();
  3. while (child != null) {
  4. Node next = child.getNext();
  5. if (child instanceof ExpressionStatement) {
  6. ExpressionStatement statement = (ExpressionStatement) child;
  7. if (statement.getExpression() instanceof StringLiteral) {
  8. block.removeChild(child);
  9. }
  10. }
  11. child = next;
  12. }
  13. }
  14. }

代码示例来源:origin: konsoletyper/teavm

  1. private void print(Scope node) throws IOException {
  2. writer.append('{').softNewLine().indent();
  3. for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
  4. print((AstNode) child);
  5. writer.softNewLine();
  6. }
  7. writer.outdent().append('}');
  8. }

代码示例来源:origin: konsoletyper/teavm

  1. private void print(Block node) throws IOException {
  2. writer.append('{').softNewLine().indent();
  3. for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
  4. print((AstNode) child);
  5. writer.softNewLine();
  6. }
  7. writer.outdent().append('}');
  8. }

代码示例来源:origin: io.apigee/rhino

  1. /**
  2. * Returns a copy of the child list, with each child cast to an
  3. * {@link AstNode}.
  4. * @throws ClassCastException if any non-{@code AstNode} objects are
  5. * in the child list, e.g. if this method is called after the code
  6. * generator begins the tree transformation.
  7. */
  8. public List<AstNode> getStatements() {
  9. List<AstNode> stmts = new ArrayList<AstNode>();
  10. Node n = getFirstChild();
  11. while (n != null) {
  12. stmts.add((AstNode)n);
  13. n = n.getNext();
  14. }
  15. return stmts;
  16. }

代码示例来源:origin: ro.isdc.wro4j/rhino

  1. /**
  2. * Returns a copy of the child list, with each child cast to an
  3. * {@link AstNode}.
  4. * @throws ClassCastException if any non-{@code AstNode} objects are
  5. * in the child list, e.g. if this method is called after the code
  6. * generator begins the tree transformation.
  7. */
  8. public List<AstNode> getStatements() {
  9. List<AstNode> stmts = new ArrayList<AstNode>();
  10. Node n = getFirstChild();
  11. while (n != null) {
  12. stmts.add((AstNode)n);
  13. n = n.getNext();
  14. }
  15. return stmts;
  16. }

代码示例来源:origin: com.github.tntim96/rhino

  1. /**
  2. * Returns a copy of the child list, with each child cast to an
  3. * {@link AstNode}.
  4. * @throws ClassCastException if any non-{@code AstNode} objects are
  5. * in the child list, e.g. if this method is called after the code
  6. * generator begins the tree transformation.
  7. */
  8. public List<AstNode> getStatements() {
  9. List<AstNode> stmts = new ArrayList<AstNode>();
  10. Node n = getFirstChild();
  11. while (n != null) {
  12. stmts.add((AstNode)n);
  13. n = n.getNext();
  14. }
  15. return stmts;
  16. }

代码示例来源:origin: geogebra/geogebra

  1. /**
  2. * Returns a copy of the child list, with each child cast to an
  3. * {@link AstNode}.
  4. * @throws ClassCastException if any non-{@code AstNode} objects are
  5. * in the child list, e.g. if this method is called after the code
  6. * generator begins the tree transformation.
  7. */
  8. public List<AstNode> getStatements() {
  9. List<AstNode> stmts = new ArrayList<AstNode>();
  10. Node n = getFirstChild();
  11. while (n != null) {
  12. stmts.add((AstNode)n);
  13. n = n.getNext();
  14. }
  15. return stmts;
  16. }

代码示例来源:origin: rhino/js

  1. private static Node addBeforeCurrent(Node parent, Node previous,
  2. Node current, Node toAdd)
  3. {
  4. if (previous == null) {
  5. if (!(current == parent.getFirstChild())) Kit.codeBug();
  6. parent.addChildToFront(toAdd);
  7. } else {
  8. if (!(current == previous.getNext())) Kit.codeBug();
  9. parent.addChildAfter(toAdd, previous);
  10. }
  11. return toAdd;
  12. }

代码示例来源:origin: geogebra/geogebra

  1. private static void buildStatementList_r(Node node, ObjArray statements)
  2. {
  3. int type = node.getType();
  4. if (type == Token.BLOCK
  5. || type == Token.LOCAL_BLOCK
  6. || type == Token.LOOP
  7. || type == Token.FUNCTION)
  8. {
  9. Node child = node.getFirstChild();
  10. while (child != null) {
  11. buildStatementList_r(child, statements);
  12. child = child.getNext();
  13. }
  14. } else {
  15. statements.add(node);
  16. }
  17. }

代码示例来源:origin: geogebra/geogebra

  1. private static Node addBeforeCurrent(Node parent, Node previous,
  2. Node current, Node toAdd)
  3. {
  4. if (previous == null) {
  5. if (!(current == parent.getFirstChild())) Kit.codeBug();
  6. parent.addChildToFront(toAdd);
  7. } else {
  8. if (!(current == previous.getNext())) Kit.codeBug();
  9. parent.addChildAfter(toAdd, previous);
  10. }
  11. return toAdd;
  12. }

代码示例来源:origin: io.apigee/rhino

  1. private static Node addBeforeCurrent(Node parent, Node previous,
  2. Node current, Node toAdd)
  3. {
  4. if (previous == null) {
  5. if (!(current == parent.getFirstChild())) Kit.codeBug();
  6. parent.addChildToFront(toAdd);
  7. } else {
  8. if (!(current == previous.getNext())) Kit.codeBug();
  9. parent.addChildAfter(toAdd, previous);
  10. }
  11. return toAdd;
  12. }

代码示例来源:origin: com.github.tntim96/rhino

  1. private static Node addBeforeCurrent(Node parent, Node previous,
  2. Node current, Node toAdd)
  3. {
  4. if (previous == null) {
  5. if (!(current == parent.getFirstChild())) Kit.codeBug();
  6. parent.addChildToFront(toAdd);
  7. } else {
  8. if (!(current == previous.getNext())) Kit.codeBug();
  9. parent.addChildAfter(toAdd, previous);
  10. }
  11. return toAdd;
  12. }

代码示例来源:origin: com.sun.phobos/phobos-rhino

  1. private static Node addBeforeCurrent(Node parent, Node previous,
  2. Node current, Node toAdd)
  3. {
  4. if (previous == null) {
  5. if (!(current == parent.getFirstChild())) Kit.codeBug();
  6. parent.addChildToFront(toAdd);
  7. } else {
  8. if (!(current == previous.getNext())) Kit.codeBug();
  9. parent.addChildAfter(toAdd, previous);
  10. }
  11. return toAdd;
  12. }

代码示例来源:origin: ro.isdc.wro4j/rhino

  1. private static Node addBeforeCurrent(Node parent, Node previous,
  2. Node current, Node toAdd)
  3. {
  4. if (previous == null) {
  5. if (!(current == parent.getFirstChild())) Kit.codeBug();
  6. parent.addChildToFront(toAdd);
  7. } else {
  8. if (!(current == previous.getNext())) Kit.codeBug();
  9. parent.addChildAfter(toAdd, previous);
  10. }
  11. return toAdd;
  12. }

代码示例来源:origin: geogebra/geogebra

  1. private void visitSetConst(Node node, Node child)
  2. {
  3. String name = node.getFirstChild().getString();
  4. while (child != null) {
  5. generateExpression(child, node);
  6. child = child.getNext();
  7. }
  8. cfw.addALoad(contextLocal);
  9. cfw.addPush(name);
  10. addScriptRuntimeInvoke(
  11. "setConst",
  12. "(Lorg/mozilla/javascript/Scriptable;"
  13. +"Ljava/lang/Object;"
  14. +"Lorg/mozilla/javascript/Context;"
  15. +"Ljava/lang/String;"
  16. +")Ljava/lang/Object;");
  17. }

代码示例来源:origin: rhino/js

  1. private void visitSetConst(Node node, Node child)
  2. {
  3. String name = node.getFirstChild().getString();
  4. while (child != null) {
  5. generateExpression(child, node);
  6. child = child.getNext();
  7. }
  8. cfw.addALoad(contextLocal);
  9. cfw.addPush(name);
  10. addScriptRuntimeInvoke(
  11. "setConst",
  12. "(Lorg/mozilla/javascript/Scriptable;"
  13. +"Ljava/lang/Object;"
  14. +"Lorg/mozilla/javascript/Context;"
  15. +"Ljava/lang/String;"
  16. +")Ljava/lang/Object;");
  17. }

代码示例来源:origin: org.teavm/teavm-jso-impl

  1. private static AstNode isSingleStatement(AstNode ast) {
  2. if (ast.getFirstChild() == null || ast.getFirstChild().getNext() != null) {
  3. return null;
  4. }
  5. if (ast.getFirstChild().getType() == Token.BLOCK) {
  6. return isSingleStatement((AstNode) ast.getFirstChild());
  7. }
  8. return (AstNode) ast.getFirstChild();
  9. }

代码示例来源:origin: org.teavm/teavm-jso-impl

  1. private void print(Block node) throws IOException {
  2. writer.append('{').softNewLine().indent();
  3. for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
  4. print((AstNode) child);
  5. writer.softNewLine();
  6. }
  7. writer.outdent().append('}');
  8. }

代码示例来源:origin: org.teavm/teavm-jso-impl

  1. private void print(Scope node) throws IOException {
  2. writer.append('{').softNewLine().indent();
  3. for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
  4. print((AstNode) child);
  5. writer.softNewLine();
  6. }
  7. writer.outdent().append('}');
  8. }

代码示例来源:origin: rhino/js

  1. private void visitStandardNew(Node node, Node child)
  2. {
  3. if (node.getType() != Token.NEW) throw Codegen.badTree();
  4. Node firstArgChild = child.getNext();
  5. generateExpression(child, node);
  6. // stack: ... functionObj
  7. cfw.addALoad(contextLocal);
  8. cfw.addALoad(variableObjectLocal);
  9. // stack: ... functionObj cx scope
  10. generateCallArgArray(node, firstArgChild, false);
  11. addScriptRuntimeInvoke(
  12. "newObject",
  13. "(Ljava/lang/Object;"
  14. +"Lorg/mozilla/javascript/Context;"
  15. +"Lorg/mozilla/javascript/Scriptable;"
  16. +"[Ljava/lang/Object;"
  17. +")Lorg/mozilla/javascript/Scriptable;");
  18. }

相关文章