Skip to content

fix(estree): handle empty spans serializing ImportMeta and NewTarget#24775

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/07-21-fix_estree_handle_empty_spans_serializing_importmeta_and_newtarget_
Jul 22, 2026
Merged

fix(estree): handle empty spans serializing ImportMeta and NewTarget#24775
graphite-app[bot] merged 1 commit into
mainfrom
om/07-21-fix_estree_handle_empty_spans_serializing_importmeta_and_newtarget_

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Jul 21, 2026

Copy link
Copy Markdown
Member

Follow-on after #24557. Handle when ImportMeta / NewTarget has an empty span (SPAN). This code path is not exercised at present, but it seems a good idea to be prepared for when we may serialize AST after transformation.

@github-actions github-actions Bot added the A-ast Area - AST label Jul 21, 2026

overlookmotel commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

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 changes, fast-track this PR to the front of 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.

@overlookmotel
overlookmotel marked this pull request as ready for review July 21, 2026 19:46
Copilot AI review requested due to automatic review settings July 21, 2026 19:46
@overlookmotel
overlookmotel force-pushed the om/07-21-fix_estree_handle_empty_spans_serializing_importmeta_and_newtarget_ branch from c4284d7 to 35ae343 Compare July 21, 2026 19:47
@overlookmotel
overlookmotel requested a review from camc314 as a code owner July 21, 2026 19:47
@github-actions github-actions Bot added A-linter Area - Linter A-parser Area - Parser A-cli Area - CLI A-linter-plugins Area - Linter JS plugins labels Jul 21, 2026
@codspeed-hq

codspeed-hq Bot commented Jul 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 67 untouched benchmarks
⏩ 9 skipped benchmarks1


Comparing om/07-21-fix_estree_handle_empty_spans_serializing_importmeta_and_newtarget_ (6ab74a7) with main (b287f29)

Open in CodSpeed

Footnotes

  1. 9 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@graphite-app
graphite-app Bot changed the base branch from om/07-21-perf_estree_avoid_ident_hash_calculations_when_serializing to graphite-base/24775 July 21, 2026 19:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 hardens ESTree serialization/deserialization for the recently introduced ImportMeta and NewTarget AST nodes by correctly handling the “empty span” case (SPAN), which can occur when nodes are synthesized during transforms and later serialized.

Changes:

  • Update ESTree serialization of ImportMeta / NewTarget identifier subfields to avoid manufacturing non-empty spans when the node span is SPAN.
  • Update the associated raw_deser snippets to avoid deriving offsets from empty spans.
  • Import SPAN into the serializer module to enable explicit empty-span checks.

Comment thread crates/oxc_ast/src/serialize/js.rs Outdated
Comment thread crates/oxc_ast/src/serialize/js.rs
Comment thread crates/oxc_ast/src/serialize/js.rs
@graphite-app
graphite-app Bot force-pushed the graphite-base/24775 branch from 7d185b5 to b287f29 Compare July 21, 2026 19:53
@graphite-app
graphite-app Bot force-pushed the om/07-21-fix_estree_handle_empty_spans_serializing_importmeta_and_newtarget_ branch from 35ae343 to a18c4bc Compare July 21, 2026 19:53
@graphite-app
graphite-app Bot changed the base branch from graphite-base/24775 to main July 21, 2026 19:54
@graphite-app
graphite-app Bot force-pushed the om/07-21-fix_estree_handle_empty_spans_serializing_importmeta_and_newtarget_ branch from a18c4bc to fc31e79 Compare July 21, 2026 19:54
@overlookmotel
overlookmotel force-pushed the om/07-21-fix_estree_handle_empty_spans_serializing_importmeta_and_newtarget_ branch 2 times, most recently from 359519f to 6ab74a7 Compare July 21, 2026 20:09
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Jul 22, 2026

camc314 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Merge activity

…et` (#24775)

Follow-on after #24557. Handle when `ImportMeta` / `NewTarget` has an empty span (`SPAN`). This code path is not exercised at present, but it seems a good idea to be prepared for when we may serialize AST after transformation.
@graphite-app
graphite-app Bot force-pushed the om/07-21-fix_estree_handle_empty_spans_serializing_importmeta_and_newtarget_ branch from 6ab74a7 to e80574f Compare July 22, 2026 08:06
@graphite-app
graphite-app Bot merged commit e80574f into main Jul 22, 2026
30 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jul 22, 2026
@graphite-app
graphite-app Bot deleted the om/07-21-fix_estree_handle_empty_spans_serializing_importmeta_and_newtarget_ branch July 22, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins A-parser Area - Parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants