From e4d3a9020e528974c8b58c1919e57accae5c48c9 Mon Sep 17 00:00:00 2001 From: G4mingJon4s <40526179+G4mingJon4s@users.noreply.github.com> Date: Sun, 9 Jul 2023 14:08:43 +0200 Subject: [PATCH] Fix static ram calculation when exports are renamed (#664) --- src/Script/RamCalculations.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Script/RamCalculations.ts b/src/Script/RamCalculations.ts index d3fe69a999..f16d715651 100644 --- a/src/Script/RamCalculations.ts +++ b/src/Script/RamCalculations.ts @@ -360,6 +360,18 @@ function parseOnlyCalculateDeps(code: string, currentModule: string): ParseDepsR const key = currentModule + "." + (node.id === null ? "__SPECIAL_DEFAULT_EXPORT__" : node.id.name); walk.recursive(node, { key: key }, commonVisitors()); }, + ExportNamedDeclaration: (node: Node, st: State, walkDeeper: walk.WalkerCallback) => { + if (node.declaration !== null) { + // if this is true, the statement is not a named export, but rather a exported function/variable + walkDeeper(node.declaration, st); + return; + } + const specifiers = node.specifiers; + + for (const specifier of specifiers) { + addRef(st.key, specifier.local.name); + } + }, }, commonVisitors(), ),