forked from acornjs/acorn-object-spread
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow nested destructuring or binding
- Loading branch information
1 parent
93c2f7f
commit 6677deb
Showing
2 changed files
with
10 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,13 @@ module.exports = function(acorn) { | |
if (this.options.ecmaVersion >= 6) { | ||
// ...the spread logic borrowed from babylon :) | ||
if (this.type === tt.ellipsis) { | ||
prop = isPattern ? this.parseRestBinding() : this.parseSpread(refDestructuringErrors) | ||
if (isPattern) { | ||
this.next() | ||
prop.argument = this.parseIdent() | ||
this.finishNode(prop, "RestElement") | ||
} else { | ||
prop = this.parseSpread(refDestructuringErrors) | ||
} | ||
node.properties.push(prop) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
adrianheine
Author
Owner
|
||
if (this.type === tt.comma) { | ||
if (isPattern) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I noticed here when adopting this plugin for my use that I ran into
If I changed the bit of code to
The issue was resolved. I think it comes down to the
prop.argument = this.parseIdent()
bit as theparseSpread
method will dowhich I didn't dig into further.