fix(minifier): preserve var inside catch with same-named parameter#21366
Merged
graphite-app[bot] merged 1 commit intomainfrom Apr 15, 2026
Merged
fix(minifier): preserve var inside catch with same-named parameter#21366graphite-app[bot] merged 1 commit intomainfrom
var inside catch with same-named parameter#21366graphite-app[bot] merged 1 commit intomainfrom
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
gthb
reviewed
Apr 13, 2026
sapphi-red
approved these changes
Apr 14, 2026
Member
Merge activity
|
#21366) ## Summary - Block inlining of `var` declarators whose symbol has the `CatchVariable` flag, preventing loss of function-scoped hoisting - Check `symbol_redeclarations` before removing catch parameters, preventing semantic changes when the catch body contains a `var` redeclaration - Uses existing semantic data (`CatchVariable` flag and `symbol_redeclarations`) instead of manual AST walks Closes #17307 ## Test plan - [x] `cargo test -p oxc_minifier` — 476 tests pass - [x] Verified minified output matches original JS semantics via `node` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
6c0448b to
b0e8f13
Compare
Dunqing
added a commit
that referenced
this pull request
Apr 16, 2026
### 💥 BREAKING CHANGES - 24fb7eb allocator: [**BREAKING**] Rename `Box` and `Vec` methods (#21395) (overlookmotel) ### 🚀 Features - ce5072d parser: Support `turbopack` magic comments (#20803) (Kane Wang) - f5deb55 napi/transform: Expose `optimizeConstEnums` and `optimizeEnums` options (#21388) (Dunqing) - 24b03de data_structures: Introduce `NonNullConst` and `NonNullMut` pointer types (#21425) (overlookmotel) ### 🐛 Bug Fixes - d7a359a ecmascript: Treat update expressions as unconditionally side-effectful (#21456) (Dunqing) - 56af2f4 transformer/async-to-generator: Correct scope of inferred named FE in async-to-generator (#21458) (Dunqing) - b3ed467 minifier: Avoid illegal `var;` when folding unused arguments copy loop (#21421) (fazba) - b0e8f13 minifier: Preserve `var` inside `catch` with same-named parameter (#21366) (Dunqing) - 4fb73a7 transformer/typescript: Preserve execution order for accessor with `useDefineForClassFields: false` (#21369) (Dunqing) ### ⚡ Performance - da3cc16 parser: Refactor out `LexerContext` (#21275) (Ulrich Stark) ### 📚 Documentation - c5b19bb allocator: Reformat comments in `Arena` (#21448) (overlookmotel) - 091e88e lexer: Update doc comment about perf benefit of reading through references (#21423) (overlookmotel) - 922cbee allocator: Remove references to "bump" from comments (#21397) (overlookmotel) Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vardeclarators whose symbol has theCatchVariableflag, preventing loss of function-scoped hoistingsymbol_redeclarationsbefore removing catch parameters, preventing semantic changes when the catch body contains avarredeclarationCatchVariableflag andsymbol_redeclarations) instead of manual AST walksCloses #17307
Test plan
cargo test -p oxc_minifier— 476 tests passnode🤖 Generated with Claude Code