Latest Results
fix(es/renamer): Avoid duplicate mangled names across eval scope boundaries (#11913)
**Description:**
`mangle` produces colliding identifiers when `eval` is present in a
function, which breaks the program at runtime.
When `eval` exists, the renamer can't mangle the whole program at once:
it builds the top-level map first, renames eval-free nested functions
per-unit, and applies the top-level map last. Each `get_map` call built
its mangle map with a fresh `ReverseMap`, so a per-unit map for a nested
function could reuse a Base54 name already assigned by the top-level
map.
This becomes observable together with the compressor's scalar
replacement, which rewrites `var x = { p: [] }; x.p.push(...)` into a
synthetic `var x_p = []; x_p.push(...)`. The synthetic binding isn't
covered by the `eval` bypass, so it lands in the top-level map and
collides with the names chosen independently for an eval-free callback.
I considered fixing this in the compressor (skipping scalar replacement
when `eval` is in scope), but that trades away an optimization and has a
wider regression surface. Instead the fix is in the renamer: the rename
pass records the names assigned by the top-level map and feeds them as
reserved symbols to the per-unit maps, so their encoders skip names
already in use. The reserved set is only populated on the `eval` path,
so non-eval programs are unaffected.
Verified with two `exec` (runtime) tests that run compress + mangle
together and compare stdout — the base repro and a nested-callback
variant. Both fail without the fix (the collided output throws at
runtime) and pass with it.
**Related issue:**
Closes #11294 Latest Branches
0%
baltasarblanco:fix/11294-mangler-eval-duplicate-idents 0%
0%
parkhojeong:docs/fix-architecture-fixer-link © 2026 CodSpeed Technology