only make parenthesized object patterns illegal - fixes #1254, ref jshint/jshint#2269
This commit is contained in:
parent
c54c3d3c15
commit
c2da77d7ec
@ -13,6 +13,11 @@ _Note: Gaps between patch versions are faulty/broken releases._
|
|||||||
|
|
||||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||||
|
|
||||||
|
## 5.1.8
|
||||||
|
|
||||||
|
* **Bug Fix**
|
||||||
|
* Only make parenthesized object pattern LHS illegal.
|
||||||
|
|
||||||
## 5.1.7
|
## 5.1.7
|
||||||
|
|
||||||
* **Internal**
|
* **Internal**
|
||||||
|
|||||||
@ -103,12 +103,8 @@ pp.parseMaybeAssign = function(noIn, refShorthandDefaultPos, afterLeftParse) {
|
|||||||
node.left = this.type === tt.eq ? this.toAssignable(left) : left
|
node.left = this.type === tt.eq ? this.toAssignable(left) : left
|
||||||
refShorthandDefaultPos.start = 0 // reset because shorthand default was used correctly
|
refShorthandDefaultPos.start = 0 // reset because shorthand default was used correctly
|
||||||
this.checkLVal(left)
|
this.checkLVal(left)
|
||||||
if (left.parenthesizedExpression) {
|
if (left.parenthesizedExpression && left.type === "ObjectPattern") {
|
||||||
if (left.type === "ObjectPattern") {
|
|
||||||
this.raise(left.start, "You're trying to assign to a parenthesized expression, instead of `({ foo }) = {}` use `({ foo } = {})`");
|
this.raise(left.start, "You're trying to assign to a parenthesized expression, instead of `({ foo }) = {}` use `({ foo } = {})`");
|
||||||
} else {
|
|
||||||
this.raise(left.start, "Parenthesized left hand expressions are illegal");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.next()
|
this.next()
|
||||||
node.right = this.parseMaybeAssign(noIn)
|
node.right = this.parseMaybeAssign(noIn)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user