in src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java [353:438]
public CheckTypesResult checkExprTypeBounds() {
CheckTypesResult result = new CheckTypesResult();
Exprent param1 = lstOperands.get(0);
VarType type1 = param1.getExprType();
Exprent param2 = null;
VarType type2 = null;
if (lstOperands.size() > 1) {
param2 = lstOperands.get(1);
type2 = param2.getExprType();
}
switch (funcType) {
case FUNCTION_IIF:
VarType supertype = getExprType();
result.addMinTypeExprent(param1, VarType.VARTYPE_BOOLEAN);
result.addMinTypeExprent(param2, VarType.getMinTypeInFamily(supertype.getTypeFamily()));
result.addMinTypeExprent(lstOperands.get(2), VarType.getMinTypeInFamily(supertype.getTypeFamily()));
break;
case FUNCTION_I2L:
case FUNCTION_I2F:
case FUNCTION_I2D:
case FUNCTION_I2B:
case FUNCTION_I2C:
case FUNCTION_I2S:
result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
result.addMaxTypeExprent(param1, VarType.VARTYPE_INT);
break;
case FUNCTION_IMM:
case FUNCTION_IPP:
case FUNCTION_MMI:
case FUNCTION_PPI:
result.addMinTypeExprent(param1, implicitType);
result.addMaxTypeExprent(param1, implicitType);
break;
case FUNCTION_ADD:
case FUNCTION_SUB:
case FUNCTION_MUL:
case FUNCTION_DIV:
case FUNCTION_REM:
case FUNCTION_SHL:
case FUNCTION_SHR:
case FUNCTION_USHR:
case FUNCTION_LT:
case FUNCTION_GE:
case FUNCTION_GT:
case FUNCTION_LE:
result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR);
case FUNCTION_BIT_NOT:
// case FUNCTION_BOOL_NOT:
case FUNCTION_NEG:
result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
break;
case FUNCTION_AND:
case FUNCTION_OR:
case FUNCTION_XOR:
case FUNCTION_EQ:
case FUNCTION_NE: {
if (type1.getType() == CodeConstants.TYPE_BOOLEAN) {
if (type2 != null && type2.isStrictSuperset(type1)) {
result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
}
else { // both are booleans
boolean param1_false_boolean =
type1.isFalseBoolean() || (param1.type == Exprent.EXPRENT_CONST && !((ConstExprent)param1).hasBooleanValue());
boolean param2_false_boolean =
type1.isFalseBoolean() ||
(param2 != null && param2.type == Exprent.EXPRENT_CONST && !((ConstExprent)param2).hasBooleanValue());
if (param1_false_boolean || param2_false_boolean) {
result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR);
}
}
}
else if (type2 != null && type2.getType() == CodeConstants.TYPE_BOOLEAN) {
if (type1.isStrictSuperset(type2)) {
result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR);
}
}
}
}
return result;
}