Skip to content

fix(@babel/parser): fix tokenizer context update code#13422

Merged
JLHwung merged 2 commits intobabel:mainfrom
Eyoatam:main
Jun 8, 2021
Merged

fix(@babel/parser): fix tokenizer context update code#13422
JLHwung merged 2 commits intobabel:mainfrom
Eyoatam:main

Conversation

@Eyoatam
Copy link
Copy Markdown
Contributor

@Eyoatam Eyoatam commented Jun 4, 2021

Q                       A
Patch: Bug Fix? Yes
Tests Added + Pass? Yes
License MIT

this will always be false since b_stat does not exist on the types object. so instead of types.b_stat use types.braceStatement

@babel-bot
Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/46691/

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented Jun 4, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 42d35a8:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

JLHwung
JLHwung previously approved these changes Jun 4, 2021
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! We should add a test for this change.

@existentialism existentialism added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: types labels Jun 4, 2021
@JLHwung JLHwung dismissed their stale review June 7, 2021 15:17

While it is very likely to be a typo, I think we should add a test to actually cover this branch.

Copy link
Copy Markdown
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not visible to users.

Before this PR, the first slash in { function x () {} /1/ } is tokenized as a slash (incorrect!) but later we are saved from the parser#parseExprAtom where we re-read as a regex token:

if (this.state.type === tt.slash) this.readRegexp();

After this PR, such token is handled as regexp token in the first place. So this PR does not introduce changing behaviours.

@JLHwung JLHwung added PR: Internal 🏠 A type of pull request used for our changelog categories and removed PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Jun 7, 2021
@JLHwung
Copy link
Copy Markdown
Contributor

JLHwung commented Jun 7, 2021

I marked this PR as internal because of no visible behaviour changes.

@JLHwung JLHwung merged commit 56db172 into babel:main Jun 8, 2021
@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 Sep 8, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
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: types PR: Internal 🏠 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants