diff --git a/acorn/src/expression.js b/acorn/src/expression.js index ed7a1f895..da94085f5 100644 --- a/acorn/src/expression.js +++ b/acorn/src/expression.js @@ -739,7 +739,7 @@ pp.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos } else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && - (this.type !== tt.comma && this.type !== tt.braceR)) { + (this.type !== tt.comma && this.type !== tt.braceR && this.type !== tt.eq)) { if (isGenerator || isAsync) this.unexpected() prop.kind = prop.key.name this.parsePropertyName(prop) diff --git a/test/tests-harmony.js b/test/tests-harmony.js index e20bce8a6..7b681e80c 100644 --- a/test/tests-harmony.js +++ b/test/tests-harmony.js @@ -16520,3 +16520,55 @@ test("({ __proto__: x, __proto__: y, __proto__: z }) => {}", {}, {ecmaVersion: 6 // Don't parse first token after a class or strict function as strict test("class x {}\n05", {}, {ecmaVersion: 6}) test("function x() { 'use strict' }\n05", {}, {ecmaVersion: 6}) + +test("const myFn = ({ set = '' }) => {};", { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "myFn" + }, + "init": { + "type": "ArrowFunctionExpression", + "params": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "set" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "set" + }, + "right": { + "type": "Literal", + "value": "" + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "body": [] + } + } + } + ], + "kind": "const" + } + ] +}, {ecmaVersion: 6})