Package org.mozilla.javascript.ast

Examples of org.mozilla.javascript.ast.IfStatement


    return loop;
  }

  @Override
  public AstNode ifStatement(AstNode condition, AstNode thenPart, AstNode elsePart) {
    IfStatement ifs = new IfStatement();
    ifs.setCondition(condition);
    ifs.setThenPart(thenPart);
    ifs.setElsePart(elsePart);
    return ifs;
  }
View Full Code Here


  public AstNode makeSureBlockExistsAround(AstNode node) {
    AstNode parent = node.getParent();

    if (parent instanceof IfStatement) {
      /* the parent is an if and there are no braces, so we should make a new block */
      IfStatement i = (IfStatement) parent;

      /* replace the if or the then, depending on what the current node is */
      if (i.getThenPart().equals(node)) {
        i.setThenPart(createBlockWithNode(node));
      } else {
        i.setElsePart(createBlockWithNode(node));
      }
    } else if (parent instanceof WhileLoop) {
      /* the parent is a while and there are no braces, so we should make a new block */
      /* I don't think you can find this in the real world, but just to be sure */
      WhileLoop w = (WhileLoop) parent;
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.ast.IfStatement

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.