File tree 2 files changed +24
-3
lines changed
2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ module.exports = function () {
110
110
comment . name = inferModuleName ( currentModule || comment ) ;
111
111
return ;
112
112
}
113
-
113
+
114
114
/*
115
115
* Test whether identifiers start with a module export (`exports` or `module.exports`),
116
116
* and if so replace those identifiers with the name of the current module.
@@ -150,7 +150,7 @@ module.exports = function () {
150
150
151
151
var path = comment . context . ast ;
152
152
var identifiers ;
153
-
153
+
154
154
/*
155
155
* Deal with an oddity of espree: the jsdoc comment is attached to a different
156
156
* node in the two expressions `a.b = c` vs `a.b = function () {}`.
@@ -238,6 +238,13 @@ module.exports = function () {
238
238
}
239
239
inferMembershipFromIdentifiers ( comment , identifiers , scope ) ;
240
240
}
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
+ }
241
248
242
249
return comment ;
243
250
} ) ;
Original file line number Diff line number Diff line change @@ -162,7 +162,21 @@ test('inferMembership - explicit', function (t) {
162
162
memberof : 'Foo' ,
163
163
scope : 'instance'
164
164
} , '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
+
166
180
t . equal ( evaluate ( function ( ) {
167
181
lend ( /** @lends Foo */ { } ) ;
168
182
/** Test */
You can’t perform that action at this time.
0 commit comments