csnover / js-doc-parse

An experimental library for parsing JavaScript files and extracting inline documentation.
31 stars 7 forks source link

inline return types often ignored #68

Open wkeese opened 12 years ago

wkeese commented 12 years ago

See for example dojox/gfx/matrix.js:

    scaleAt: function(a, b, c, d){
        // summary:
        //      scales a picture using a specified point as a center of scaling
        // description:
        //      Compare with dojox/gfx/matrix.scale().
        // a: Number
        //      a scaling factor used for the x coordinate, or a uniform scaling factor used for both coordinates
        // b: Number?
        //      a scaling factor used for the y coordinate
        // c: Number|Point
        //      an x component of a central point, or a central point
        // d: Number
        //      a y component of a central point

        switch(arguments.length){
            case 4:
                // a and b are scale factor components, c and d are components of a point
                return m._sandwich(m.scale(a, b), c, d); // dojox/gfx/matrix.Matrix2D
            case 3:
                if(typeof c == "number"){
                    return m._sandwich(m.scale(a), b, c); // dojox/gfx/matrix.Matrix2D
                }
                return m._sandwich(m.scale(a, b), c.x, c.y); // dojox/gfx/matrix.Matrix2D
        }
        return m._sandwich(m.scale(a), b.x, b.y); // dojox/gfx/matrix.Matrix2D
    },

The return type merely shows up as undefined. You can workaround by adding a

// returns: dojox/gfx/matrix.Matrix2D

to the top level summary section. (Therefore, to reproduce this bug, remove the // returns: ... from the top of the methods in that file.)

neonstalwart commented 11 years ago

i believe that d86cc3a in #80 would fix this.