fix handling of flow method shorthand - fixes #2169

This commit is contained in:
Sebastian McKenzie
2015-08-05 21:42:15 +01:00
parent 94e345e0b2
commit 71bbffa797
3 changed files with 179 additions and 1 deletions

View File

@@ -837,12 +837,19 @@ export default function (instance) {
instance.extend("parseObjPropValue", function (inner) {
return function (prop) {
var typeParameters;
// method shorthand
if (this.isRelational("<")) {
typeParameters = this.flowParseTypeParameterDeclaration();
if (!this.match(tt.parenL)) this.unexpected();
}
inner.apply(this, arguments);
prop.value.typeParameters = typeParameters;
// add typeParameters if we found them
if (typeParameters) {
prop.value.typeParameters = typeParameters;
}
};
});