Incorrect code generation when assigning a generated function to a function
marcoscaceres opened this issue · comments
The first param gets the contents of the whole function:
var x = {
/**
* [* description]
* @param {[type]} aWindow) { if (!aWindow) { throw new TypeError('Invalid input. Expected xul browser.'); } if (this.isXULWindow(aWindow)) { return yield this._awaitFetchManifest(aWindow); } return this._fetchManifest(aWindow); } [description]
* @yield {[type]} [description]
*/
obtainManifest: async(function* (aWindow) {
if (!aWindow) {
throw new TypeError('Invalid input. Expected xul browser.');
}
if (this.isXULWindow(aWindow)) {
return yield this._awaitFetchManifest(aWindow);
}
return this._fetchManifest(aWindow);
//'DOM:ManifestObtainer:Obtain'
})
}
Documenting generated functions is a difficult one, since it's very difficult to statically tell what the result will be (especially without using a proper parser). If we searched the arguments list for functions and assumed that a function with the same signature was returned, then there'd be other edge cases where it's equally broken in the other direction, eg:
// (what should the docs be here?)
var x = doAsyncThing(function callback(err, res) {
});
Of course, the current behaviour is pretty terrible, I'm not denying that...
This is an edge case issue with other languages too. See #377
Yes, I completely understand. Also, my use is somewhat strange, in that I'm calling a function to get a function that will serve as a pollyfill for async function(){}
- and expecting @params, etc. to be generated from that is a bit of a stretch.
I'm ok if you WONTFIX this - but just wanted to bring it to your attention. Thanks for this awesome tool - can't live without it :)
On June 15, 2015 at 5:07:58 AM, Nick Fisher (notifications@github.com) wrote:
Documenting generated functions is a difficult one, since it's very difficult to statically
tell what the result will be (especially without using a proper parser). If we searched
the arguments list for functions and assumed that a function with the same signature
was returned, then there'd be other edge cases where it's equally broken in the other
direction, eg:// (what should the docs be here?) var x = doAsyncThing(function callback(err, res) { });Of course, the current behaviour is pretty terrible, I'm not denying that...
Reply to this email directly or view it on GitHub:
#375 (comment)