Examples of copyInformationFrom()


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

        case Token.WHILE:
        case Token.DO:
          return;
        default:
          Node block = IR.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().isEmpty()) {
              Node init = c.getFirstChild();
              Node empty = IR.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()

        // Convert "var name = value" to "name = value"
        Node value = n.getFirstChild();
        n.removeChild(value);
        Node replacement = IR.assign(n, value);
        replacement.setJSDocInfo(parent.getJSDocInfo());
        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

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

  protected static Node fuseExpressionIntoExpression(Node exp1, Node exp2) {
    if (exp2.isEmpty()) {
      return exp1;
    }
    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.isComma()) {
View Full Code Here

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

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

      Node assignment = IR.assign(nameNode, functionCopy);
      assignment.copyInformationFrom(functionCopy);

      return NodeUtil.newExpr(assignment);
    }

    /**
 
View Full Code Here

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

          "Wildcard export"));
    } else if (n.getChildCount() == 2) {
      //   export {x, y as z} from 'moduleIdentifier';
      Node moduleIdentifier = n.getLastChild();
      Node importNode = new Node(Token.IMPORT, moduleIdentifier.cloneNode());
      importNode.copyInformationFrom(n);
      parent.addChildBefore(importNode, n);
      visit(t, importNode, parent);

      String loadAddress = loader.locate(moduleIdentifier.getString(), t.getInput());
      String moduleName = toModuleName(loadAddress);
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 = IR.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 Node joinOnComma(List<Node> commas, Node source) {
      Node comma = commas.get(0);
      for (int i = 1; i < commas.size(); i++) {
        Node nextComma = IR.comma(comma, commas.get(i));
        nextComma.copyInformationFrom(source);
        comma = nextComma;
      }
      return comma;
    }
  }
View Full Code Here

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

        && n.getType() != Token.SWITCH) {
      for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
        if (NodeUtil.isControlStructureCodeBlock(n,c) &&
            c.getType() != Token.BLOCK) {
          Node newBlock = new Node(Token.BLOCK, n.getLineno(), n.getCharno());
          newBlock.copyInformationFrom(n);
          n.replaceChild(c, newBlock);
          if (c.getType() != Token.EMPTY) {
            newBlock.addChildrenToFront(c);
          } else {
            newBlock.setWasEmptyNode(true);
View Full Code Here

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

  private void applyWorkAround(Node assign, NodeTraversal t) {
//System.out.println("applyWorkAround: " + assign.toStringTree());
    Preconditions.checkArgument(NodeUtil.isAssign(assign));
    Node parent = assign.getParent();
    Node comma = new Node(Token.COMMA);
    comma.copyInformationFrom(assign);
    parent.replaceChild(assign, comma);

    String newName = names.peek().getNextNewName();
    Node newAssign = new Node(Token.ASSIGN,
        Node.newString(Token.NAME, newName));
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.