Examples of copyInformationFrom()


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

    if (falseExpr.hasChildren()) {
      ifNode = new Node(Token.IF, cond, trueExpr, falseExpr);
    } else {
      ifNode = new Node(Token.IF, 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 = Node.newString(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()

    @Override
    public void visit(NodeTraversal t, Node n, Node parent) {
      if (OBJECT_PROPERTY_STRING.equals(n.getQualifiedName())) {
        Node newName =
            Node.newString(Token.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()

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

          // Replace the GETPROP node with a NAME.
          Node replacement = Node.newString(Token.NAME, varmap.get(var));
          replacement.copyInformationFrom(getprop);
          ref.getGrandparent().replaceChild(ref.getParent(), replacement);
        }
      }

      compiler.reportCodeChange();
View Full Code Here

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

      CodingConvention convention, String name, Node basisNode) {
    Node nameNode = Node.newString(Token.NAME, name);
    if (convention.isConstantKey(name)) {
      nameNode.putBooleanProp(Node.IS_CONSTANT_NAME, true);
    }
    nameNode.copyInformationFrom(basisNode);
    return nameNode;
  }

  /**
   * Creates a new node representing an *existing* name, copying over the source
View Full Code Here

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

  static Node newVarNode(String name, Node value) {
    Node nodeName = Node.newString(Token.NAME, name);
    if (value != null) {
      Preconditions.checkState(value.getNext() == null);
      nodeName.addChildToBack(value);
      nodeName.copyInformationFrom(value);
    }
    Node var = new Node(Token.VAR, nodeName)
        .copyInformationFrom(nodeName);

    return var;
View Full Code Here

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

            Node valueNode = nameNode.getNext();
            assignNode.removeChild(nameNode);
            assignNode.removeChild(valueNode);
            nameNode.addChildToFront(valueNode);
            Node varNode = new Node(Token.VAR, nameNode);
            varNode.copyInformationFrom(candidateDefinition);
            candidateDefinition.getParent().replaceChild(
                candidateDefinition, varNode);
            nameNode.setJSDocInfo(assignNode.getJSDocInfo());
            compiler.reportCodeChange();
            replacementNode = varNode;
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()

  }

  // exp1, exp1
  private static Node fuseExpressionIntoExpression(Node exp1, Node exp2) {
    Node comma = new Node(Token.COMMA, exp1);
    comma.copyInformationFrom(exp2);

    // We can just join the new comma expression with another comma but
    // lets keep all the comma's in a straight line. That way we can use
    // tree comparison.
    if (exp2.getType() == Token.COMMA) {
View Full Code Here

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

        functionCopy.replaceChild(nameNode,
            NodeUtil.newName(compiler.getCodingConvention(), "", nameNode));
      }

      Node assignment = new Node(Token.ASSIGN, nameNode, functionCopy);
      assignment.copyInformationFrom(functionCopy);

      return NodeUtil.newExpr(assignment);
    }

    /**
 
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.