swallowzhang / jsdoc-toolkit

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

Overwriting a function gives a warning #279

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I am redefining an existing function:
/**
 * @namespace a
 */
var a =
{
    fn : function() {}
};

function foo()
{
    // redefine a.fn
    a.fn = function() {};
}

What is the expected output? What do you see instead?
I am getting a warning:
>> WARNING: Overwriting symbol documentation for: a.fn.

What version of the product are you using? On what operating system?
jsdoc_toolkit-2.3.3-beta
Mac OS X 10.6.2

Please provide any additional information below.

Original issue reported on code.google.com by dusan.smolnikar@gmail.com on 20 Jan 2010 at 1:56

GoogleCodeExporter commented 8 years ago
Here's a workaround:
Documenting initial definition of fn as a function solves the problem:

var a =
{
    /** @type Function */
    fn : function() {}
};

Original comment by dusan.smolnikar@gmail.com on 20 Jan 2010 at 2:09

GoogleCodeExporter commented 8 years ago
However, even with the workaround present, if I move function foo in front of 
a, warning is still displayed

function foo()
{
    // redefine a.fn
    a.fn = function() {};
}

/**
 * @namespace a
 */
var a =
{
    /** @type Function */
    fn : function() {}
};

Original comment by dusan.smolnikar@gmail.com on 20 Jan 2010 at 2:31

GoogleCodeExporter commented 8 years ago
This is "as designed" - the warning is only for your own information in case 
the overwrite was unintentional, it doesn't have any effect on the operation of 
the tool. The --quiet option will suppress all warnings if that is a problem.

Original comment by micmath on 27 Jun 2010 at 9:03