Skip to content

Commit 2aa5bfe

Browse files
committed
get rid of caching only for resolver functions
1 parent 68021c1 commit 2aa5bfe

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/compiler/checker.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -43035,7 +43035,7 @@ namespace ts {
4303543035
// declaration, we need to start resolution at the declaration's container.
4303643036
// Otherwise, we could incorrectly resolve the export container as the
4303743037
// declaration if it contains an exported member with the same name.
43038-
let symbol = getReferencedValueSymbol(node, /*startInDeclarationContainer*/ isNameOfModuleOrEnumDeclaration(node));
43038+
let symbol = getReferencedValueSymbol(node, /*startInDeclarationContainer*/ isNameOfModuleOrEnumDeclaration(node), /*useCache*/ false); // >> change here
4303943039
if (symbol) {
4304043040
if (symbol.flags & SymbolFlags.ExportValue) {
4304143041
// If we reference an exported entity within the same module declaration, then whether
@@ -43070,7 +43070,7 @@ namespace ts {
4307043070
}
4307143071
const node = getParseTreeNode(nodeIn, isIdentifier);
4307243072
if (node) {
43073-
const symbol = getReferencedValueSymbol(node); // >> Change it here
43073+
const symbol = getReferencedValueSymbol(node, /*startInDeclarationContainer*/ undefined, /*useCache*/ false); // >> Change it here
4307443074
// We should only get the declaration of an alias if there isn't a local value
4307543075
// declaration for the symbol
4307643076
if (isNonLocalAlias(symbol, /*excludes*/ SymbolFlags.Value) && !getTypeOnlyAliasDeclaration(symbol)) { // >> Probably use the default excludes now
@@ -43455,11 +43455,13 @@ namespace ts {
4345543455
return globals.has(escapeLeadingUnderscores(name));
4345643456
}
4345743457

43458-
function getReferencedValueSymbol(reference: Identifier, startInDeclarationContainer?: boolean): Symbol | undefined {
43459-
// const resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
43460-
// if (resolvedSymbol) {
43461-
// return resolvedSymbol;
43462-
// }
43458+
function getReferencedValueSymbol(reference: Identifier, startInDeclarationContainer?: boolean, useCache = true): Symbol | undefined { // TODO: if we change this to return any kind of symbol, then rename it
43459+
if (useCache) {
43460+
const resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
43461+
if (resolvedSymbol) {
43462+
return resolvedSymbol;
43463+
}
43464+
}
4346343465

4346443466
let location: Node = reference;
4346543467
if (startInDeclarationContainer) {

0 commit comments

Comments
 (0)