diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e221b6d11..10de11c231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. +## 5.1.8 + + * **Bug Fix** + * Only make parenthesized object pattern LHS illegal. + ## 5.1.7 * **Internal** diff --git a/src/acorn/src/expression.js b/src/acorn/src/expression.js index 8eaeab610f..cf8370c51c 100755 --- a/src/acorn/src/expression.js +++ b/src/acorn/src/expression.js @@ -103,12 +103,8 @@ pp.parseMaybeAssign = function(noIn, refShorthandDefaultPos, afterLeftParse) { node.left = this.type === tt.eq ? this.toAssignable(left) : left refShorthandDefaultPos.start = 0 // reset because shorthand default was used correctly this.checkLVal(left) - if (left.parenthesizedExpression) { - if (left.type === "ObjectPattern") { - 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"); - } + if (left.parenthesizedExpression && left.type === "ObjectPattern") { + this.raise(left.start, "You're trying to assign to a parenthesized expression, instead of `({ foo }) = {}` use `({ foo } = {})`"); } this.next() node.right = this.parseMaybeAssign(noIn)