wenchun / jsdoc-toolkit

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

Private function become members of _global_ namespace. #197

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
/**
* constructor
*/
app = function() {
    var test = {},
        /**
        * My local function
        */
        func = function() {
        };
}

What is the expected output?
Expect the 'func' function to be a member of app class

What do you see instead?
'func' function is in _global_ namespace

What version of the product are you using? On what operating system?
2.1.0

Please provide any additional information below.
I use this method to save on space, there is no need to have var next to
every private member function. Setting @private or @inner have no effect.

Original issue reported on code.google.com by pbcomm@gmail.com on 31 Jan 2009 at 6:43

GoogleCodeExporter commented 8 years ago
This is a known limitation: the pattern `var a, b, c;` is not supported by 
JsDoc Toolkit's static analysis. There 
really isn't any reasonable way to add support for that either. In this 
particular case though you can accomplish 
what you want without `var` and even less keystrokes:

/**
 * @constructor
 */
app = function() {
    var test = {};
    /**
     * My local function
     */
    function func() {
    }
}

Or you can use the following syntax (the trailing dash on the @memberOf 
argument indicates an inner scope):

/**
 * @constructor
 */
app = function() {
    var test = {},
        /**
         * My local function
         * @memberOf app-
         */
        func = function() {
        };
}

Original comment by micmath on 15 Feb 2009 at 12:04