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
2026-10-11 23:56:06 +08:00
parent 548a4334c4
commit 6b460683d7
4 changed files with 35 additions and 3 deletions
@@ -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;