From d5c292179895cc4c73be818ea8198776c1b9a3ab Mon Sep 17 00:00:00 2001 From: tsjs-language-eng Date: Mon, 23 Oct 2023 10:31:56 -0700 Subject: [PATCH] Don't include weak requires in the summary, if there's already a strong require for the same symbol. PiperOrigin-RevId: 575860298 --- src/summary.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/summary.ts b/src/summary.ts index 2aac383b1..ffbff10fb 100644 --- a/src/summary.ts +++ b/src/summary.ts @@ -81,7 +81,12 @@ export class FileSummary { } get weakRequires(): Symbol[] { - return [...this.weakRequireSet.values()]; + const weakRequires = []; + for (const [k, v] of this.weakRequireSet.entries()) { + if (this.strongRequireSet.has(k)) continue; + weakRequires.push(v); + } + return weakRequires; } addDynamicRequire(dynamicRequire: Symbol) {