fix(es/minifier): preserve argument aliases in nested scopes#12037
fix(es/minifier): preserve argument aliases in nested scopes#12037cyphercodes wants to merge 1 commit into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
|
|
|
This would not be enough. In inline pass swc would change ident ctxt(to avoid name collision) which would result in non exist scope data. |
Merging this PR will not alter performance
Comparing Footnotes
|
Description:
Assignments to a function parameter can occur inside a nested closure. The unused-assignment optimizer was checking
argumentsusage in that nested scope, which allowed it to remove the assignment even when the parameter is aliased by the outer non-strict function'sargumentsobject.This changes the lookup to use the parameter's declaring syntax context and adds a regression fixture for the nested-assignment case.
Verification:
cargo test -p swc_ecma_minifier --test compress 12032 -- --nocapturecargo test -p swc_ecma_minifier(2,128 passed, 1 ignored)cargo clippy -p swc_ecma_minifier --all-targets -- -D warningscargo fmt --all -- --check2in both cases)Fixes #12032
BREAKING CHANGE:
None.
Related issue (if exists):
#12032