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

flow: allow generic method with name get or set #55

Merged
merged 2 commits into from
Jun 24, 2016

Conversation

vkurchatkin
Copy link
Contributor

No description provided.

@@ -692,9 +693,13 @@ pp.parseClassBody = function (node) {
if (!method.computed) {
let { key } = method;

if (this.hasPlugin("flow") && this.isRelational("<")) {
isGeneric = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic should be done inside of plugins/flow.js via method overloading.

Copy link
Contributor

Choose a reason for hiding this comment

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

ie. you could do something like:

pp.isClassMutatorStarter = function () {
  return doSomethingHere;
};

and use this.isClassMutatorStarter() in the if check and then overload isClassMutatorStarter to do your checking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok! I thought about that, but saw a bunch of hasPlugin just above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Finding a good name is tricky though, so I'll just use isClassMutatorStarter for now

@sebmck sebmck merged commit f30f194 into babel:master Jun 24, 2016
@sebmck
Copy link
Contributor

sebmck commented Jun 24, 2016

Awesome, thank you so much @vkurchatkin!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants