Package com.google.javascript.rhino

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


        LoopObject object = loopObjectMap.get(loopNode);
        Node objectLit = IR.objectlit();
        Node objectLitNextIteration = IR.objectlit();
        for (Var var : object.vars) {
          objectLit.addChildToBack(IR.stringKey(var.name, IR.name("undefined")));
          objectLitNextIteration.addChildToBack(
              IR.stringKey(var.name, IR.getprop(IR.name(object.name),
              IR.string(var.name))));
        }

        Node updateLoopObject = IR.assign(IR.name(object.name), objectLitNextIteration);
View Full Code Here


        // Reuse the existing block.
        newDestBlock = destBlock;
      } else {
        // Add the existing statement to the new block.
        ifNode.replaceChild(destBlock, newDestBlock);
        newDestBlock.addChildToBack(destBlock);
      }

      // Move all the if node's following siblings.
      moveAllFollowing(ifNode, ifNode.getParent(), newDestBlock);
      compiler.reportChangeToEnclosingScope(ifNode);
View Full Code Here

    protected final Node buildCallNode(String methodName, Node argumentNode,
                                       Node srcref) {
      Node call = IR.call(IR.name(methodName)).srcref(srcref);
      call.putBooleanProp(Node.FREE_CALL, true);
      if (argumentNode != null) {
        call.addChildToBack(argumentNode.cloneTree());
      }
      return call;
    }
  }
View Full Code Here

    l.addChildToBack(i);
    l.addChildToBack(j);
    l.addChildToBack(k);

    m.addChildToBack(d);
    m.addChildToBack(h);
    m.addChildToBack(l);

    return m;
  }
View Full Code Here

    l.addChildToBack(i);
    l.addChildToBack(j);
    l.addChildToBack(k);

    m.addChildToBack(d);
    m.addChildToBack(h);
    m.addChildToBack(l);

    return m;
  }
View Full Code Here

    l.addChildToBack(j);
    l.addChildToBack(k);

    m.addChildToBack(d);
    m.addChildToBack(h);
    m.addChildToBack(l);

    return m;
  }

  @Override
View Full Code Here

  /** Creates a fake function with the given description. */
  private ConcreteFunctionType createFunction(
      String name, String... paramNames) {
    Node args = new Node(Token.LP);
    for (int i = 0; i < paramNames.length; ++i) {
      args.addChildToBack(Node.newString(Token.NAME, paramNames[i]));
    }

    Node decl = new Node(Token.FUNCTION,
                         Node.newString(Token.NAME, name),
                         args,
View Full Code Here

   */
  public void testNegatedNameCondition() throws Exception {
    FlowScope blind = newScope();
    Node a = createVar(blind, "a", createNullableType(STRING_TYPE));
    Node condition = new Node(Token.NOT);
    condition.addChildToBack(a);

    // true outcome.
    FlowScope informedTrue = interpreter.
        getPreciserScopeKnowingConditionOutcome(condition, blind, true);
    assertEquals(createNullableType(STRING_TYPE),
View Full Code Here

  private void testBinop(FlowScope blind, int binop, Node left, Node right,
      Collection<TypedName> trueOutcome,
      Collection<TypedName> falseOutcome) {
    Node condition = new Node(binop);
    condition.addChildToBack(left);
    condition.addChildToBack(right);

    // true outcome.
    FlowScope informedTrue = interpreter.
        getPreciserScopeKnowingConditionOutcome(condition, blind, true);
View Full Code Here

  private void testBinop(FlowScope blind, int binop, Node left, Node right,
      Collection<TypedName> trueOutcome,
      Collection<TypedName> falseOutcome) {
    Node condition = new Node(binop);
    condition.addChildToBack(left);
    condition.addChildToBack(right);

    // true outcome.
    FlowScope informedTrue = interpreter.
        getPreciserScopeKnowingConditionOutcome(condition, blind, true);
    for (TypedName p : trueOutcome) {
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.