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
Conversation
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 |
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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"
0c53bc3
to
1c55efa
Compare
I'm merging this since another PR I'm working on depends on this PR. |
Fixes #1, Fixes #2
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 usedthis.state
instead of passing around therefTrailingCommaPos
"reference" parameter.NOTE: In the diff it looks like I added code (
312 insertions(+), 262 deletions(-)
), but excluding the test folder it is79 insertions(+), 100 deletions(-)