Examples of copyInformationFrom()


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

   * Converts extended object literal {a} to {a:a}.
   */
  private void visitStringKey(Node n) {
    if (!n.hasChildren()) {
      Node name = IR.name(n.getString());
      name.copyInformationFrom(n);
      n.addChildToBack(name);
      compiler.reportCodeChange();
    }
  }

View Full Code Here

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

  private void applyCollapses() {
    for (Collapse collapse : collapses) {

      Node var = new Node(Token.VAR);
      var.copyInformationFrom(collapse.startNode);
      collapse.parent.addChildBefore(var, collapse.startNode);

      boolean redeclaration = false;
      for (Node n = collapse.startNode; n != collapse.endNode;) {
        Node next = n.getNext();
View Full Code Here

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

    if (falseExpr.hasChildren()) {
      ifNode = IR.ifNode(cond, trueExpr, falseExpr);
    } else {
      ifNode = IR.ifNode(cond, trueExpr);
    }
    ifNode.copyInformationFrom(expr);

    if (needResult) {
      Node tempVarNode = NodeUtil.newVarNode(tempName, null)
          .copyInformationFromForTree(expr);
      Node injectionPointParent = injectionPoint.getParent();
View Full Code Here

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

      Node parent = n.getParent();
      Node newString = IR.string(stringValue);

      parent.replaceChild(n, newString);
      newString.copyInformationFrom(parent);
      reportCodeChange();

      return newString;
    }
    return n;
View Full Code Here

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

    } else {
      Node statement = IR.exprResult(cond.detachFromParent())
          .copyInformationFrom(cond);
      if (parent.isLabel()) {
        Node block = IR.block();
        block.copyInformationFrom(statement);
        block.addChildToFront(statement);
        statement = block;
      }
      parent.replaceChild(n, statement);
    }
View Full Code Here

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

          // declaration near all the other declarations.
          Preconditions.checkState(varmap.containsKey(var));

          // Replace the GETPROP node with a NAME.
          Node replacement = IR.name(varmap.get(var));
          replacement.copyInformationFrom(getprop);
          ref.getGrandparent().replaceChild(ref.getParent(), replacement);
        }
      }
    }
  }
View Full Code Here

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

  private class Callback extends AbstractPostOrderCallback {
    @Override
    public void visit(NodeTraversal t, Node n, Node parent) {
      if (n.matchesQualifiedName(OBJECT_PROPERTY_STRING)) {
        Node newName = IR.name(EXTERN_OBJECT_PROPERTY_STRING);
        newName.copyInformationFrom(n);
        parent.replaceChild(n, newName);
        compiler.reportCodeChange();
        return;
      }
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 = IR.exprResult(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()

             !current.isName();
             current = current.getFirstChild()) {
          if (current.isGetElem()) {
            replacement = IR.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()

        case Token.WHILE:
          if (CONVERT_WHILE_TO_FOR) {
            Node expr = n.getFirstChild();
            n.setType(Token.FOR);
            Node empty = IR.empty();
            empty.copyInformationFrom(n);
            n.addChildBefore(empty, expr);
            n.addChildAfter(empty.cloneNode(), expr);
            reportCodeChange("WHILE node");
          }
          break;
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.