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

Commit

Permalink
get / set are valid property names in default assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Ezell committed Sep 27, 2016
1 parent 44d44a2 commit 638f78d
Show file tree
Hide file tree
Showing 3 changed files with 506 additions and 2 deletions.
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 }) {}
Loading

0 comments on commit 638f78d

Please sign in to comment.