class DisambiguateProperties {
/**
* Invalidates the given type, so that no properties on it will be renamed.
*/
private void addInvalidatingType(JSType type) {
type = type.restrictByNotNullOrUndefined();
if (type instanceof UnionType) {
for (JSType alt : ((UnionType) type).getAlternates()) {
addInvalidatingType(alt);
}
return;
}
typeSystem.addInvalidatingType(type);
ObjectType objType = ObjectType.cast(type);
if (objType != null && objType.getImplicitPrototype() != null) {
typeSystem.addInvalidatingType(objType.getImplicitPrototype());
}
}
}
class DisambiguateProperties.TypeSystem {
/**
* Informs the given type system that a type is invalidating due to a type
* mismatch found during type checking.
*/
void addInvalidatingType(JSType type);
}
class DisambiguateProperties.JSTypeSystem {
@Override public void addInvalidatingType(JSType type) {
checkState(!type.isUnionType());
invalidatingTypes.add(type);
}
}
class DisambiguateProperties.ConcreteTypeSystem {
@Override public void addInvalidatingType(JSType type) {
checkState(!type.isUnionType());
invalidatingTypes.add(type);
}
}
|