fix(transformer/optional-chaining): optional chaining expression isn't being transformed correctly when inside a double call expression#11179
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. |
4372c24 to
f5a19f6
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR addresses the bug where an optional chaining expression inside a double call expression wasn't transformed correctly. Key changes include:
- Adding the "transform-optional-chaining" plugin configuration in the test fixtures.
- Updating the expected output and input for the double call expression test case.
- Modifying the transformer logic in optional_chaining.rs to correctly handle the parenthesized expression in call expression scenarios.
- Updating the snapshot to reflect the new transformation output.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tasks/transform_conformance/tests/babel-plugin-transform-optional-chaining/test/fixtures/options.json | Adds plugin configuration for testing. |
| tasks/transform_conformance/tests/babel-plugin-transform-optional-chaining/test/fixtures/inside-double-call-expression/output.js | Updates transformed output for double call expressions. |
| tasks/transform_conformance/tests/babel-plugin-transform-optional-chaining/test/fixtures/inside-double-call-expression/input.js | Provides input cases with optional chaining expressions. |
| tasks/transform_conformance/snapshots/oxc.snap.md | Updates transformation snapshots. |
| crates/oxc_transformer/src/es2020/optional_chaining.rs | Adjusts transformation logic with an additional parenthesized expression check. |
Comments suppressed due to low confidence (1)
crates/oxc_transformer/src/es2020/optional_chaining.rs:343
- Consider adding a comment explaining why the is_parenthesized_expression check is required in this condition. This will help future maintainers understand the context behind this extra guard.
if ctx.parent().is_parenthesized_expression() && matches!(ctx.ancestor(1), Ancestor::CallExpressionCallee(_)) {
CodSpeed Instrumentation Performance ReportMerging #11179 will degrade performances by 12.05%Comparing Summary
Benchmarks breakdown
|
Merge activity
|
f5a19f6 to
907e114
Compare

close: #11141