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

Disallow trailing comma after rest #9311

Merged
merged 13 commits into from Jan 11, 2019

Conversation

nicolo-ribaudo
Copy link
Member

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

I started by fixing a bug where Babel did not throw for [...a,]=[], than found that the logic to disallow it was duplicated in a lot of places: so I merged them together and properly used this.state instead of passing around the refTrailingCommaPos "reference" parameter.

NOTE: In the diff it looks like I added code (312 insertions(+), 262 deletions(-)), but excluding the test folder it is 79 insertions(+), 100 deletions(-)

@nicolo-ribaudo nicolo-ribaudo added PR: Internal 🏠 A type of pull request used for our changelog categories PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: parser labels Jan 11, 2019
@babel-bot
Copy link
Collaborator

babel-bot commented Jan 11, 2019

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

@@ -87,6 +89,11 @@ export default class State {
// TODO
input: string;

// A comma after "...a" is only allowed in spread, but not in rest.
// Since we parse destructuring expressions ar array/object literals
Copy link
Member

Choose a reason for hiding this comment

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

Nit: ar -> in (I think?)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that I meant "as"

@nicolo-ribaudo
Copy link
Member Author

I'm merging this since another PR I'm working on depends on this PR.

@nicolo-ribaudo nicolo-ribaudo merged commit 9764718 into babel:master Jan 11, 2019
@nicolo-ribaudo nicolo-ribaudo deleted the rest-comma branch January 11, 2019 12:08
@nicolo-ribaudo nicolo-ribaudo added PR: Spec Compliance 👓 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 PR: Internal 🏠 A type of pull request used for our changelog categories labels Jan 11, 2019
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
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: Spec Compliance 👓 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

3 participants