Examples of JPrefixOperation


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

    return false;
  }

  @Override
  public boolean visit(JPrefixOperation x, Context ctx) {
    expression = new JPrefixOperation(program, x.getSourceInfo(), x.getOp(),
        cloneExpression(x.getArg()));
    return false;
  }
View Full Code Here

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

    return false;
  }

  @Override
  public boolean visit(JPrefixOperation x, Context ctx) {
    expression = new JPrefixOperation(x.getSourceInfo(), x.getOp(), cloneExpression(x.getArg()));
    return false;
  }
View Full Code Here

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

            original.getSourceInfo(), original.getType(), JBinaryOperator.OR,
            condExpr, elseExpr);
        return binOp;
      } else {
        // e.g. (cond ? false : else) -> !cond && else
        JPrefixOperation notCondExpr = new JPrefixOperation(program,
            condExpr.getSourceInfo(), JUnaryOperator.NOT, condExpr);
        JBinaryOperation binOp = new JBinaryOperation(program,
            original.getSourceInfo(), original.getType(), JBinaryOperator.AND,
            notCondExpr, elseExpr);
        return binOp;
      }
    } else if (elseExpr instanceof JBooleanLiteral) {
      if (((JBooleanLiteral) elseExpr).getValue()) {
        // e.g. (cond ? then : true) -> !cond || then
        JPrefixOperation notCondExpr = new JPrefixOperation(program,
            condExpr.getSourceInfo(), JUnaryOperator.NOT, condExpr);
        JBinaryOperation binOp = new JBinaryOperation(program,
            original.getSourceInfo(), original.getType(), JBinaryOperator.OR,
            notCondExpr, thenExpr);
        return binOp;
View Full Code Here

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

            argOp.getRhs());
        return newBinOp;
      }
    } else if (arg instanceof JPrefixOperation) {
      // try to invert the unary operator
      JPrefixOperation argOp = (JPrefixOperation) arg;
      JUnaryOperator op = argOp.getOp();
      // e.g. !!x -> x
      if (op == JUnaryOperator.NOT) {
        return argOp.getArg();
      }
    }

    // no simplification made
    if (original != null) {
      return original;
    }
    return new JPrefixOperation(program, arg.getSourceInfo(),
        JUnaryOperator.NOT, arg);
  }
View Full Code Here

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

    public void endVisit(JPostfixOperation x, Context ctx) {
      if (x.getOp().isModifying()) {
        lvalues.remove(x.getArg());
      }
      if (ignoringExpressionOutput.contains(x)) {
        JPrefixOperation newOp = new JPrefixOperation(program,
            x.getSourceInfo(), x.getOp(), x.getArg());
        ctx.replaceMe(newOp);
      }
    }
View Full Code Here

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

     */
    private void simplifyBooleanEq(JExpression exp, boolean bool, Context ctx) {
      if (bool) {
        ctx.replaceMe(exp);
      } else {
        ctx.replaceMe(new JPrefixOperation(program, exp.getSourceInfo(),
            JUnaryOperator.NOT, exp));
      }
    }
View Full Code Here

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

     * @return A simplified expression equivalent to <code>- exp</code>.
     */
    private JExpression simplifyNegate(JExpression original, JExpression exp) {
      // - -x -> x
      if (exp instanceof JPrefixOperation) {
        JPrefixOperation prefarg = (JPrefixOperation) exp;
        if (prefarg.getOp() == JUnaryOperator.NEG) {
          return prefarg.getArg();
        }
      }

      // no change
      if (original != null) {
        return original;
      }
      return new JPrefixOperation(program, exp.getSourceInfo(),
          JUnaryOperator.NEG, exp);
    }
View Full Code Here

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

      return false;
    }

    private void simplifyXor(JExpression lhs, JBooleanLiteral rhs, Context ctx) {
      if (rhs.getValue()) {
        ctx.replaceMe(new JPrefixOperation(program, lhs.getSourceInfo(),
            JUnaryOperator.NOT, lhs));
      } else {
        ctx.replaceMe(lhs);
      }
    }
View Full Code Here

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

    return false;
  }

  @Override
  public boolean visit(JPrefixOperation x, Context ctx) {
    expression = new JPrefixOperation(program, x.getSourceInfo(), x.getOp(),
        cloneExpression(x.getArg()));
    return false;
  }
View Full Code Here

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

          JExpression condition =
              new JBinaryOperation(info, JPrimitiveType.BOOLEAN, JBinaryOperator.LT, new JLocalRef(
                  info, indexVar), new JLocalRef(info, maxVar));

          // ++i$index
          JExpression increments = new JPrefixOperation(info, JUnaryOperator.INC,
              new JLocalRef(info, indexVar));

          // T elementVar = i$array[i$index];
          elementDecl.initializer =
              new JArrayRef(info, new JLocalRef(info, arrayVar), new JLocalRef(info, indexVar));
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.