File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -7312,7 +7312,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
7312
7312
// It'd likely be better to store this somewhere else for isSymbolAccessible, but
7313
7313
// since that API _only_ uses the enclosing declaration (and its parents), this is
7314
7314
// 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;
7316
7320
Debug.assertOptionalNode(existingFakeScope, isBlock);
7317
7321
7318
7322
const locals = existingFakeScope?.locals ?? createSymbolTable();
@@ -8074,7 +8078,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
8074
8078
}
8075
8079
8076
8080
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration: Node) {
8077
- return findAncestor(enclosingDeclaration, n => ! getNodeLinks(n ).fakeScopeForSignatureDeclaration) ;
8081
+ return getNodeLinks(enclosingDeclaration ).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration ;
8078
8082
}
8079
8083
8080
8084
/**
You can’t perform that action at this time.
0 commit comments