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

Commit

Permalink
Correctly put typeParameters on FunctionExpression (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Jun 17, 2017
1 parent 40f9a95 commit 43ef7c8
Show file tree
Hide file tree
Showing 3 changed files with 413 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/plugins/estree.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ export default function (instance) {
};
});

instance.extend("parseClassMethod", function (inner) {
return function (classBody, ...args) {
inner.call(this, classBody, ...args);

const body = classBody.body;
body[body.length - 1].type = "MethodDefinition";
instance.extend("parseClassMethod", function () {
return function (classBody, method, isGenerator, isAsync) {
this.parseMethod(method, isGenerator, isAsync);
if (method.typeParameters) {
method.value.typeParameters = method.typeParameters;
delete method.typeParameters;
}
classBody.body.push(this.finishNode(method, "MethodDefinition"));
};
});

Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/estree/class-method/flow/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class NodeUtils extends UtilParser {
finishNodeAt<T : NodeType>(node: T): T {
return node;
}
}
Loading

0 comments on commit 43ef7c8

Please sign in to comment.