fix(parser): reset popped lexer errors when rewinding#13494
Merged
Boshen merged 2 commits intooxc-project:mainfrom Sep 1, 2025
Merged
fix(parser): reset popped lexer errors when rewinding#13494Boshen merged 2 commits intooxc-project:mainfrom
Boshen merged 2 commits intooxc-project:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Fixes a lexer rewinding bug where popped errors before a checkpoint weren't properly restored when rewinding. This changes the error handling strategy from storing an error count to storing a complete clone of all errors.
- Modifies
LexerCheckpointto store a full clone of errors instead of just the error count - Updates checkpoint creation and rewinding methods to use the new error cloning approach
- Renames
positionfield tosource_positionfor clarity
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #13494 will not alter performanceComparing Summary
|
Contributor
Author
|
Some parser benchmarks improved and some regressed. Interesting... This makes this solution even better. |
graphite-app bot
pushed a commit
that referenced
this pull request
Sep 2, 2025
partially addresses the perf regression in #13494 Not quite as fast as originally, but a little bit faster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12816.
Alternative to #13460.
This PR is the slightly cleaner way to fix the issue compared to the other PR, but comes at a potential performance cost because now instead of remembering how many errors there were, we are storing a clone of all errors and re-assign them when rewinding.
This makes it possible to fix the issue because now even errors before a checkpoint, that were popped/removed after the checkpoint, are properly rewinded.