From cc3836911f405b245881533471a311bb2cffab10 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 9 Nov 2021 00:35:10 +0000 Subject: [PATCH] Switch to Set of Symbols in extractSymbol. --- src/services/refactors/extractSymbol.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 6490fde5387..6b9d7221579 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1597,7 +1597,7 @@ namespace ts.refactor.extractSymbol { const functionErrorsPerScope: Diagnostic[][] = []; const constantErrorsPerScope: Diagnostic[][] = []; const visibleDeclarationsInExtractedRange: NamedDeclaration[] = []; - const exposedVariableSymbolSet = new Map(); // Key is symbol ID + const exposedVariableSymbolSet = new Set(); // Key is symbol ID const exposedVariableDeclarations: VariableDeclaration[] = []; let firstExposedNonVariableDeclaration: NamedDeclaration | undefined; @@ -1903,10 +1903,10 @@ namespace ts.refactor.extractSymbol { const decl = find(visibleDeclarationsInExtractedRange, d => d.symbol === sym); if (decl) { if (isVariableDeclaration(decl)) { - const idString = decl.symbol.id!.toString(); - if (!exposedVariableSymbolSet.has(idString)) { + const declSymbol = decl.symbol; + if (!exposedVariableSymbolSet.has(declSymbol)) { exposedVariableDeclarations.push(decl); - exposedVariableSymbolSet.set(idString, true); + exposedVariableSymbolSet.add(declSymbol); } } else {