Skip to content

fix(transformer): preserve generated class binding spans#24220

Merged
graphite-app[bot] merged 1 commit into
mainfrom
codex/preserve-transformed-binding-spans
Jul 7, 2026
Merged

fix(transformer): preserve generated class binding spans#24220
graphite-app[bot] merged 1 commit into
mainfrom
codex/preserve-transformed-binding-spans

Conversation

@camc314

@camc314 camc314 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve outer and inner class binding spans during legacy decorator lowering
  • add a span-aware traversal binding generator for transformed source-backed bindings
  • update semantic coverage snapshots, removing stale Span { start: 0, end: 0 } mismatches

Copilot AI review requested due to automatic review settings July 6, 2026 12:10
@github-actions github-actions Bot added the A-transformer Area - Transformer / Transpiler label Jul 6, 2026

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 improves semantic span fidelity for bindings created during transformations, so transformed (lowered) constructs retain source-like spans and stop producing Span { start: 0, end: 0 } mismatches in semantic coverage snapshots.

Changes:

  • Add span-aware binding creation APIs to oxc_traverse (generate_spanned_binding / add_spanned_binding).
  • Use symbol-backed spans when generating binding patterns for TypeScript namespace lowering and legacy decorator class lowering.
  • Update semantic coverage snapshots to reflect the removed zero-span mismatches and improved pass counts.

Reviewed changes

Copilot reviewed 4 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tasks/coverage/snapshots/semantic_test262.snap Updates semantic snapshot after span-preservation fixes (+8 passing noted in PR).
tasks/coverage/snapshots/semantic_misc.snap Updates misc semantic snapshot after removing stale zero-span mismatches.
tasks/coverage/snapshots/semantic_babel.snap Updates Babel semantic snapshot reflecting span mismatch removals (+1 passing noted in PR).
crates/oxc_traverse/src/context/scoping.rs Introduces add_spanned_binding / generate_spanned_binding to create symbols/bindings with non-dummy spans.
crates/oxc_traverse/src/context/mod.rs Exposes TraverseCtx::generate_spanned_binding as a convenience wrapper.
crates/oxc_transformer/src/typescript/namespace.rs Uses symbol_span to generate a span-correct binding pattern for lowered namespace bindings.
crates/oxc_transformer/src/decorator/legacy/mod.rs Preserves class binding spans by generating spanned bindings/patterns during legacy decorator lowering.

@codspeed-hq

codspeed-hq Bot commented Jul 6, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 52 untouched benchmarks
⏩ 19 skipped benchmarks1


Comparing codex/preserve-transformed-binding-spans (5553efa) with main (335506b)

Open in CodSpeed

Footnotes

  1. 19 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 412066df1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/oxc_transformer/src/typescript/namespace.rs Outdated
Comment thread crates/oxc_transformer/src/decorator/legacy/mod.rs
@camc314
camc314 force-pushed the codex/preserve-transformed-binding-spans branch from 412066d to 39a65fb Compare July 6, 2026 12:16
@camc314
camc314 marked this pull request as draft July 6, 2026 12:27
@camc314 camc314 changed the title fix(transformer): preserve generated binding spans fix(transformer): preserve generated class binding spans Jul 6, 2026
@camc314
camc314 changed the base branch from main to graphite-base/24220 July 6, 2026 12:36
@camc314
camc314 force-pushed the graphite-base/24220 branch from 3ae8317 to a196867 Compare July 6, 2026 12:36
@camc314
camc314 force-pushed the codex/preserve-transformed-binding-spans branch from 39a65fb to 783dae8 Compare July 6, 2026 12:36
@camc314
camc314 changed the base branch from graphite-base/24220 to c/namespace-transformed-sym-span July 6, 2026 12:36

camc314 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 783dae8f0f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tasks/transform_conformance/snapshots/oxc_exec.snap.md Outdated
@camc314
camc314 force-pushed the codex/preserve-transformed-binding-spans branch 2 times, most recently from 0f0ea8d to b59430b Compare July 6, 2026 12:52
@camc314
camc314 force-pushed the c/namespace-transformed-sym-span branch from a196867 to 501c38d Compare July 6, 2026 12:52
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Jul 6, 2026 — with Graphite App
@graphite-app

graphite-app Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Merge activity

