fix(codegen): print space before BindingRestElement in ObjectPattern#15315
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 spacing issues in code generation for rest elements in destructuring patterns. The change ensures that a space is added before rest elements (...) when they follow other properties in object destructuring patterns.
- Adds a soft space before rest elements in object destructuring to improve readability
- Includes test cases to verify correct formatting for both array and object destructuring with rest elements
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_codegen/src/gen.rs | Adds print_soft_space() call before printing rest element in object patterns to ensure proper spacing |
| crates/oxc_codegen/tests/integration/js.rs | Adds test cases for array and object destructuring with rest elements to verify correct output formatting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #15315 will not alter performanceComparing Summary
|
Merge activity
|
…rn` (#15315) Previously we didn't print a space before `...` in object destructuring. e.g.: ```js const o = { x,...rest }; ``` Fix that (noticed in output of raw transfer codegen).
557836d to
020aa4f
Compare

Previously we didn't print a space before
...in object destructuring. e.g.:Fix that (noticed in output of raw transfer codegen).