Examples of JsConditional


Examples of com.google.gwt.dev.js.ast.JsConditional

      if (thenIsEmpty && elseIsEmpty) {
        // Convert "if (a()) {}" => "a()".
        ctx.replaceMe(condExpr.makeStmt());
      } else if (thenExpr != null && elseExpr != null) {
        // Convert "if (a()) {b()} else {c()}" => "a()?b():c()".
        JsConditional cond = new JsConditional(makeSourceInfo(x,
            "Replaced if statement with conditional"), x.getIfExpr(), thenExpr,
            elseExpr);
        ctx.replaceMe(accept(cond.makeStmt()));
      } else if (thenIsEmpty && elseExpr != null) {
        // Convert "if (a()) {} else {b()}" => a()||b().
        JsBinaryOperation op = new JsBinaryOperation(makeSourceInfo(x,
            "Replaced if statement with ||"), JsBinaryOperator.OR,
            x.getIfExpr(), elseExpr);
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsConditional

      stack.push(x);
    }

    @Override
    public void endVisit(JsConditional x, JsContext<JsExpression> ctx) {
      JsConditional toReturn = new JsConditional(x.getSourceInfo());
      toReturn.setElseExpression(stack.pop());
      toReturn.setThenExpression(stack.pop());
      toReturn.setTestExpression(stack.pop());
      stack.push(toReturn);
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsConditional

    return invocation;
  }

  private JsExpression mapConditional(Node condNode) throws JsParserException {
    JsConditional toCond = new JsConditional(makeSourceInfo(condNode));

    Node fromTest = condNode.getFirstChild();
    toCond.setTestExpression(mapExpression(fromTest));

    Node fromThen = fromTest.getNext();
    toCond.setThenExpression(mapExpression(fromThen));

    Node fromElse = fromThen.getNext();
    toCond.setElseExpression(mapExpression(fromElse));

    return toCond;
  }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsConditional

    @Override
    public void endVisit(JConditional x, Context ctx) {
      JsExpression elseExpr = (JsExpression) pop(); // elseExpr
      JsExpression thenExpr = (JsExpression) pop(); // thenExpr
      JsExpression ifTest = (JsExpression) pop(); // ifTest
      push(new JsConditional(x.getSourceInfo(), ifTest, thenExpr, elseExpr));
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsConditional

    // @Override
    public void endVisit(JConditional x, Context ctx) {
      JsExpression elseExpr = (JsExpression) pop(); // elseExpr
      JsExpression thenExpr = (JsExpression) pop(); // thenExpr
      JsExpression ifTest = (JsExpression) pop(); // ifTest
      push(new JsConditional(ifTest, thenExpr, elseExpr));
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsConditional

    @Override
    public void endVisit(JConditional x, Context ctx) {
      JsExpression elseExpr = (JsExpression) pop(); // elseExpr
      JsExpression thenExpr = (JsExpression) pop(); // thenExpr
      JsExpression ifTest = (JsExpression) pop(); // ifTest
      push(new JsConditional(x.getSourceInfo(), ifTest, thenExpr, elseExpr));
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsConditional

    return invocation;
  }

  private JsExpression mapConditional(Node condNode) throws JsParserException {
    JsConditional toCond = new JsConditional();

    Node fromTest = condNode.getFirstChild();
    toCond.setTestExpression(mapExpression(fromTest));

    Node fromThen = fromTest.getNext();
    toCond.setThenExpression(mapExpression(fromThen));

    Node fromElse = fromThen.getNext();
    toCond.setElseExpression(mapExpression(fromElse));

    return toCond;
  }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsConditional

    @Override
    public void endVisit(JConditional x, Context ctx) {
      JsExpression elseExpr = (JsExpression) pop(); // elseExpr
      JsExpression thenExpr = (JsExpression) pop(); // thenExpr
      JsExpression ifTest = (JsExpression) pop(); // ifTest
      push(new JsConditional(ifTest, thenExpr, elseExpr));
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsConditional

      stack.push(x);
    }

    @Override
    public void endVisit(JsConditional x, JsContext<JsExpression> ctx) {
      JsConditional toReturn = new JsConditional();
      toReturn.setElseExpression(stack.pop());
      toReturn.setThenExpression(stack.pop());
      toReturn.setTestExpression(stack.pop());
      stack.push(toReturn);
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsConditional

    return invocation;
  }

  private JsExpression mapConditional(Node condNode) throws JsParserException {
    JsConditional toCond = new JsConditional(makeSourceInfo(condNode));

    Node fromTest = condNode.getFirstChild();
    toCond.setTestExpression(mapExpression(fromTest));

    Node fromThen = fromTest.getNext();
    toCond.setThenExpression(mapExpression(fromThen));

    Node fromElse = fromThen.getNext();
    toCond.setElseExpression(mapExpression(fromElse));

    return toCond;
  }
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.