fix(parser): parse new (import("x")) with preserveParens: false#11251
Conversation
There was a problem hiding this comment.
Pull Request Overview
The PR fixes the parsing behavior for new (import("x")) by ensuring that an error is only generated for the dynamic import used directly with the new operator when preserveParens: false is enabled.
- Introduces a new boolean flag to detect the import keyword before parsing.
- Adjusts the error-checking condition to incorporate the new flag.
Comments suppressed due to low confidence (1)
crates/oxc_parser/src/js/expression.rs:894
- Consider adding unit or conformance tests to verify the behavior of dynamic imports with the new operator both with and without parentheses.
if is_import && matches!(callee, Expression::ImportExpression(_)) {
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. |
CodSpeed Instrumentation Performance ReportMerging #11251 will not alter performanceComparing Summary
|
Merge activity
|
0e15be1 to
dcdcf12
Compare

fixes #11183
No unit tests added, I will enable
preserveParens: falseinthe conformance test in the near future.