Package org.mozilla.javascript

Examples of org.mozilla.javascript.Node$NumberNode


        throw new WinkAstException("OBJECTLIT Node: props and childs count are not equal");
      }
    }

    for (final Node c : nodeChilds) {
      Node cidentified = c;
      if (c.getType() == Token.FUNCTION) {
        final int fnIndex = c.getExistingIntProp(Node.FUNCTION_PROP);
        cidentified = scope.getAsScriptOrFn().getFunctionNode(fnIndex);
      }
View Full Code Here


    boolean isFirst = true;
    while (true) {
      int i = 0;
      for (Node childNode = node.getFirstChild(); childNode != null; childNode = childNode
          .getNext()) {
        Node valueNode = childNode.getFirstChild();
        IdentifierExpression id = (IdentifierExpression) addExpression(
            childNode, root, scope);
        if (valueNode != null) {
          IExpression value = addExpression(valueNode, root, scope);
          BinaryExpression assignment = new BinaryExpression(node.getLineno(),
View Full Code Here

   *          语句子节点生存域
   */
  public BlockStatement(Node node, ScriptOrFnNode root, Scope scope) {
    super(node);

    Node childNode = node.getFirstChild();
    while (childNode != null) {
      IStatement statement = addStatement(childNode, root, scope);
      statements.add(statement);
      childNode = statement.getNext();
    }
View Full Code Here

   * @param scope
   *          语句子节点生存域
   */
  public SwitchStatement(Node node, ScriptOrFnNode root, Scope scope) {
    super(node);
    Node child = node.getFirstChild();

    target = addExpression(child, root, scope);

    while ((child = child.getNext()) != null) {
      CaseItem item = new CaseItem();
      item.value = addExpression(child.getFirstChild(), root, scope);
      items.add(item);
    }

    node = node.getNext();

    for (CaseItem item : items) {
      node = node.getNext().getNext();
      item.statement = addStatement(node, root, scope);
    }

    if (items.size() > 0) {
      CaseItem item = items.get(items.size() - 1);
      if (item.statement instanceof BlockStatement) {
        StatementList statements = ((BlockStatement) item.statement)
            .getStatementList();
        IStatement statement = statements.get(statements.size() - 1);
        if (statement instanceof ControlStatement
            && ((ControlStatement) statement).getType() == Token.BREAK) {
          statements.remove(statements.size() - 1);
        }
      }
    }

    Node nextNode = node.getNext().getNext();
    if (nextNode != null) {
      node = nextNode.getNext();
      if (node.getType() == Token.TARGET && nextNode.getType() == Token.BLOCK) {
        CaseItem item = new CaseItem();
        item.statement = addStatement(nextNode, root, scope);
        items.add(item);
        nextNode = node.getNext();
      }
View Full Code Here

   */
  public IfStatement(Node node, ScriptOrFnNode root, Scope scope) {
    super(node);
    checkExpression = addExpression(node.getFirstChild(), root, scope);

    Node nextNode = node.getNext();
    if (nextNode.getType() != Token.GOTO && nextNode.getType() != Token.TARGET) {
      trueStatement = addStatement(nextNode, root, scope);
      if (trueStatement instanceof EmptyStatement) {
        trueStatement = null;
      }
      nextNode = nextNode.getNext();
    }

    if (nextNode.getType() == Token.GOTO) {
      nextNode = nextNode.getNext().getNext();
      falseStatement = addStatement(nextNode, root, scope);
      if (falseStatement instanceof EmptyStatement) {
        falseStatement = null;
      }
      nextNode = nextNode.getNext();
    }

    setNext(nextNode.getNext());

    if (trueStatement == null && falseStatement != null) {
      checkExpression = new UnaryExpression(node.getLineno(), Token.NOT,
          checkExpression);
      trueStatement = falseStatement;
View Full Code Here

      name = scope.addIdentifier(fnNode.getFunctionName());
    }

    node = fnNode.getFirstChild().getFirstChild();
    if (node.getType() == Token.EXPR_VOID) {
      Node firstChild = node.getFirstChild();
      if (firstChild.getType() == Token.SETNAME
          && firstChild.getLastChild().getType() == Token.THISFN) {
        node = node.getNext();
      }
    }
    while (node != null) {
      IStatement statement = Utils.createStatement(node, fnNode, fnScope);
View Full Code Here

   */
  public CallExpression(Node node, ScriptOrFnNode root, Scope scope) {
    super(node.getLineno());
    tokenType = node.getType();

    Node child = node.getFirstChild();
    caller = addExpression(child, root, scope);
    while ((child = child.getNext()) != null) {
      params.add(addExpression(child, root, scope));
    }
  }
View Full Code Here

    if (tokenType == Token.TYPEOFNAME) {
      tokenType = Token.TYPEOF;
      target = new IdentifierExpression(node, root, scope);
      target.setParent(this);
    } else {
      Node firstChild = node.getFirstChild();
      if (tokenType == Token.DELPROP) {
        if (firstChild.getType() == Token.BINDNAME) {
          target = new IdentifierExpression(firstChild.getLineno(), firstChild
              .getString());
          target.setParent(this);
          return;
        }

        node = firstChild.getNext();
        if (node.getType() == Token.STRING) {
          member = scope.addConstant(node.getString(), true);
        } else {
          memberExpression = addExpression(node, root, scope);
        }
View Full Code Here

   
    node = node.getFirstChild().getFirstChild();
    bodyStatement = addStatement(node, root, scope);

    node = node.getNext().getNext().getNext();
    Node childNode = node.getFirstChild();
    if (childNode != null) {
      catchScope = true;
//      catchScope = new Scope(scope);

      Node tmpNode = childNode.getFirstChild();
      scope.registerLocalIdentifier(tmpNode.getString());
//      catchScope.registerLocalIdentifier(tmpNode.getString());

      exception = addExpression(tmpNode, root, scope);
//      exception = addExpression(tmpNode, root, catchScope);

      childNode = childNode.getNext().getFirstChild().getNext().getFirstChild();

      for (tmpNode = childNode.getFirstChild(); tmpNode != null; tmpNode = tmpNode
          .getNext()) {
        if (tmpNode.getType() == Token.LEAVEWITH) {
          childNode.removeChild(tmpNode.getNext());
          childNode.removeChild(tmpNode);
        }
      }

      catchStatement = addStatement(childNode, root, scope);
View Full Code Here

   * @param scope
   *          语句子节点生存域
   */
  public LoopStatement(Node node, ScriptOrFnNode root, Scope scope) {
    super(node);
    Node childNode = node.getFirstChild();

    switch (childNode.getType()) {
    case Token.EXPR_VOID:
      tokenType = Token.FOR;
      startNode = addExpression(childNode.getFirstChild(), root, scope);
      childNode = childNode.getNext();
      break;

    case Token.VAR:
      tokenType = Token.FOR;
      startNode = addStatement(childNode, root, scope);
      childNode = childNode.getNext();
      break;
    }

    if (childNode.getType() == Token.TARGET) {
      bodyStatement = addStatement(childNode.getNext(), root, scope);
      childNode = bodyStatement.getNext().getNext();
      checkExpression = addExpression(childNode.getFirstChild(), root, scope);
      if (tokenType == 0) {
        tokenType = Token.DO;
      }
    } else if (childNode.getType() == Token.GOTO) {
      bodyStatement = addStatement(childNode.getNext().getNext(), root, scope);
      childNode = bodyStatement.getNext().getNext();

      if (childNode.getType() == Token.EXPR_VOID) {
        tokenType = Token.FOR;
        endExpression = addExpression(childNode.getFirstChild(), root, scope);
        childNode = childNode.getNext().getNext();
      }

      childNode = childNode.getNext();
      if (childNode.getType() == Token.TARGET) {
        checkExpression = addExpression(childNode.getNext().getFirstChild(),
            root, scope);
        tokenType = Token.FOR;
      } else {
        checkExpression = addExpression(childNode.getFirstChild(), root, scope);
        if (tokenType == 0) {
          tokenType = Token.WHILE;
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.Node$NumberNode

Copyright © 2018 www.massapicom. 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.