File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ module.exports = function () {
110110 comment . name = inferModuleName ( currentModule || comment ) ;
111111 return ;
112112 }
113-
113+
114114 /*
115115 * Test whether identifiers start with a module export (`exports` or `module.exports`),
116116 * and if so replace those identifiers with the name of the current module.
@@ -150,7 +150,7 @@ module.exports = function () {
150150
151151 var path = comment . context . ast ;
152152 var identifiers ;
153-
153+
154154 /*
155155 * Deal with an oddity of espree: the jsdoc comment is attached to a different
156156 * node in the two expressions `a.b = c` vs `a.b = function () {}`.
@@ -238,6 +238,13 @@ module.exports = function () {
238238 }
239239 inferMembershipFromIdentifiers ( comment , identifiers , scope ) ;
240240 }
241+
242+ // var function Foo(){ function bar(){} return { bar: bar }; }
243+ if ( n . FunctionDeclaration . check ( path . node ) &&
244+ n . BlockStatement . check ( path . parent . node ) &&
245+ n . FunctionDeclaration . check ( path . parent . parent . node ) ) {
246+ inferMembershipFromIdentifiers ( comment , [ path . parent . parent . value . id . name ] ) ;
247+ }
241248
242249 return comment ;
243250 } ) ;
Original file line number Diff line number Diff line change @@ -162,7 +162,21 @@ test('inferMembership - explicit', function (t) {
162162 memberof : 'Foo' ,
163163 scope : 'instance'
164164 } , 'inferMembership - lends, instance, function' ) ;
165-
165+
166+ t . deepEqual ( _ . pick ( evaluate ( function ( ) {
167+ /** Foo */
168+ function Foo ( ) {
169+ /** Test */
170+ function bar ( ) { }
171+ return {
172+ bar : bar
173+ } ;
174+ }
175+ } ) [ 1 ] , [ 'memberof' , 'scope' ] ) , {
176+ memberof : 'Foo' ,
177+ scope : 'static'
178+ } , 'inferMembership - revealing, static, function' ) ;
179+
166180 t . equal ( evaluate ( function ( ) {
167181 lend ( /** @lends Foo */ { } ) ;
168182 /** Test */
You can’t perform that action at this time.
0 commit comments