correctly handle SpreadProperty - fixes babel/babel#897
This commit is contained in:
parent
631b78e07d
commit
1424c35d13
3
acorn.js
3
acorn.js
@ -2312,6 +2312,7 @@
|
|||||||
case "Identifier":
|
case "Identifier":
|
||||||
case "VirtualPropertyExpression":
|
case "VirtualPropertyExpression":
|
||||||
case "MemberExpression":
|
case "MemberExpression":
|
||||||
|
case "SpreadProperty":
|
||||||
case "ObjectPattern":
|
case "ObjectPattern":
|
||||||
case "ArrayPattern":
|
case "ArrayPattern":
|
||||||
case "AssignmentPattern":
|
case "AssignmentPattern":
|
||||||
@ -2321,6 +2322,8 @@
|
|||||||
node.type = "ObjectPattern";
|
node.type = "ObjectPattern";
|
||||||
for (var i = 0; i < node.properties.length; i++) {
|
for (var i = 0; i < node.properties.length; i++) {
|
||||||
var prop = node.properties[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");
|
if (prop.kind !== "init") raise(prop.key.start, "Object pattern can't contain getter or setter");
|
||||||
toAssignable(prop.value, isBinding);
|
toAssignable(prop.value, isBinding);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user