-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for transforming methods in ES6 object shorthand form #4
Conversation
...which fails locally but not on Travis. |
Okay, Travis build fixed in c6d0d2f. Rebasing this PR in a bit. |
a7df7d8
to
bc5c11b
Compare
/cc @phadej :) |
bc5c11b
to
84c8bd8
Compare
Is this some kind of ES6 shortcut, for defining object properties, which are functions? |
Exactly that, I think they're called "methods". Actually, seems that within I'll look into this more in a bit... |
…e there's no regressions in their parsing in the presence of "ES6 methods".
Fix for transforming methods in ES6 object shorthand form
.replace(/\/\*\s*:([\s\S]+?)\*\//g, ': $1'); // /* : FooBar */ => : FooBar | ||
|
||
// If this is an "ES6 method" function, its return-type annotation is included as leadingComments | ||
if (node.parent.method && node.leadingComments) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is in between of node's header
updating
…ding another failing fixture.
Fair enough! Let's fix it while fixing this #6... |
Since the previous release there's a regression in transforming the form:
By a quick look it seems that
leadingComments
are attached to theFunctionExpression
, as opposed to theBlockStatement
body of the function.Added a failing test case.