mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Special case check for this identifiers to skip exhaustive scope traversal (#58079)
This commit is contained in:
parent
69e7e57b15
commit
84eff8fa29
@ -8671,7 +8671,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return { introducesError, node };
|
||||
}
|
||||
const meaning = getMeaningOfEntityNameReference(node);
|
||||
const sym = resolveEntityName(leftmost, meaning, /*ignoreErrors*/ true, /*dontResolveAlias*/ true);
|
||||
let sym: Symbol | undefined;
|
||||
if (isThisIdentifier(leftmost)) {
|
||||
// `this` isn't a bindable identifier - skip resolution, find a relevant `this` symbol directly and avoid exhaustive scope traversal
|
||||
sym = getSymbolOfDeclaration(getThisContainer(leftmost, /*includeArrowFunctions*/ false, /*includeClassComputedPropertyName*/ false));
|
||||
if (isSymbolAccessible(sym, leftmost, meaning, /*shouldComputeAliasesToMakeVisible*/ false).accessibility !== SymbolAccessibility.Accessible) {
|
||||
introducesError = true;
|
||||
context.tracker.reportInaccessibleThisError();
|
||||
}
|
||||
return { introducesError, node: attachSymbolToLeftmostIdentifier(node) as T };
|
||||
}
|
||||
sym = resolveEntityName(leftmost, meaning, /*ignoreErrors*/ true, /*dontResolveAlias*/ true);
|
||||
if (sym) {
|
||||
// If a parameter is resolvable in the current context it is also visible, so no need to go to symbol accesibility
|
||||
if (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user