Examples of copyInformationFrom()


Examples of com.google.javascript.rhino.Node.copyInformationFrom()

             current.getType() != Token.NAME;
             current = current.getFirstChild()) {
          if (current.getType() == Token.GETELEM) {
            replacement = new Node(Token.COMMA,
                current.getLastChild().detachFromParent(), replacement);
            replacement.copyInformationFrom(current);
          }
        }

        parent.replaceChild(assignNode, replacement);
      } else {
View Full Code Here

Examples of com.google.javascript.rhino.Node.copyInformationFrom()

      n.detachChildren();
      // Replace the original expression with the left operand.
      parent.replaceChild(n, left);
      // Add the right expression afterward.
      Node newStatement = new Node(Token.EXPR_RESULT, right);
      newStatement.copyInformationFrom(n);

      //This modifies outside the subtree, which is not
      //desirable in a peephole optimization.
      parent.getParent().addChildAfter(newStatement, parent);
      reportCodeChange();
View Full Code Here

Examples of com.google.javascript.rhino.Node.copyInformationFrom()

        case Token.WHILE:
          if (CONVERT_WHILE_TO_FOR) {
            Node expr = n.getFirstChild();
            n.setType(Token.FOR);
            Node empty = new Node(Token.EMPTY);
            empty.copyInformationFrom(n);
            n.addChildBefore(empty, expr);
            n.addChildAfter(empty.cloneNode(), expr);
            reportCodeChange("WHILE node");
          }
          break;
View Full Code Here

Examples of com.google.javascript.rhino.Node.copyInformationFrom()

    private void rewriteFunctionDeclaration(Node n) {
      // Prepare a spot for the function.
      Node oldNameNode = n.getFirstChild();
      Node fnNameNode = oldNameNode.cloneNode();
      Node var = new Node(Token.VAR, fnNameNode, n.getLineno(), n.getCharno());
      var.copyInformationFrom(n);

      // Prepare the function
      oldNameNode.setString("");

      // Move the function
View Full Code Here

Examples of com.google.javascript.rhino.Node.copyInformationFrom()

        case Token.WHILE:
        case Token.DO:
          return;
        default:
          Node block = new Node(Token.BLOCK);
          block.copyInformationFrom(last);
          n.replaceChild(last, block);
          block.addChildToFront(last);
          reportCodeChange("LABEL normalization");
          return;
      }
View Full Code Here

Examples of com.google.javascript.rhino.Node.copyInformationFrom()

                reportCodeChange("FOR-IN var declaration");
              }
            } else if (c.getFirstChild().getType() != Token.EMPTY) {
              Node init = c.getFirstChild();
              Node empty = new Node(Token.EMPTY);
              empty.copyInformationFrom(c);
              c.replaceChild(init, empty);

              Node newStatement;
              // Only VAR statements, and expressions are allowed,
              // but are handled differently.
View Full Code Here

Examples of com.google.javascript.rhino.Node.copyInformationFrom()

        parent.removeChild(n);
        // Convert "var name = value" to "name = value"
        Node value = n.getFirstChild();
        n.removeChild(value);
        Node replacement = new Node(Token.ASSIGN, n, value);
        replacement.copyInformationFrom(parent);
        gramps.replaceChild(parent, NodeUtil.newExpr(replacement));
      } else {
        // It is an empty reference remove it.
        if (NodeUtil.isStatementBlock(gramps)) {
          gramps.removeChild(parent);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.