Fix parse error when destructuring set with default value (#317)
This commit is contained in:
committed by
Daniel Tschinder
parent
55df6631fa
commit
461ed45942
@@ -822,7 +822,13 @@ pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync,
|
||||
return this.finishNode(prop, "ObjectProperty");
|
||||
}
|
||||
|
||||
if (!isPattern && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (!this.match(tt.comma) && !this.match(tt.braceR))) {
|
||||
if (
|
||||
!isPattern &&
|
||||
!prop.computed &&
|
||||
prop.key.type === "Identifier" &&
|
||||
(prop.key.name === "get" || prop.key.name === "set") &&
|
||||
(!this.match(tt.comma) && !this.match(tt.braceR) && !this.match(tt.eq))
|
||||
) {
|
||||
if (isGenerator || isAsync) this.unexpected();
|
||||
prop.kind = prop.key.name;
|
||||
this.parsePropertyName(prop);
|
||||
|
||||
Reference in New Issue
Block a user