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

Add some parser missing plugins errors #11478

Merged

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Apr 24, 2020

Q                       A
Fixed Issues? Throws missing plugins error when we are confident that a stage syntax is seen
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR implements missing parser plugins check on private-properties, numeric-separators and record-and-tuple(partially).

The record-and-tuple supports missing plugins error on reading #{, I don't intend to supports #[ because it will throw missing record-and-tuple error when a computed private properties are used (disallowed by the spec), which is apparently misleading.

class C {
 #[p] = 1;
}

The implementation of missing plugins error does not introduce extra lookahead so we can offer better error message without performance sacrifice.

Additional context: I find this issue when reviewing #11372.

Error message comparison: This branch v.s. master. (Thanks to the busy @babel-bot)

@JLHwung JLHwung added PR: Polish 💅 A type of pull request used for our changelog categories pkg: parser area: errors labels Apr 24, 2020
"plugins": []
}
"throws": "This experimental syntax requires enabling the parser plugin: 'numericSeparator' (1:3)"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The diff here may be a bit confusing as I also remove the unused bigint missing plugin errors.

@babel-bot
Copy link
Collaborator

babel-bot commented Apr 24, 2020

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

@nicolo-ribaudo nicolo-ribaudo merged commit 2e4f18a into babel:master Apr 25, 2020
@nicolo-ribaudo
Copy link
Member

Thanks!

@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 26, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: errors outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Polish 💅 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants