Examples of addChildToFront()


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

            string length
     */
    Node propValue = Node.newString(Token.STRING, propName);
    Node propNameNode =
      Node.newString(Token.NAME, getArrayNotationNameFor(propName));
    propNameNode.addChildToFront(propValue);
    Node var = new Node(Token.VAR, propNameNode);
    root.addChildToFront(var);

    compiler.reportCodeChange();
  }
View Full Code Here

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

    Node globalValue = Node.newString(Token.NAME, global.name);
    globalValue.putBooleanProp(Node.IS_CONSTANT_NAME, global.isConstant);

    Node globalNameNode =
      Node.newString(Token.NAME, "GLOBAL_" + globalName);
    globalNameNode.addChildToFront(globalValue);
    Node var = new Node(Token.VAR, globalNameNode);
    root.addChildToFront(var);

    compiler.reportCodeChange();
  }
View Full Code Here

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

     * Creates a simple namespace variable declaration
     * (e.g. <code>var foo = {};</code>).
     */
    private Node makeVarDeclNode() {
      Node name = Node.newString(Token.NAME, namespace);
      name.addChildToFront(createNamespaceLiteral());

      Node decl = new Node(Token.VAR, name);
      decl.putBooleanProp(Node.IS_NAMESPACE, true);

      // TODO(nicksantos): ew ew ew. Create a mutator package.
View Full Code Here

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

          // try node
          Node block;
          if (!NodeUtil.isStatementBlock(parent)) {
            block = new Node(Token.BLOCK);
            parent.replaceChild(n, block);
            block.addChildToFront(tryBlock);
          } else {
            parent.replaceChild(n, tryBlock);
            block = parent;
          }
View Full Code Here

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

      while(leftMostChild.getType() == Token.COMMA) {
        leftMostChild = leftMostChild.getFirstChild();
      }
      Node parent = leftMostChild.getParent();
      comma.addChildToBack(leftMostChild.detachFromParent());
      parent.addChildToFront(comma);
      return exp2;
    } else {
      comma.addChildToBack(exp2);
      return comma;
    }
View Full Code Here

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

        Node addingRoot = null;
        if (NodeUtil.isFunctionDeclaration(n)) {
          JSModule module = t.getModule();
          addingRoot = compiler.getNodeForCodeInsertion(module);
          addingRoot.addChildToFront(expr);
        } else {
          Node beforeChild = n;
          for (Node ancestor : n.getAncestors()) {
            int type = ancestor.getType();
            if (type == Token.BLOCK || type == Token.SCRIPT) {
View Full Code Here

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

        fnNameNode.setString("");
        // Add the VAR, remove the FUNCTION
        n.getParent().replaceChild(n, var);
        var.addChildToFront(name);
        // readd the function as a function expression
        name.addChildToFront(n);
      }
      return;
    }

    for (Node c = n.getFirstChild(), next; c != null; c = next) {
View Full Code Here

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

    NodeTraversal.traverse(compiler, root, this);
    for (Entry<JSModule, List<Node>> entry : functions.entrySet()) {
      JSModule module = entry.getKey();
      Node addingRoot = compiler.getNodeForCodeInsertion(module);
      for (Node n : Lists.reverse(entry.getValue())) {
        addingRoot.addChildToFront(n);
      }
    }
  }

  @Override
View Full Code Here

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

      //     name a$b$c
      //       NODE

      // Remove the rvalue (NODE).
      parent.removeChild(rvalue);
      nameNode.addChildToFront(rvalue);

      Node varNode = new Node(Token.VAR, nameNode);
      greatGramps.replaceChild(gramps, varNode);
    } else {
      // This must be a complex assignment.
View Full Code Here

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

          (info != null && info.isConstant())) {
        nameNode.putBooleanProp(Node.IS_CONSTANT_NAME, true);
      }

      varNode.addChildToBack(nameNode);
      nameNode.addChildToFront(rvalue);
      varParent.replaceChild(gramps, varNode);

      // Update the node ancestry stored in the reference.
      ref.node = nameNode;
      insertedVarNode = true;
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.