fix: do not push new token context when function is following dot/questionDot #11388
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.
This PR is based on previous work in #8972. Here we simplify the context popping logic so we can obtain a straightforward fix of #11387
When parsing
function
after dot/questionDot, we are confident that this function keyword is used as a liberal identifier instead of a keyword, so we don't have to push a new token context. Later when popping token context on parsingfunction
as identifier, it suffices to check the token context type and pop only when it is a function-type context, which can only be inserted bytt._function
. (Ditto fortt._class
.)