Skip to content

refactor(parser): make Token fields private#10936

Merged
graphite-app[bot] merged 1 commit intomainfrom
token-api
May 11, 2025
Merged

refactor(parser): make Token fields private#10936
graphite-app[bot] merged 1 commit intomainfrom
token-api

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented May 11, 2025

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

Copilot AI review requested due to automatic review settings May 11, 2025 03:34
@github-actions github-actions bot added A-parser Area - Parser C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels May 11, 2025
Copy link
Member Author

Boshen commented May 11, 2025


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 hot fixes, skip the queue and merge this PR next

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.

Copy link
Contributor

Copilot AI left a comment

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 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-hq
Copy link

codspeed-hq bot commented May 11, 2025

CodSpeed Instrumentation Performance Report

Merging #10936 will not alter performance

Comparing token-api (b526da9) with main (4733b52)

Summary

✅ 36 untouched benchmarks

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label May 11, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented May 11, 2025

Merge activity

The goal of this PR is to reduce the diff for #10933
@graphite-app graphite-app bot merged commit b526da9 into main May 11, 2025
26 checks passed
@graphite-app graphite-app bot deleted the token-api branch May 11, 2025 04:04
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants