public static VarType getCommonMinType(VarType type1, VarType type2) { if (type1.type == CodeConstants.TYPE_BOOLEAN && type2.type == CodeConstants.TYPE_BOOLEAN) { // special case booleans return type1.isFalseBoolean() ? type2 : type1; } if (type1.isSuperset(type2)) { return type2; } else if (type2.isSuperset(type1)) { return type1; } else if (type1.typeFamily == type2.typeFamily) { switch (type1.typeFamily) { case CodeConstants.TYPE_FAMILY_INTEGER: if ((type1.type == CodeConstants.TYPE_CHAR && type2.type == CodeConstants.TYPE_SHORT) || (type1.type == CodeConstants.TYPE_SHORT && type2.type == CodeConstants.TYPE_CHAR)) { return VARTYPE_SHORTCHAR; } else { return VARTYPE_BYTECHAR; } case CodeConstants.TYPE_FAMILY_OBJECT: return VARTYPE_NULL; } } return null; }
public static VarType getCommonSupertype(VarType type1, VarType type2) { if (type1.type == CodeConstants.TYPE_BOOLEAN && type2.type == CodeConstants.TYPE_BOOLEAN) { // special case booleans return type1.isFalseBoolean() ? type1 : type2; } if (type1.isSuperset(type2)) { return type1; } else if (type2.isSuperset(type1)) { return type2; } else if (type1.typeFamily == type2.typeFamily) { switch (type1.typeFamily) { case CodeConstants.TYPE_FAMILY_INTEGER: if ((type1.type == CodeConstants.TYPE_SHORTCHAR && type2.type == CodeConstants.TYPE_BYTE) || (type1.type == CodeConstants.TYPE_BYTE && type2.type == CodeConstants.TYPE_SHORTCHAR)) { return VARTYPE_SHORT; } else { return VARTYPE_INT; } case CodeConstants.TYPE_FAMILY_OBJECT: return VARTYPE_OBJECT; } } return null; }
type1.isFalseBoolean() || (param1.type == Exprent.EXPRENT_CONST && !((ConstExprent)param1).hasBooleanValue()); boolean param2_false_boolean = type1.isFalseBoolean() || (param2.type == Exprent.EXPRENT_CONST && !((ConstExprent)param2).hasBooleanValue());
public static VarType getCommonSupertype(VarType type1, VarType type2) { if (type1.type == CodeConstants.TYPE_BOOLEAN && type2.type == CodeConstants.TYPE_BOOLEAN) { // special case booleans return type1.isFalseBoolean() ? type1 : type2; } if (type1.isSuperset(type2)) { return type1; } else if (type2.isSuperset(type1)) { return type2; } else if (type1.typeFamily == type2.typeFamily) { switch (type1.typeFamily) { case CodeConstants.TYPE_FAMILY_INTEGER: if ((type1.type == CodeConstants.TYPE_SHORTCHAR && type2.type == CodeConstants.TYPE_BYTE) || (type1.type == CodeConstants.TYPE_BYTE && type2.type == CodeConstants.TYPE_SHORTCHAR)) { return VARTYPE_SHORT; } else { return VARTYPE_INT; } case CodeConstants.TYPE_FAMILY_OBJECT: return VARTYPE_OBJECT; } } return null; }
public static VarType getCommonMinType(VarType type1, VarType type2) { if (type1.type == CodeConstants.TYPE_BOOLEAN && type2.type == CodeConstants.TYPE_BOOLEAN) { // special case booleans return type1.isFalseBoolean() ? type2 : type1; } if (type1.isSuperset(type2)) { return type2; } else if (type2.isSuperset(type1)) { return type1; } else if (type1.typeFamily == type2.typeFamily) { switch (type1.typeFamily) { case CodeConstants.TYPE_FAMILY_INTEGER: if ((type1.type == CodeConstants.TYPE_CHAR && type2.type == CodeConstants.TYPE_SHORT) || (type1.type == CodeConstants.TYPE_SHORT && type2.type == CodeConstants.TYPE_CHAR)) { return VARTYPE_SHORTCHAR; } else { return VARTYPE_BYTECHAR; } case CodeConstants.TYPE_FAMILY_OBJECT: return VARTYPE_NULL; } } return null; }
type1.isFalseBoolean() || (param1.type == Exprent.EXPRENT_CONST && !((ConstExprent)param1).hasBooleanValue()); boolean param2_false_boolean = type1.isFalseBoolean() || (param2.type == Exprent.EXPRENT_CONST && !((ConstExprent)param2).hasBooleanValue());