Skip to content

feat(codegen): print label names from scoping - #29613

Merged
graphite-app[bot] merged 1 commit into
mainfrom
c/codegen-label-names
Nov 16, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
c/codegen-label-names

Conversation

@camc314

@camc314 camc314 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

When codegen is given Scoping, it prints a label's name from scoping.label_name(label_id) instead of LabelIdentifier::name. This matches how identifier renaming already works, so the mangler can rename labels without rewriting the AST.

Labels without a LabelId print unchanged. That covers ASTs that skipped semantic analysis, and break or continue labels that don't resolve to an enclosing label.

Source maps record the original name for a renamed label, as they do for renamed identifiers. For example, outer: { break outer; } printed as e:{break e} maps both labels back to outer.

camc314 commented Nov 15, 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.

@github-actions github-actions Bot added the A-codegen Area - JS/TS code printing and source maps, oxc_codegen label Nov 15, 2026
@codspeed

codspeed Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 86 untouched benchmarks
⏩ 24 skipped benchmarks1


Comparing c/codegen-label-names (2c97e70) with c/semantic-label-ids (80fdd05)

Open in CodSpeed

Footnotes

  1. 24 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. ↩

@camc314
camc314 force-pushed the c/semantic-label-ids branch from 5d99b63 to 4ee8486 Compare November 15, 2026 20:46
@camc314
camc314 force-pushed the c/codegen-label-names branch 2 times, most recently from 087c7ba to e8f44f7 Compare November 15, 2026 20:53
@camc314
camc314 force-pushed the c/semantic-label-ids branch from 4ee8486 to 3c1e128 Compare November 15, 2026 20:53
@camc314
camc314 force-pushed the c/codegen-label-names branch from e8f44f7 to be81cd2 Compare November 15, 2026 20:56
@camc314
camc314 force-pushed the c/semantic-label-ids branch from 3c1e128 to 91659d4 Compare November 15, 2026 20:56
@camc314
camc314 marked this pull request as ready for review November 15, 2026 21:05
@camc314
camc314 requested a review from Dunqing as a code owner November 15, 2026 21:05
Copilot AI balanced review requested due to automatic review settings November 15, 2026 21:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T21:15:04.574475Z 2c97e70 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@camc314
camc314 force-pushed the c/semantic-label-ids branch from 91659d4 to 80fdd05 Compare November 15, 2026 21:12
@camc314
camc314 force-pushed the c/codegen-label-names branch from be81cd2 to 2c97e70 Compare November 15, 2026 21:12
@graphite-app graphite-app Bot added the 0-merge Merge with Graphite Merge Queue label Nov 16, 2026
@graphite-app

graphite-app Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Merge activity

When codegen is given `Scoping`, it prints a label's name from `scoping.label_name(label_id)` instead of `LabelIdentifier::name`. This matches how identifier renaming already works, so the mangler can rename labels without rewriting the AST.

Labels without a `LabelId` print unchanged. That covers ASTs that skipped semantic analysis, and `break` or `continue` labels that don't resolve to an enclosing label.

Source maps record the original name for a renamed label, as they do for renamed identifiers. For example, `outer: { break outer; }` printed as `e:{break e}` maps both labels back to `outer`.
@graphite-app
graphite-app Bot force-pushed the c/semantic-label-ids branch from 80fdd05 to 750033a Compare November 16, 2026 06:11
@graphite-app
graphite-app Bot force-pushed the c/codegen-label-names branch from 2c97e70 to 702e734 Compare November 16, 2026 06:11
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Nov 16, 2026
Base automatically changed from c/semantic-label-ids to main November 16, 2026 06:14
@graphite-app
graphite-app Bot merged commit 702e734 into main Nov 16, 2026
33 checks passed
@graphite-app
graphite-app Bot deleted the c/codegen-label-names branch November 16, 2026 06:15
graphite-app Bot pushed a commit that referenced this pull request Nov 16, 2026
### 💥 BREAKING CHANGES

