Remove unused configuration for InvalidatingTypes
@@ -40,13 +40,10 @@ public final class InvalidatingTypes {
/** Whether to allow types like 'str'.toString() */
private final boolean allowScalars;
- private final boolean allowObjectLiteralTypes;
-
private InvalidatingTypes(Builder builder, ImmutableSet<JSType> types) {
this.types = types;
this.allowEnums = builder.allowEnums;
this.allowScalars = builder.allowScalars;
- this.allowObjectLiteralTypes = builder.allowObjectLiteralTypes;
}
public boolean isInvalidating(JSType type) {
@@ -81,10 +78,6 @@ public final class InvalidatingTypes {
}
private boolean isInvalidatingDueToAmbiguity(ObjectType type) {
- if (this.allowObjectLiteralTypes && type.isLiteralObject()) {
- return false;
- }
-
return type.isAmbiguousObject();
}
@@ -96,8 +89,6 @@ public final class InvalidatingTypes {
private final LinkedHashSet<TypeMismatch> mismatches = new LinkedHashSet<>();
private boolean allowEnums = false;
private boolean allowScalars = false;
- private boolean allowGlobalThis = true;
- private boolean allowObjectLiteralTypes = false;
// TODO(b/160269908): Investigate making this always false, instead of always true.
private final boolean alsoInvalidateRelatedTypes = true;
@@ -119,10 +110,6 @@ public final class InvalidatingTypes {
registry.getNativeType(JSTypeNative.OBJECT_PROTOTYPE),
registry.getNativeType(JSTypeNative.OBJECT_FUNCTION_TYPE));
- if (!this.allowGlobalThis) {
- types.add(registry.getNativeType(JSTypeNative.GLOBAL_THIS));
- }
-
for (TypeMismatch mismatch : this.mismatches) {
this.addTypeWithReason(mismatch.getFound(), mismatch.getLocation());
this.addTypeWithReason(mismatch.getRequired(), mismatch.getLocation());
@@ -147,25 +134,11 @@ public final class InvalidatingTypes {
return this;
}
- public Builder disallowGlobalThis() {
- /**
- * Disambiguate does not invalidate global this because it sets skipping explicitly for extern
- * properties only on the extern types.
- */
- this.allowGlobalThis = false;
- return this;
- }
-
public Builder addAllTypeMismatches(Iterable<TypeMismatch> mismatches) {
mismatches.forEach(this.mismatches::add);
return this;
}
- public Builder setAllowObjectLiteralTypes(boolean x) {
- this.allowObjectLiteralTypes = x;
- return this;
- }
-
/** Invalidates the given type, so that no properties on it will be inlined or renamed. */
private void addTypeWithReason(JSType type, Node location) {
type = type.restrictByNotNullOrUndefined();
