refactor(lexer): group coalesce pipeline stage code into directory - #26305
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
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. |
There was a problem hiding this comment.
🔵 Needs a closer look
The refactor widens internal symbol visibility (pub) in the coalesce stage in ways that don’t match existing pipeline conventions and could unintentionally expand the reachable API surface later.
Pull request overview
This PR refactors the lexer pipeline by regrouping the coalesce stage implementation into a dedicated coalesce/ module directory, mirroring the earlier classify stage refactor approach and applying similar “house style” organization changes.
Changes:
- Move
coalescestage code intopipeline/coalesce/with a newmod.rsentry point. - Relocate
kw_verify_batch/KWBkeyword verification code intopipeline/coalesce/keywords.rsand update imports accordingly. - Apply minor structural/style re-ordering in the moved code (imports grouped, helpers moved lower, etc.).
File summaries
| File | Description |
|---|---|
| crates/oxc_lexer/src/pipeline/mod.rs | Updates stage wiring/imports to pull KWB from the coalesce module instead of the old keywords module. |
| crates/oxc_lexer/src/pipeline/coalesce/mod.rs | New coalesce stage module entry point; hosts the stage logic and pulls keyword verification from a local submodule. |
| crates/oxc_lexer/src/pipeline/coalesce/keywords.rs | Keyword verification implementation moved under coalesce/; adjusts paths and visibility for the new module structure. |
Review details
Suppressed comments (3)
crates/oxc_lexer/src/pipeline/coalesce/keywords.rs:15
kw_verify_batchis only called from the parentcoalescemodule; making itpubis broader than necessary. Usepub(super)so the function remains accessible tocoalesce/mod.rswithout expanding visibility further.
crates/oxc_lexer/src/pipeline/coalesce/mod.rs:18coalescestage symbols are declaredpub, which widens visibility beyond the parentpipelinemodule. Other pipeline stage entry points/helpers consistently usepub(super)(e.g.compress.rs:128,find.rs:680,regex_div.rs:1512), which keeps the surface area minimal and avoids accidental API exposure if module visibility changes later.
crates/oxc_lexer/src/pipeline/coalesce/keywords.rs:5KWBis only used by the coalesce stage / parent pipeline; it doesn’t need to be fullypub. Narrowing it topub(super)keeps the internal API surface consistent with other pipeline helpers.
This issue also appears on line 15 of the same file.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Untrue. Nothing is exported outside of the relevant modules. |

Pure refactor. No code changes, just moving code around.
Move all code for
coalescepipeline stage into a directory together.coalesce/mod.rscontains same code ascoalesce.rsdid previously.keyword.rsmoves into the same directory, sincekw_verify_batchis only used incoalescestage.Additionally, apply the same kinds of stylistic changes as #26303.