Skip to content

Commit

Permalink
Track symbols per type thats cached and dont keep adding to them (#56421
Browse files Browse the repository at this point in the history
)

Co-authored-by: Jake Bailey <[email protected]>
  • Loading branch information
sheetalkamat and jakebailey authored Nov 16, 2023
1 parent 29bb857 commit cf5d710
Show file tree
Hide file tree
Showing 5 changed files with 2,652 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6949,6 +6949,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
context.symbolDepth!.set(id, depth + 1);
}
context.visitedTypes.add(typeId);
const prevTrackedSymbols = context.trackedSymbols;
context.trackedSymbols = undefined;
const startLength = context.approximateLength;
const result = transform(type);
const addedLength = context.approximateLength - startLength;
Expand All @@ -6964,6 +6966,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (id) {
context.symbolDepth!.set(id, depth!);
}
context.trackedSymbols = prevTrackedSymbols;
return result;

function deepCloneOrReuseNode<T extends Node>(node: T): T {
Expand Down
Loading

0 comments on commit cf5d710

Please sign in to comment.