Package com.google.javascript.rhino

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


        parse("a = b + c(d + e).print()"));
  }

  private Node createScript(Node n) {
    Node script = new Node(Token.SCRIPT);
    script.addChildToBack(n);
    return script;
  }

  public void testMethodInObjectLiteral() {
    testMethodInObjectLiteral("var a = {b() {}};");
View Full Code Here


   */
  static Node newVarNode(String name, Node value) {
    Node nodeName = IR.name(name);
    if (value != null) {
      Preconditions.checkState(value.getNext() == null);
      nodeName.addChildToBack(value);
      nodeName.srcref(value);
    }
    Node var = IR.var(nodeName).srcref(nodeName);

    return var;
View Full Code Here

  static Node newCallNode(Node callTarget, Node... parameters) {
    boolean isFreeCall = !isGet(callTarget);
    Node call = IR.call(callTarget);
    call.putBooleanProp(Node.FREE_CALL, isFreeCall);
    for (Node parameter : parameters) {
      call.addChildToBack(parameter);
    }
    return call;
  }

  /**
 
View Full Code Here

    if (!guard.isEmpty()) {
      Node container = new Node(Token.BLOCK);
      n.replaceChild(guard, container);
      container.addChildToFront(IR.block(IR.exprResult(IR.assign(
        guardName.cloneTree(), guard.cloneTree()))));
      container.addChildToBack(guardName.cloneTree());
    }
    if (!incr.isEmpty()) {
      n.addChildBefore(IR.block(IR.exprResult(incr.detachFromParent())), n.getLastChild());
    }
    Node block = NodeUtil.getEnclosingType(n, Token.BLOCK);
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

        IR.assign(finallyName.cloneTree(), IR.number(jumpPoint)));
    Node toFinally = createStateUpdate(finallyStartState);
    Node returnPoint = IR.number(jumpPoint);
    returnPoint.setGeneratorMarker(true);
    Node returnBlock = IR.block(setReturnState, toFinally, createSafeBreak());
    returnBlock.addChildToBack(returnPoint);
    return returnBlock;
  }

  private LoopContext getLoopContext(String label) {
    for (int i = 0; i < currentLoopContext.size(); i++) {
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);
    assertTypeEquals(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

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.