File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7312,7 +7312,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
73127312 // It'd likely be better to store this somewhere else for isSymbolAccessible, but
73137313 // since that API _only_ uses the enclosing declaration (and its parents), this is
73147314 // seems like the best way to inject names into that search process.
7315- const existingFakeScope = findAncestor(context.enclosingDeclaration, node => !!getNodeLinks(node).fakeScopeForSignatureDeclaration);
7315+ //
7316+ // Note that we only check the most immediate enclosingDeclaration; the only place we
7317+ // could potentially add another fake scope into the chain is right here, so we don't
7318+ // traverse all ancestors.
7319+ const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : undefined;
73167320 Debug.assertOptionalNode(existingFakeScope, isBlock);
73177321
73187322 const locals = existingFakeScope?.locals ?? createSymbolTable();
@@ -8074,7 +8078,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
80748078 }
80758079
80768080 function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration: Node) {
8077- return findAncestor(enclosingDeclaration, n => ! getNodeLinks(n ).fakeScopeForSignatureDeclaration) ;
8081+ return getNodeLinks(enclosingDeclaration ).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration ;
80788082 }
80798083
80808084 /**
You can’t perform that action at this time.
0 commit comments