Closed GoogleCodeExporter closed 9 years ago
Sorry, need a code example to follow this. Can you include please?
Original comment by micmath
on 19 Jul 2010 at 4:28
/**
@class
*/
var ClassWithFunction = function () {
}
/**
This is overload 1 of the function we want to "mixin" to another class
@name ClassWithFunction.staticFunc
@param a The first parameter
*/
/**
This is overload 2 of the function we want to "mixin" to another class
@name ClassWithFunction.staticFunc^2
@param a The first parameter
@param b The second parameter
*/
/**
This is overload 3 of the function we want to "mixin" to another class
@name ClassWithFunction.staticFunc^3
@param a The first parameter
@param b The second parameter
@param c The third parameter
*/
ClassWithFunction.staticFunc = function (a, b, c) {
alert(a);
if (b) alert(b);
if (c) alert(c);
}
/**
@class
@borrows ClassWithFunction.staticFunc as #dynamicFunc
*/
var ClassWithMixin = function () {
}
ClassWithMixin.prototype.dynamicFunc = ClassWithFunction.staticFunc
Original comment by apritch...@gmail.com
on 19 Jul 2010 at 4:40
If you generate docs for the above code sample, you'll see the documentation
for overload 1 gets borrowed, but you can't see the documentation for the other
two overloads.
I've tried the following variations on @borrows, but to no avail:-
@borrows ClassWithFunction.staticFunc^2 as #dynamicFunc^2
@borrows ClassWithFunction.staticFunc^2 as #dynamicFunc
Is there any way to achieve the "borrowing" of all of the overloads?
Original comment by apritch...@gmail.com
on 19 Jul 2010 at 4:42
Original comment by micmath
on 19 Jul 2010 at 6:57
Committed revision 848. Thanks for reporting this.
Using the above revision, try this:
/**
@class
@borrows ClassWithFunction.staticFunc as #dynamicFunc
@borrows ClassWithFunction.staticFunc^2 as #dynamicFunc^2
@borrows ClassWithFunction.staticFunc^3 as #dynamicFunc^3
*/
var ClassWithMixin = function () {
}
Original comment by micmath
on 19 Jul 2010 at 7:04
Micmath, that was an amazing turnaround time from bug report to fixed release.
You are a true gentlemen and totally dedicated to your project! I really
appreciate the haste in which you solved the issue. Your documentation system
is ingenious and caters for all of the features of such a dynamic and
unconventional OO language with ease. I take my hat off to you! Adam
Original comment by apritch...@gmail.com
on 19 Jul 2010 at 10:13
I just wish there was a better solution to documenting overloaded methods in
general, the ^n syntax feels like a workaround to be honest. I'll give this a
bit more thought for JSDoc 3.
Original comment by micmath
on 19 Jul 2010 at 10:38
Original issue reported on code.google.com by
apritch...@gmail.com
on 19 Jul 2010 at 4:10