コード例 #1
0
  protected IRExpression compile_impl() {
    IType type = _expr().getType();

    // Push LHS (parser guarantees type is int or long)
    IRExpression lhs = ExpressionTransformer.compile(_expr().getLHS(), _cc());

    // Push RHS (parser guarantees type is int)
    IRExpression rhs = ExpressionTransformer.compile(_expr().getRHS(), _cc());

    // Do the bitshift
    IRArithmeticExpression.Operation op;
    if (_expr().getOperator().equals("<<") || _expr().getOperator().equals("<<=")) {
      op = IRArithmeticExpression.Operation.ShiftLeft;
    } else if (_expr().getOperator().equals(">>") || _expr().getOperator().equals(">>=")) {
      op = IRArithmeticExpression.Operation.ShiftRight;
    } else if (_expr().getOperator().equals(">>>") || _expr().getOperator().equals(">>>=")) {
      op = IRArithmeticExpression.Operation.UnsignedShiftRight;
    } else {
      throw new IllegalStateException(
          "Unrecognized BitshiftExpression operator " + _expr().getOperator());
    }

    if (isIntType(type) || type == JavaTypes.pLONG()) {
      return new IRArithmeticExpression(getDescriptor(type), lhs, rhs, op);
    } else {
      throw new IllegalStateException("Expression type not handled: " + type.getName());
    }
  }
コード例 #2
0
  protected IRExpression compile_impl() {
    IRExpression lhs =
        IRArgConverter.castOrConvertIfNecessary(
            IRTypeConstants.pBOOLEAN(), ExpressionTransformer.compile(_expr().getLHS(), _cc()));
    IRExpression rhs =
        IRArgConverter.castOrConvertIfNecessary(
            IRTypeConstants.pBOOLEAN(), ExpressionTransformer.compile(_expr().getRHS(), _cc()));

    return new IRConditionalOrExpression(lhs, rhs);
  }
コード例 #3
0
  protected IRExpression compile_impl() {
    // Push LHS (parser guarantees type is int or long)
    IRExpression lhs = ExpressionTransformer.compile(_expr().getLHS(), _cc());

    // Push RHS (parser guarantees type is int)
    IRExpression rhs = ExpressionTransformer.compile(_expr().getRHS(), _cc());

    verifyTypes();

    return new IRArithmeticExpression(getDescriptor(_expr().getType()), lhs, rhs, getOp());
  }
コード例 #4
0
 protected IRExpression compile_impl() {
   IRExpression typeArg = pushType(_expr().getType());
   IRExpression idValueArg = ExpressionTransformer.compile(_expr().getArgs()[0], _cc());
   idValueArg = boxValue(_expr().getArgs()[0].getType(), idValueArg);
   return checkCast(
       _expr().getType(),
       callStaticMethod(
           ObjectLiteralExpressionTransformer.class,
           "getObjectFromTypeAndId",
           new Class[] {IType.class, Object.class},
           exprList(typeArg, idValueArg)));
 }