refactor(parser): make Token fields private#10936
Conversation
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.
Pull Request Overview
This PR refactors the parser module by making all Token fields private and replacing direct field accesses with accessor methods. Key changes include modifying Token field accesses in lexer, template, string, regex, and other modules; updating related tests; and enforcing internal encapsulation for Token.
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_parser/src/lexer/trivia_builder.rs | Accessor replacements for token.kind and token.start |
| crates/oxc_parser/src/lexer/token.rs | Token fields made private and new getters/setters added |
| Other lexer files (template, string, regex, etc.) | Updates to use the new accessor methods consistently |
| crates/oxc_parser/src/js/* and crates/oxc_parser/src/cursor.rs | Adjustments to token field accesses using the new methods |
Comments suppressed due to low confidence (1)
crates/oxc_parser/src/lexer/token.rs:93
- Consider verifying that reducing the visibility of the 'has_separator' accessor to crate level does not negatively impact any external modules or tests that previously relied on public access to this field.
pub(crate) fn has_separator(&self) -> bool {
CodSpeed Instrumentation Performance ReportMerging #10936 will not alter performanceComparing Summary
|
Merge activity
|
The goal of this PR is to reduce the diff for #10933
c3fa7fe to
b526da9
Compare

The goal of this PR is to reduce the diff for #10933