swallowzhang / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

Unable to @borrow all overloaded methods with overloads #295

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a class with a method with a few overloads (^2, ^3 etc)
2. Create a class in which you want to mixin the method from the class you 
created in step 1.
3. Add an @borrows tag on the class created in step 2, which references the 
method in the class you created in step 1.

What is the expected output? What do you see instead?
I'd expect to see the documentation for each overload of the method I'm 
"borrowing". Instead I see only the first overload's documentation come through.

What version of the product are you using? On what operating system?
2.3.2 on Windows 7 

Original issue reported on code.google.com by apritch...@gmail.com on 19 Jul 2010 at 4:10

GoogleCodeExporter commented 8 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

GoogleCodeExporter commented 8 years ago

/**
@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

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago

Original comment by micmath on 19 Jul 2010 at 6:57

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
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