-
-
Notifications
You must be signed in to change notification settings - Fork 781
refactor(parser): Remove Lexer peeking for js/class #11243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
There was a problem hiding this 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 parser peeking logic by replacing direct lexer peeking (peek_at) with lookahead callbacks, mirroring the TypeScript parser approach.
- Exposed
next_token_is_open_braceto enable lookahead. - Swapped out
peek_atforlookahead(Self::next_token_is_open_brace)in the static block check. - Introduced an inline lookahead closure for string‐constructor call detection.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_parser/src/modifiers.rs | Made next_token_is_open_brace pub(crate) for lookahead use. |
| crates/oxc_parser/src/js/class.rs | Replaced peek_at calls with lookahead for two parsing cases. |
Comments suppressed due to low confidence (1)
crates/oxc_parser/src/js/class.rs:202
- Ensure there are unit tests covering the static block parsing path after switching to
lookahead, to verify no behavior regression.
if self.at(Kind::Static) && self.lookahead(Self::next_token_is_open_brace) {
CodSpeed Instrumentation Performance ReportMerging #11243 will not alter performanceComparing Summary
|
Merge activity
|
Part of #11194 Just replace, TS does the same thing this time. > https://github.com/microsoft/TypeScript/blob/b504a1eed45e35b5f54694a1e0a09f35d0a5663c/src/compiler/parser.ts#L7730 > https://github.com/microsoft/TypeScript/blob/b504a1eed45e35b5f54694a1e0a09f35d0a5663c/src/compiler/parser.ts#L8050
9388a6b to
4e12796
Compare
Part of #11194
Just replace, TS does the same thing this time.