@@ -83,6 +83,12 @@ function needsSignature(doclet) {
8383 }
8484 }
8585 }
86+ // and namespaces that are functions get a signature (but finding them is a
87+ // bit messy)
88+ else if ( doclet . kind === 'namespace' && doclet . meta && doclet . meta . code &&
89+ doclet . meta . code . type && doclet . meta . code . type . match ( / [ F f ] u n c t i o n / ) ) {
90+ needsSig = true ;
91+ }
8692
8793 return needsSig ;
8894}
@@ -168,12 +174,13 @@ function addSignatureReturns(f) {
168174 var attribsString = '' ;
169175 var returnTypes = [ ] ;
170176 var returnTypesString = '' ;
177+ var source = f . yields || f . returns ;
171178
172179 // jam all the return-type attributes into an array. this could create odd results (for example,
173180 // if there are both nullable and non-nullable return types), but let's assume that most people
174181 // who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa.
175- if ( f . returns ) {
176- f . returns . forEach ( function ( item ) {
182+ if ( source ) {
183+ source . forEach ( function ( item ) {
177184 helper . getAttribs ( item ) . forEach ( function ( attrib ) {
178185 if ( attribs . indexOf ( attrib ) === - 1 ) {
179186 attribs . push ( attrib ) ;
@@ -184,8 +191,8 @@ function addSignatureReturns(f) {
184191 attribsString = buildAttribsString ( attribs ) ;
185192 }
186193
187- if ( f . returns ) {
188- returnTypes = addNonParamAttributes ( f . returns ) ;
194+ if ( source ) {
195+ returnTypes = addNonParamAttributes ( source ) ;
189196 }
190197 if ( returnTypes . length ) {
191198 returnTypesString = util . format ( ' → %s{%s}' , attribsString , returnTypes . join ( '|' ) ) ;
0 commit comments