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

Conversation

jezell
Copy link
Contributor

@jezell jezell commented Sep 24, 2016

function something({ set = null }) {
}

this is valid syntax, but currently fails to compile with babel

@danez
Copy link
Member

danez commented Sep 24, 2016

Thank you, this was also reported in #112.

Copy link
Member

@danez danez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, just on check that is unused now.

@@ -774,7 +774,7 @@ 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 (!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 || isPattern) this.unexpected();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|| isPattern can now be removed as it will never be true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, fixed.

@codecov-io
Copy link

codecov-io commented Sep 27, 2016

Current coverage is 94.47% (diff: 50.00%)

Merging #142 into master will not change coverage

@@             master       #142   diff @@
==========================================
  Files            19         19          
  Lines          3111       3111          
  Methods         327        327          
  Messages          0          0          
  Branches        818        818          
==========================================
  Hits           2939       2939          
  Misses           94         94          
  Partials         78         78          

Powered by Codecov. Last update 4115bcb...638f78d

@danez
Copy link
Member

danez commented Sep 27, 2016

Thank you

@danez danez closed this Sep 27, 2016
@danez danez reopened this Sep 27, 2016
@danez
Copy link
Member

danez commented Sep 27, 2016

Upps wrong button :D

@danez danez merged commit 9cc0981 into babel:master Sep 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants