fix(javascript): respect hoisted fresh function declarations

Function declarations provide fresh targets before their textual position. Retain initialization-order checks for variable and class values, including aliases. Cover the reviewed regression with source controls and the public CLI/MCP fixture.
This commit is contained in:
morluto committed 2026-10-11 23:56:06 +08:00
1 parent 548a4334c4
commit 6b460683d7
4 files changed
+35 -3

No files matched your search

@@ -187,7 +187,8 @@ export const createSemanticModuleInterop = (
if (
binding === undefined ||
initializer === undefined ||
(initializer.end ?? Infinity) >= (current.start ?? -1) ||
(!t.isFunctionDeclaration(initializer) &&
(initializer.end ?? Infinity) >= (current.start ?? -1)) ||
visited.has(binding.bindingId)
)
return false;