From bc777f4836560f4c226a11ba15b53f96892d18b2 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 11 Oct 2026 17:18:23 -0700 Subject: [PATCH] Shrink ValueSymbolLinks by 16 bytes --- tsc/internal/checker/checker.go | 4 ++-- tsc/internal/checker/types.go | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tsc/internal/checker/checker.go b/tsc/internal/checker/checker.go index 345ea00ce1437..b03cebf741b22 100644 --- a/tsc/internal/checker/checker.go +++ b/tsc/internal/checker/checker.go @@ -647,6 +647,7 @@ type Checker struct { iterationTypesCache map[IterationTypesKey]IterationTypes markerTypes collections.Set[*Type] resolvingExplicitTypeOfSymbol collections.Set[*ast.Symbol] + constructorOrFunctionChecked collections.Set[*ast.Symbol] undefinedSymbol *ast.Symbol argumentsSymbol *ast.Symbol requireSymbol *ast.Symbol @@ -3492,8 +3493,7 @@ func (c *Checker) checkFunctionOrMethodDeclaration(node *ast.Node) { func (c *Checker) checkFunctionOrConstructorSymbol(symbol *ast.Symbol) { // Only check the symbol once - if links := c.valueSymbolLinks.Get(symbol); !links.functionOrConstructorChecked { - links.functionOrConstructorChecked = true + if c.constructorOrFunctionChecked.AddIfAbsent(symbol) { c.checkFunctionOrConstructorSymbolWorker(symbol) } } diff --git a/tsc/internal/checker/types.go b/tsc/internal/checker/types.go index e2ec618a8caf2..7e4748930262c 100644 --- a/tsc/internal/checker/types.go +++ b/tsc/internal/checker/types.go @@ -180,13 +180,12 @@ type SymbolReferenceLinks struct { // Links for value symbols type ValueSymbolLinks struct { - resolvedType *Type // Type of value symbol - writeType *Type - target *ast.Symbol - mapper *TypeMapper - nameType *Type - containingType *Type // Mapped type for mapped type property, containing union or intersection type for synthetic property - functionOrConstructorChecked bool + resolvedType *Type // Type of value symbol + writeType *Type + target *ast.Symbol + mapper *TypeMapper + nameType *Type + containingType *Type // Mapped type for mapped type property, containing union or intersection type for synthetic property } // Additional links for mapped symbols