Repository navigation
cleanup: token set variant loop - #464
Merged
Max Medvedev (maxmedvedev) merged 1 commit intoSep 19, 2026
Merged
Max Medvedev (maxmedvedev) merged 1 commit into
Max Medvedev (maxmedvedev) merged 1 commit into
Conversation
Contributor
Author
|
Merge after #458 |
Max Medvedev (maxmedvedev)
self-requested a review
August 10, 2026 12:05
Andrei Efanov (goto1134)
force-pushed
the
cleanup/token-set-variant-loop
branch
from
August 24, 2026 10:45
2af3b3f to
fc5ec56
Compare
consumeToken(TokenSet) skipped whitespace and then called addVariant per token, and addVariant skips whitespace again, re-reads the token index and re-checks the completion state every time. An n-token set did n+1 whitespace skips. nextTokenIsSlow looped over addVariant the same way. Extract addVariants, which does the skip, the index read and the completion check once. Nothing in the loop advances the lexer, so all three are loop-invariant and the same variants land in the same order. TokenSetVariantsTest covers the contract this preserves: the expected text names every token of the set instead of rendering the IElementType[].
Andrei Efanov (goto1134)
force-pushed
the
cleanup/token-set-variant-loop
branch
from
August 29, 2026 10:23
fc5ec56 to
91a546c
Compare
Andrei Efanov (goto1134)
marked this pull request as ready for review
August 29, 2026 10:23
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.
No description provided.