From 1424c35d136029aeadbfd63c89b57ce4e9c87d3f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 26 Feb 2015 08:31:49 +1100 Subject: [PATCH] correctly handle SpreadProperty - fixes babel/babel#897 --- acorn.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/acorn.js b/acorn.js index 3bbf7badee..c981f9b630 100644 --- a/acorn.js +++ b/acorn.js @@ -2312,6 +2312,7 @@ case "Identifier": case "VirtualPropertyExpression": case "MemberExpression": + case "SpreadProperty": case "ObjectPattern": case "ArrayPattern": case "AssignmentPattern": @@ -2321,6 +2322,8 @@ node.type = "ObjectPattern"; for (var i = 0; i < node.properties.length; i++) { var prop = node.properties[i]; + if (prop.type === "SpreadProperty") continue; + if (prop.kind !== "init") raise(prop.key.start, "Object pattern can't contain getter or setter"); toAssignable(prop.value, isBinding); }