Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

get / set are valid property names in default assignment #142

Merged
merged 1 commit into from
Sep 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/parser/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,8 @@ pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync,
return this.finishNode(prop, "ObjectProperty");
}

if (!prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (!this.match(tt.comma) && !this.match(tt.braceR))) {
if (isGenerator || isAsync || isPattern) this.unexpected();
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 (isGenerator || isAsync) this.unexpected();
prop.kind = prop.key.name;
this.parsePropertyName(prop);
this.parseMethod(prop, false);
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/es2015/uncategorised/355/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function x({ set = null }) {}