fix(parser): guard against re-lex tokens when fatal error#11023
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue in the parser by ensuring that token re-lexing does not occur once a fatal error has been encountered and by removing a redundant call in type argument parsing.
- Remove duplicate call to re-lex the left angle token in type argument parsing
- Add guards in the cursor re-lex functions to return EOF if a fatal error is present
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_parser/src/ts/types.rs | Removed a redundant re-lex call to prevent side effects in type argument parsing |
| crates/oxc_parser/src/cursor.rs | Added fatal error guards in re-lex functions to avoid token re-lexing after errors |
Comments suppressed due to low confidence (1)
crates/oxc_parser/src/ts/types.rs:790
- Consider caching the result of self.re_lex_l_angle() in a local variable to ensure consistent behavior, avoiding unexpected side effects if the re-lexing function modifies internal state.
if !self.cur_token().is_on_new_line() && self.re_lex_l_angle() == Kind::LAngle {
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. |
Merge activity
|
CodSpeed Instrumentation Performance ReportMerging #11023 will not alter performanceComparing Summary
|
c3789dc to
4c9a9b3
Compare

fixes #10977