Skip to content

Commit 46e0ba8

Browse files
committed
Remove old (and insufficient) instantiation caching
1 parent 413176b commit 46e0ba8

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3882,18 +3882,7 @@ module ts {
38823882
}
38833883

38843884
function instantiateAnonymousType(type: ObjectType, mapper: TypeMapper): ObjectType {
3885-
// If this type has already been instantiated using this mapper, returned the cached result. This guards against
3886-
// infinite instantiations of cyclic types, e.g. "var x: { a: T, b: typeof x };"
3887-
if (mapper.mappings) {
3888-
let cached = <ObjectType>mapper.mappings[type.id];
3889-
if (cached) {
3890-
return cached;
3891-
}
3892-
}
3893-
else {
3894-
mapper.mappings = {};
3895-
}
3896-
// Instantiate the given type using the given mapper and cache the result
3885+
// Mark the anonymous type as instantiated such that our infinite instantiation detection logic can recognize it
38973886
let result = <ResolvedType>createObjectType(TypeFlags.Anonymous | TypeFlags.Instantiated, type.symbol);
38983887
result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol);
38993888
result.members = createSymbolTable(result.properties);
@@ -3903,7 +3892,6 @@ module ts {
39033892
let numberIndexType = getIndexTypeOfType(type, IndexKind.Number);
39043893
if (stringIndexType) result.stringIndexType = instantiateType(stringIndexType, mapper);
39053894
if (numberIndexType) result.numberIndexType = instantiateType(numberIndexType, mapper);
3906-
mapper.mappings[type.id] = result;
39073895
return result;
39083896
}
39093897

src/compiler/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,6 @@ module ts {
17301730
/* @internal */
17311731
export interface TypeMapper {
17321732
(t: TypeParameter): Type;
1733-
mappings?: Map<Type>; // Type mapping cache
17341733
}
17351734

17361735
/* @internal */

0 commit comments

Comments
 (0)