- d742f8b ast: [**BREAKING**] Add `LabelId` to `LabelIdentifier` (#29611) (camc314)

### 🚀 Features

- 63b8158 minifier: Inline single use function declaration to assignment (#28917) (Aadharsh  Pannirselvam)
- eb1833e mangler: Mangle labels (#29614) (camc314)
- 702e734 codegen: Print label names from scoping (#29613) (camc314)
- 750033a semantic: Resolve labels to label IDs (#29612) (camc314)
- ccca379 minifier: Remove unused labels (#29607) (camc314)
- e375dff lexer: Complete NEON support for aarch64 (#29390) (Shanon Jackson)
- bfe9a81 data_structures: Add buffered vector batch reservations (#29365) (Boshen)
- fa492d6 minifier: Merge adjacent switch cases with identical bodies (#29316) (camc314)
- 8cc6101 minifier: Inline member reads into callees as indirect calls (#29305) (camc314)
- e3d7d91 minifier: Inline member reads into `new` expressions (#29304) (camc314)
- 57211d0 minifier: Inline member reads into call arguments (#29303) (camc314)
- 523a063 lexer: Publish lexer and SIMD crates (#29264) (Boshen)
- 2a5d710 data_structures: Add `unreachable_unchecked!` macro (#29131) (overlookmotel)
- 061becc react-compiler: Support logical assignment operators (#29137) (Yagiz Nizipli)

### 🐛 Bug Fixes

- d520358 transformer: Retain decorated fields with define semantics (#29444) (Dunqing)
- 83fb644 lexer: Combine surrogate pairs written with any escape form (#29658) (Shanon Jackson)
- f8e329c transformer: Preserve optional calls on private field chains (#29443) (Dunqing)
- 4b86eba react-compiler: Do not report hoisted function declaration initializer as access before declaration (#29641) (Boshen)
- 7e41638 parser: Keep whole parenthesized `TSInstantiationExpression` with `preserve_parens: false` (#29359) (leaysgur)
- 5aa6c17 napi/parser: Release native parse result eagerly (#29569) (Boshen)
- 1dc0ee9 semantic: Preserve catch and var binding identities (#28739) (Dunqing)
- 11dbaf4 ecmascript: Prefer hex integers when lengths tie (#29436) (camc314)
- e64155e transformer/react-refresh: Recognize TypeScript wrappers in HOC arguments (#29290) (camc314)
- 9085be1 react-compiler: Only report zero-argument new Date in render body (#29419) (Boshen)
- 9f465fd react-compiler: Preserve ref mutation hints (#28553) (Nash Aschenbath)
- 075b74f lexer: Do not drop UTF-8 validation errors in TSX type arguments (#29409) (overlookmotel)
- 59cbbbf lexer: Fix source length assertion (#29408) (overlookmotel)
- f37f271 react-compiler: Resolve computed dependencies in merged memo scopes (#29376) (camc314)
- ab73590 parser: Preserve re-exported default import names in raw transfer (#29234) (camc314)
- 6e6bd61 react-compiler: Avoid invariants for catch phis and ref-free callbacks (#29018) (camc314)
- 19b1691 isolated-declarations: Retain types used by exported ambient variables (#28996) (camc314)
- b372b04 transformer/optional-chaining: Preserve parenthesized chain boundaries (#29218) (camc314)
- efcdf06 transformer: Isolate logical assignment temporaries in parameters (#29182) (Dunqing)
- 177fdd7 parser: Classify re-exported namespaces as indirect exports (#29196) (Boshen)
- 053cc40 parser: Preserve type-only flags on re-exported imports (#29195) (Boshen)
- 34172e0 data_structures: Fix `assert_unchecked!` macro (#29130) (overlookmotel)
- b515929 transformer: Lower wrapped assignments and preserve computed receivers (#29113) (camc314)
- 59aed23 parser: Highlight invalid numeric separators (#29117) (camc314)
- 8f5e82c parser: Reject exponentiation operands hidden by assertions (#29115) (camc314)
- 42e790c parser: Require `declare` before `abstract` modifiers (#29111) (camc314)

### ⚡ Performance

- dd9af34 parser: Make parser and lexer checkpoints `Copy` (#29662) (Boshen)
- 4ebe523 parser: Keep the tokens read while classifying `()` and `(x)` arrows (#29560) (Boshen)
- 7a6b0a4 parser: Lex the token after `let` and `?.` once (#29559) (Boshen)
- bd9fa9b parser: Lex the token after a modifier keyword once (#29558) (Boshen)
- 2c6ee72 parser: Skip arrow speculation for array and object literals (#29557) (Boshen)
- 85c0269 parser: Rule out type arguments from tokens before speculating (#29556) (Boshen)
- b6edb78 parser: Avoid token loop restart after newlines (#29423) (Boshen)
- 762bbcf lexer: Cut NEON lexing cost in carve, coalesce and compress (#29414) (Shanon Jackson)
- f09af45 lexer: Keep source position in registers across byte handlers (#29401) (Boshen)
- ae1a375 lexer: Complete single-byte tokens without a byte handler (#29400) (Boshen)
- 11daf98 lexer: Build tokens once from pending state (#29399) (Boshen)
- c49e1bd str: Hash identifiers without branching on length (#29397) (Boshen)
- 8a6e0c1 lexer: Borrow contiguous escaped string values (#29372) (Boshen)
- 27baf0c lexer: Buffer more comments before arena allocation (#29371) (Boshen)
- baa84fc lexer: Size escaped strings before allocating (#29369) (Boshen)
- 4313dee parser: Buffer module record entries (#29368) (Boshen)
- 2df1f19 parser: Reduce regex, template, and comment allocations (#29361) (Boshen)
- f26d9d9 parser: Reduce arena allocations and reallocations (#29358) (Boshen)
- 846adbb mangler: Skip a liveness walk that never marks a scope (#29391) (Dunqing)
- 0d2e41a parser: Reduce identifier dispatch overhead (#29347) (Boshen)
- 1aaf3b0 parser: Reuse pure re-export storage (#29216) (Boshen)
- 9add80d parser: Buffer decorator and heritage lists (#29215) (Boshen)
- cb5cf55 parser: Collect prefixed import lists once (#29214) (Boshen)
- ec6b166 parser: Omit discarded recovered parentheses (#29213) (Boshen)
- 01e2b66 parser: Avoid discarded TypeScript instantiations (#29210) (Boshen)
- 727610a parser: Collect short named import lists (#29209) (Boshen)
- d1eaed0 parser: Collect short template literal lists (#29208) (Boshen)
- 0301b92 parser: Reserve module record batches (#29207) (Boshen)
- 9734804 parser: Collect short switch consequent lists (#29206) (Boshen)
- 6674b7a parser: Collect short JSX child lists (#29205) (Boshen)
- cc03246 parser: Collect short binding pattern lists (#29204) (Boshen)
- e36dd2d parser: Avoid discarded cover parameter allocations (#29203) (Boshen)
- 2d5864c parser: Collect short sequence expression lists (#29202) (Boshen)
- 6495e66 parser: Avoid discarded block allocations (#29199) (Boshen)
- 2601c45 parser: Collect short formal parameter lists (#29198) (Boshen)
- 10fddc3 parser: Collect short TypeScript type lists (#29197) (Boshen)
- 4140fb0 parser: Keep class heritage on the stack (#29190) (Boshen)
- e028d74 parser: Collect short statement lists before allocating (#29189) (Boshen)
- 69c7892 parser: Collect short declaration lists before allocating (#29188) (Boshen)
- aed0190 parser: Skip unused identifier hashes (#29168) (Boshen)
- 2c0a6c1 parser: Avoid allocating discarded directive statements (#29186) (Boshen)
- 48532bb parser: Buffer remaining parser lists (#29185) (Boshen)
- e59d413 parser: Reuse export entry storage (#29172) (Boshen)
- f815f54 parser: Reduce arena list reallocations (#29169) (Boshen)

### 📚 Documentation

- 9e5a2bb agents: Require runnable playground reproductions in PRs (#29450) (Dunqing)
- c4d1024 minifier: Require examples in fix and optimization PRs (#29439) (Dunqing)
- 43e0829 parser: Fix grammar context formatting (#29373) (camc314)
- 3e947d7 napi/parser: Correct TS-ESTree differences (#29268) (fisker Cheung)
- 521d194 transformer: Require reproductions in fix PR descriptions (#29224) (Dunqing)
- 24c4b78 simd: Improve comment (#29244) (overlookmotel)
- 306b96a lexer: Correct safety comment on `TokensView::new` (#29231) (overlookmotel)
- 44c65f0 lexer: Add comments (#29226) (overlookmotel)
- 796255d simd: Use consistent formatting for bullet points in doc comments (#29133) (overlookmotel)
- 794cf47 isolated-declarations: Add agent guide (#29125) (camc314)
- 768cc29 parser: Clarify syntax support and AST preservation (#29121) (camc314)
- 67ecd8c estree: Correct serialization capabilities (#29120) (camc314)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - JS/TS code printing and source maps, oxc_codegen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants