Skip to content

fix(codegen): print space before BindingRestElement in ObjectPattern#15315

Merged
graphite-app[bot] merged 1 commit intomainfrom
09-15-fix_codegen_print_space_before_bindingrestelement_in_objectpattern_
Nov 5, 2025
Merged

fix(codegen): print space before BindingRestElement in ObjectPattern#15315
graphite-app[bot] merged 1 commit intomainfrom
09-15-fix_codegen_print_space_before_bindingrestelement_in_objectpattern_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Nov 5, 2025

Previously we didn't print a space before ... in object destructuring. e.g.:

const o = { x,...rest };

Fix that (noticed in output of raw transfer codegen).

@github-actions github-actions bot added A-codegen Area - Code Generation C-bug Category - Bug labels Nov 5, 2025
Copy link
Member Author

overlookmotel commented Nov 5, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@overlookmotel overlookmotel marked this pull request as ready for review November 5, 2025 12:02
Copilot AI review requested due to automatic review settings November 5, 2025 12:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-hq
Copy link

codspeed-hq bot commented Nov 5, 2025

CodSpeed Performance Report

Merging #15315 will not alter performance

Comparing 09-15-fix_codegen_print_space_before_bindingrestelement_in_objectpattern_ (557836d) with main (977a6a0)

Summary

✅ 37 untouched

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Nov 5, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 5, 2025

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).
@graphite-app graphite-app bot force-pushed the 09-15-fix_codegen_print_space_before_bindingrestelement_in_objectpattern_ branch from 557836d to 020aa4f Compare November 5, 2025 12:09
@graphite-app graphite-app bot merged commit 020aa4f into main Nov 5, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 09-15-fix_codegen_print_space_before_bindingrestelement_in_objectpattern_ branch November 5, 2025 12:15
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments