@Override public TernaryValue or(TernaryValue that) { return (TRUE.equals(that)) ? TRUE : UNKNOWN; }
@Override public TernaryValue or(TernaryValue that) { return (TRUE.equals(that)) ? TRUE : UNKNOWN; }
@Override public TernaryValue and(TernaryValue that) { return (FALSE.equals(that)) ? FALSE : UNKNOWN; }
@Override public TernaryValue and(TernaryValue that) { return (FALSE.equals(that)) ? FALSE : UNKNOWN; }
/** * Tests whether {@code this} and {@code that} are meaningfully * comparable. By meaningfully, we mean compatible types that do not lead * to step 22 of the definition of the Abstract Equality Comparison * Algorithm (11.9.3, page 55–56) of the ECMA-262 specification.<p> */ public final boolean canTestForEqualityWith(JSType that) { return testForEquality(that).equals(TernaryValue.UNKNOWN); }
@Override public TernaryValue testForEquality(JSType that) { TernaryValue result = null; for (JSType t : alternatesWithoutStucturalTyping) { TernaryValue test = t.testForEquality(that); if (result == null) { result = test; } else if (!result.equals(test)) { return UNKNOWN; } } return result; }
/** * Tests whether {@code this} and {@code that} are meaningfully * comparable. By meaningfully, we mean compatible types that do not lead * to step 22 of the definition of the Abstract Equality Comparison * Algorithm (11.9.3, page 55–56) of the ECMA-262 specification.<p> */ public final boolean canTestForEqualityWith(JSType that) { return testForEquality(that).equals(UNKNOWN); }
@Override public TernaryValue testForEquality(JSType that) { TernaryValue result = null; for (int i = 0; i < alternatesRetainingStructuralSubtypes.size(); i++) { JSType t = alternatesRetainingStructuralSubtypes.get(i); TernaryValue test = t.testForEquality(that); if (result == null) { result = test; } else if (!result.equals(test)) { return UNKNOWN; } } return result; }
@Override public TernaryValue testForEquality(JSType that) { if (UNKNOWN.equals(super.testForEquality(that))) { return UNKNOWN; } if (that.isSubtype(this) || that.isSubtype(getNativeType(JSTypeNative.NULL_TYPE))) { return TRUE; } return FALSE; }
@Override public TernaryValue testForEquality(JSType that) { if (UNKNOWN.equals(super.testForEquality(that))) { return UNKNOWN; } if (that.isSubtypeOf(this) || that.isSubtypeOf(getNativeType(JSTypeNative.NULL_TYPE))) { return TRUE; } return FALSE; }
n.getSecondChild()); TernaryValue falseValue = getImpureBooleanValue(n.getLastChild()); if (trueValue.equals(falseValue)) { return trueValue; } else {
n.getSecondChild()); TernaryValue falseValue = getImpureBooleanValue(n.getLastChild()); if (trueValue.equals(falseValue)) { return trueValue; } else {
return trueValue.equals(falseValue) ? trueValue : TernaryValue.UNKNOWN;