Skip to content

fix(minifier): allow argument rewrite with with leading var assignments - #28056

Merged
camc314 merged 1 commit into
oxc-project:mainfrom
armano2:fix/try_rewrite_arguments_copy_loop
Oct 21, 2026
Merged

camc314 merged 1 commit into
oxc-project:mainfrom
armano2:fix/try_rewrite_arguments_copy_loop

Conversation

@armano2

@armano2 armano2 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

allow rewrite of arguments loop with leading empty var assignments.

function _() { for (var keep, r = [], a = 0; a < arguments.length; a++) r[a] = arguments[a]; use(r, keep) }

function _() { var keep, r = [...arguments]; use(r, keep) }

@armano2
armano2 requested a review from Dunqing as a code owner October 21, 2026 22:24
@github-actions github-actions Bot added the A-minifier Area - Minification, compression and name mangling, oxc_minifier / oxc_mangler label Oct 21, 2026
Comment thread tasks/minsize/minsize.snap Resolved
@codspeed

codspeed Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 77 untouched benchmarks
⏩ 19 skipped benchmarks1


Comparing armano2:fix/try_rewrite_arguments_copy_loop (29c7f93) with main (4629bb2)

Open in CodSpeed

Footnotes

  1. 19 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@camc314
camc314 merged commit 09bdb80 into oxc-project:main Oct 21, 2026
@armano2
armano2 deleted the fix/try_rewrite_arguments_copy_loop branch October 21, 2026 22:50
Dunqing added a commit that referenced this pull request Oct 27, 2026
### 💥 BREAKING CHANGES

- cf8296f ecmascript: [**BREAKING**] Fold surrogate strings with JSStr
constants (#27098) (Dunqing)

### 🚀 Features

- dd6cb2b minifier: Fold out-of-bounds string indices to `void 0`
(#28004) (Dunqing)

### 🐛 Bug Fixes

- f4dac9e semantic: Separate hoisted vars from block type bindings
(#27936) (limadog9)
- 9ec6617 minifier: Keep brackets on negative and non-finite numeric
keys (#27855) (Yunus Ozen)
- 520a26e minifier: Keep the default in shorthand assignment targets
(#28183) (waltu)
- def47b8 react-compiler: Keep manual memoization as written when its
dependencies can't be honoured (#28101) (Dunqing)
- 704d8cf transformer_plugins: Keep the bare inject when references to
it remain (#26965) (Bharadwaj Pendyala)
- 6d7b372 minifier: Handle sequence exprs when folding if to expr
statement (#27939) (Armano)
- e3eca41 runtime: Align async iterator throw with Babel (#28059)
(camc314)
- af0258d parser: Parse source imports named type (#28062) (camc314)
- 83633a7 parser: Parse escaped class field names after initializers
(#28061) (camc314)
- 90c58ac parser: Parse postfix updates of sloppy `let` identifiers
(#28060) (camc314)
- 0e2934f codegen: Preserve default import names in source maps (#28058)
(camc314)
- 09bdb80 minifier: Allow argument rewrite with with leading var
assignments (#28056) (Armano)
- ebcdcd9 minifier: Preserve rest destructuring side effects (#27981)
(camc314)
- 5c84098 semantic,linter: Report names with lone surrogates in enum and
lint checks (#27991) (Dunqing)
- bd70a9b ecmascript: Use ECMAScript whitespace when folding
`parseFloat`/`parseInt`/`trim` (#27719) (Dunqing)
- 4c0fa90 minifier,linter: Keep `delete` of constant members and later
JSX keys (#27990) (Dunqing)

### ⚡ Performance

- 3493ce3 minifier: Reuse is_error_constructor and simplify
substitute_global_new_expression (#28149) (Armano)
- a22c9f2 parser: Move annotation comment handling out of hot paths
(#28139) (camc314)
- 1ed93af data_structures: Copy short strings without a memcpy call
(#27953) (leaysgur)

### 🛡️ Security

- b93e169 deps: Bump .node-version to 26.12.1 (#28090) (leaysgur)

Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minification, compression and name mangling, oxc_minifier / oxc_mangler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants