fix(minifier): keep argument spread side effects against empty functions#13401
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the minifier where spread arguments with side effects were incorrectly removed when calling empty functions. The fix ensures that spread arguments are preserved because they can throw errors during iteration, even when the target function is empty.
- Refactored argument handling to use a shared function that properly preserves spread arguments
- Updated test cases to verify that spread arguments are correctly preserved as array literals
- Made
fold_arguments_into_needed_expressionsfunction public for reuse
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| remove_unused_expression.rs | Made fold_arguments_into_needed_expressions function public and removed unnecessary blank line |
| remove_dead_code.rs | Replaced inline argument processing with shared function call and updated test expectations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #13401 will not alter performanceComparing Summary
Footnotes |
Merge activity
|
…ons (#13401) The spread arguments has sideeffects and has to be kept. ```js const foo = { [Symbol.iterator]() { throw new Error() } } function bar() {} bar(...foo) // throws ```
d4fdba9 to
3e902a0
Compare

The spread arguments has sideeffects and has to be kept.