Skip to content

fix(parser): produce syntax error for ({}) = x when preserveParens:false#11263

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-24-fix_parser_produce_syntax_error_for_x_when_preserveparens_false_
May 24, 2025
Merged

fix(parser): produce syntax error for ({}) = x when preserveParens:false#11263
graphite-app[bot] merged 1 commit intomainfrom
05-24-fix_parser_produce_syntax_error_for_x_when_preserveparens_false_

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented May 24, 2025

closes #10899

Copilot AI review requested due to automatic review settings May 24, 2025 02:55
@github-actions github-actions bot added the A-parser Area - Parser label May 24, 2025
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 updates the parser to produce a syntax error when an object or array pattern is used as the left-hand side of an assignment and is parenthesized (e.g., "({}) = x;"). Key changes include capturing the parenthesized state and span of the left-hand side expression, propagating this information to the assignment expression parsing, and performing a new error check based on the captured span.

Comments suppressed due to low confidence (1)

crates/oxc_parser/src/js/expression.rs:1324

  • [nitpick] Consider using consistent naming for the parenthesized span variable. The variable 'lhs_parenthesized_span' is defined earlier but the function parameter is named 'left_parenthesized_span'.
left_parenthesized_span: Option<Span>,

@github-actions github-actions bot added the C-bug Category - Bug label May 24, 2025
Copy link
Member Author

Boshen commented May 24, 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.

@codspeed-hq
Copy link

codspeed-hq bot commented May 24, 2025

CodSpeed Instrumentation Performance Report

Merging #11263 will degrade performances by 13.1%

Comparing 05-24-fix_parser_produce_syntax_error_for_x_when_preserveparens_false_ (aa510cf) with main (f05c506)

Summary

❌ 1 regressions
✅ 37 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
mangler[cal.com.tsx] 3 ms 3.5 ms -13.1%

@graphite-app
Copy link
Contributor

graphite-app bot commented May 24, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 05-24-fix_parser_produce_syntax_error_for_x_when_preserveparens_false_ branch from 1c0ffb8 to aa510cf Compare May 24, 2025 03:03
@graphite-app graphite-app bot merged commit aa510cf into main May 24, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 05-24-fix_parser_produce_syntax_error_for_x_when_preserveparens_false_ branch May 24, 2025 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No error for invalid left-hand side in assignment when using preserveParens: false

2 participants