@graphite-app
graphite-app Bot force-pushed the c/namespace-transformed-sym-span branch from 501c38d to d3be3ad Compare July 6, 2026 13:24
@github-actions github-actions Bot added A-ast Area - AST A-codegen Area - Code Generation A-cfg Area - Control Flow Graph A-isolated-declarations Isolated Declarations A-formatter Area - Formatter A-regular-expression Area - Regular Expression A-linter-plugins Area - Linter JS plugins A-allocator Area - Allocator labels Jul 7, 2026
@camc314
camc314 force-pushed the codex/preserve-transformed-binding-spans branch from 9378b8f to 5553efa Compare July 7, 2026 06:37
@camc314 camc314 added 0-merge Merge with Graphite Merge Queue and removed A-linter Area - Linter A-parser Area - Parser A-cli Area - CLI A-minifier Area - Minifier A-ast Area - AST A-codegen Area - Code Generation A-cfg Area - Control Flow Graph A-isolated-declarations Isolated Declarations A-formatter Area - Formatter A-regular-expression Area - Regular Expression A-linter-plugins Area - Linter JS plugins A-allocator Area - Allocator A-semantic Area - Semantic labels Jul 7, 2026
## Summary

- preserve outer and inner class binding spans during legacy decorator lowering
- add a span-aware traversal binding generator for transformed source-backed bindings
- update semantic coverage snapshots, removing stale `Span { start: 0, end: 0 }` mismatches
@graphite-app
graphite-app Bot force-pushed the codex/preserve-transformed-binding-spans branch from 5553efa to c3057da Compare July 7, 2026 06:53
@graphite-app
graphite-app Bot merged commit c3057da into main Jul 7, 2026
30 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jul 7, 2026
@graphite-app
graphite-app Bot deleted the codex/preserve-transformed-binding-spans branch July 7, 2026 06:58
Boshen added a commit that referenced this pull request Jul 14, 2026
### 🚀 Features

- 616bfa2 minifier: Remove unreachable code after terminating statements
(#24441) (Dunqing)
- ddab89a data_structures: Add `likely` and `unlikely` functions
(#24368) (overlookmotel)
- a3a39f9 react_compiler: Implement enableEmitHookGuards codegen
(#24329) (Boshen)
- b79eef7 minifier: Apply De Morgan's law to negated comparison chains
in jump guards and loop tests (#24279) (Dunqing)
- 34ff7b4 minifier: Drop write-only property assignments to unused local
bindings by default (#24112) (Dunqing)
- 1b829d8 semantic: Record const enums in EnumData (#24268) (Dunqing)
- ba0944c semantic: Add `Scoping::set_symbol_span` (#24221) (camc314)

### 🐛 Bug Fixes

- 7d33363 minifier: Preserve guaranteed throws from class heritage
evaluation (#24349) (Dunqing)
- 058a62f semantic: Track ambient contexts in `SemanticBuilder` (#24327)
(camc314)
- 721eb0b transformer/decorator: Scope accessor class binding (#24330)
(camc314)
- 1ebdce3 semantic: Allow reserved keywords in ambient declaration types
(#24325) (camc314)
- 460176a track-memory-allocations: Exclude arena chunks from Sys allocs
(#24292) (Dunqing)
- af4922b transformer: Clear lowered namespace redeclarations (#24300)
(camc314)
- ffd2765 semantic: Mark declared computed `MethodDefinition`s as type
references (#24296) (camc314)
- f17514b isolated-declarations: Emit const readonly fields as types
(#24288) (camc314)
- 40f769d minifier: Make `__proto__` write tracking execution-order
independent (#24280) (Dunqing)
- 6371fed transformer: Remove stale enum member bindings (#24272)
(camc314)
- f05dfab transformer: Correct symbol flags for lowered namespaces
(#24271) (Dunqing)
- 84eeb55 transformer: Correct symbol flags for lowered enums (#24269)
(Dunqing)
- c3057da transformer: Preserve generated class binding spans (#24220)
(camc314)
- 8260096 transformer: Correct span for lowered namespace symbol
(#24222) (camc314)
- 42d00d3 semantic: Mark declared class heritage as type references
(#24237) (camc314)
- 588d997 semantic: Mark TS `PropertyDefinition`s computed fields as
type references (#24233) (camc314)
- 9b95632 semantic: Mark computed method keys in `TSMethodSignature`s as
type references (#24232) (camc314)

### ⚡ Performance

- 5b26643 transformer_plugins: Dispatch global defines by trailing name
(#23666) (Boshen)
- dce0f29 react_compiler: Replace all compiled functions in a single AST
walk (#24403) (Boshen)
- f85f0d8 ast: Delegate inherited enum variants in clone_in and estree
derives (#23555) (Boshen)
- 3ff0234 allocator: Remove `unwrap` from `ReplaceWith` (#24365)
(overlookmotel)
- ab22e80 transformer: Fix Rust 1.97 performance regression (#24354)
(camc314)
- b47585c parser: Use `ReplaceWith` instead of `TakeIn` (#24018)
(overlookmotel)
- b227a06 minifier: Use `ReplaceWith` instead of `TakeIn` (#24017)
(overlookmotel)

Co-authored-by: Boshen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-transformer Area - Transformer / Transpiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants