Skip to content
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

fix: do not push new token context when function is following dot/questionDot #11388

Merged
merged 2 commits into from Apr 8, 2020

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Apr 8, 2020

Q                       A
Fixed Issues? Fixes #11387
Patch: Bug Fix? Yes
Tests Added + Pass? Yes
License MIT

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 parsing function 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 by tt._function. (Ditto for tt._class.)

@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: parser labels Apr 8, 2020
@JLHwung JLHwung merged commit 8b976b0 into babel:master Apr 8, 2020
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 9, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optional chaining in JSX doesn't parse correctly for properties named "class" or "function"
3 participants