Ejemplo n.º 1
0
 private Expression constructUnaryIntExprMinus(
     final ILocation loc, final Expression expr, final CPrimitive type) {
   if (type.getGeneralType() == CPrimitiveCategory.INTTYPE) {
     return ExpressionFactory.newUnaryExpression(
         loc, UnaryExpression.Operator.ARITHNEGATIVE, expr);
   } else if (type.getGeneralType() == CPrimitiveCategory.FLOATTYPE) {
     // TODO: having boogie deal with negative real literals would be the nice solution..
     return ExpressionFactory.newBinaryExpression(
         loc, Operator.ARITHMINUS, new RealLiteral(loc, "0.0"), expr);
   } else {
     throw new IllegalArgumentException("unsupported " + type);
   }
 }