Skip to content

Commit 7bfa0c7

Browse files
committed
fix(compiler): unwrap ExportNamedDeclaration in var-region marking
The mark() helper in varInitialized only checked for bare VariableDeclaration nodes, but export var declarations are wrapped in ExportNamedDeclaration at module scope. This caused exported var bindings to be missing from varRegions, making varInitialized return false and maySettle incorrectly classify await on those bindings as zero-delay resumes.
1 parent 68e3064 commit 7bfa0c7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎packages/octane/src/compiler/strong-effects.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ export function createStrongEffectPolicy({ ast, analysis, callNames, report }) {
284284
if (varRegions === null) {
285285
varRegions = new Map();
286286
const mark = (declaration, start, end) => {
287+
if (
288+
declaration?.type === 'ExportNamedDeclaration' ||
289+
declaration?.type === 'ExportDefaultDeclaration'
290+
)
291+
declaration = declaration.declaration;
287292
if (declaration?.type !== 'VariableDeclaration' || declaration.kind !== 'var') return;
288293
for (const decl of declaration.declarations ?? []) {
289294
varRegions.set(decl, [start ?? decl.end, end]);

0 commit comments

Comments
 (0)