From 1fd0fa16cbe0a9a5e221754da4a885e236754463 Mon Sep 17 00:00:00 2001 From: runem Date: Tue, 14 Jul 2020 20:08:35 +0200 Subject: [PATCH] Fix problem where some declarations would get cache-invalidated incorrectly --- src/analyze/stages/analyze-declaration.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/analyze/stages/analyze-declaration.ts b/src/analyze/stages/analyze-declaration.ts index b63a918d..c04934a4 100644 --- a/src/analyze/stages/analyze-declaration.ts +++ b/src/analyze/stages/analyze-declaration.ts @@ -1,4 +1,4 @@ -import { Node } from "typescript"; +import { Node, Path } from "typescript"; import { AnalyzerVisitContext } from "../analyzer-visit-context"; import { AnalyzerDeclarationVisitContext, ComponentFeatureCollection } from "../flavors/analyzer-flavor"; import { ComponentDeclaration } from "../types/component-declaration"; @@ -173,6 +173,7 @@ function shouldInvalidateCachedDeclaration(componentDeclaration: ComponentDeclar // By doing "node.getSourceFile()" we get an possible updated source file reference. // Therefore this is a nested WeakMap looking up SourceFile and then the Node const node = heritageClause.declaration.node; + context.program.getSourceFileByPath(node.getSourceFile().fileName as Path); const sourceFile = node.getSourceFile(); const foundInCache = context.cache.componentDeclarationInSourceFile.get(sourceFile)?.has(node) ?? false;