Examples of JExpression


Examples of com.google.gwt.dev.jjs.ast.JExpression

      }
    }

    @Override
    public void endVisit(JCastOperation x, Context ctx) {
      JExpression updated = simplifier.cast(x, x.getSourceInfo(),
          x.getCastType(), x.getExpr());
      if (updated != x) {
        ctx.replaceMe(updated);
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JExpression

      // previously set currentClass = null;
    }

    @Override
    public void endVisit(JConditional x, Context ctx) {
      JExpression updated = simplifier.conditional(x, x.getSourceInfo(),
          x.getType(), x.getIfTest(), x.getThenExpr(), x.getElseExpr());
      if (updated != x) {
        ctx.replaceMe(updated);
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JExpression

    /**
     * Convert do { } while (false); into a block.
     */
    @Override
    public void endVisit(JDoStatement x, Context ctx) {
      JExpression expression = x.getTestExpr();
      if (expression instanceof JBooleanLiteral) {
        JBooleanLiteral booleanLiteral = (JBooleanLiteral) expression;

        // If false, replace do with do's body
        if (!booleanLiteral.getValue()) {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JExpression

       */
      // We can inline the constant, but we might also need to evaluate an
      // instance and run a clinit.
      JMultiExpression multi = new JMultiExpression(x.getSourceInfo());

      JExpression instance = x.getInstance();
      if (instance != null) {
        multi.exprs.add(instance);
      }

      JMethodCall clinit = maybeCreateClinitCall(x);
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JExpression

    /**
     * Prune for (X; false; Y) statements, but make sure X is run.
     */
    @Override
    public void endVisit(JForStatement x, Context ctx) {
      JExpression expression = x.getTestExpr();
      if (expression instanceof JBooleanLiteral) {
        JBooleanLiteral booleanLiteral = (JBooleanLiteral) expression;

        // If false, replace the for statement with its initializers
        if (!booleanLiteral.getValue()) {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JExpression

        ignoringExpressionOutput.remove(x.getInstance());
      }

      int paramCount = target.getParams().size();
      for (int i = paramCount; i < x.getArgs().size(); ++i) {
        JExpression arg = x.getArgs().get(i);
        ignoringExpressionOutput.remove(arg);
        if (!arg.hasSideEffects()) {
          x.removeArg(i--);
          didChange = true;
        }
      }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JExpression

        List<JExpression> nonFinalChildren = exprs.subList(0, exprs.size() - 1);
        ignoringExpressionOutput.removeAll(nonFinalChildren);
      }

      for (int i = 0; i < numRemovableExpressions(x); ++i) {
        JExpression expr = x.exprs.get(i);
        if (!expr.hasSideEffects()) {
          x.exprs.remove(i);
          --i;
          didChange = true;
          continue;
        }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JExpression

        if (evalOpOnLiteral(x.getOp(), (JValueLiteral) x.getArg(), ctx)) {
          return;
        }
      }
      if (x.getOp() == JUnaryOperator.NOT) {
        JExpression updated = simplifier.not(x, x.getSourceInfo(), x.getArg());
        if (updated != x) {
          ctx.replaceMe(updated);
        }
        return;
      } else if (x.getOp() == JUnaryOperator.NEG) {
        JExpression updated = simplifyNegate(x, x.getArg());
        if (updated != x) {
          ctx.replaceMe(updated);
        }
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JExpression

    /**
     * Prune while (false) statements.
     */
    @Override
    public void endVisit(JWhileStatement x, Context ctx) {
      JExpression expression = x.getTestExpr();
      if (expression instanceof JBooleanLiteral) {
        JBooleanLiteral booleanLiteral = (JBooleanLiteral) expression;

        // If false, prune the while statement
        if (!booleanLiteral.getValue()) {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JExpression

  }

  @Override
  public boolean hasSideEffects() {
    for (int i = 0; i < exprs.size(); ++i) {
      JExpression expr = exprs.get(i);
      if (expr.hasSideEffects()) {
        return true;
      }
    }
    return false;
  }
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.