@@ -3,16 +3,16 @@ var arrayUniq = require('array-uniq');
3
3
var extend = require ( 'node.extend' ) ;
4
4
5
5
var memberTypes = {
6
- "Node.RenderCmd" :"any" ,
7
- "math.Matrix4" :"Matrix4" ,
8
- "Number" :"number" ,
9
- "Boolean" :"boolean" ,
10
- "String" :"string" ,
11
- "Null" :"null" ,
12
- "Array" :"Array<any>" ,
6
+ "Node.RenderCmd" :"any" ,
7
+ "math.Matrix4" :"Matrix4" ,
8
+ "Number" :"number" ,
9
+ "Boolean" :"boolean" ,
10
+ "String" :"string" ,
11
+ "Null" :"null" ,
12
+ "Array" :"Array<any>" ,
13
13
"object" :"any" ,
14
- "Class" :"any" ,
15
- "Bool" :"boolean" ,
14
+ "Class" :"any" ,
15
+ "Bool" :"boolean" ,
16
16
"ProgressTimer.TYPE_RADIAL" :"number" ,
17
17
"ProgressTimer.TYPE_BAR" :"number" ,
18
18
"CatmullRomBy" :"any" ,
@@ -220,11 +220,19 @@ function dumpObject(node,isClass) {
220
220
221
221
var lastScope = tree ;
222
222
223
- function getTypes ( type ) {
223
+ function getTypes ( type , nullable ) {
224
224
var types = [ ] ;
225
+ if ( nullable ) {
226
+ types . push ( "null" ) ;
227
+ }
225
228
if ( type && type . names ) {
226
229
for ( var j = 0 ; j < type . names . length ; ++ j ) {
227
230
types . push ( fixType ( type . names [ j ] ) ) ;
231
+ // If any of them are "any", just return
232
+ // "any"
233
+ if ( types [ types . length - 1 ] === "any" ) {
234
+ return "any" ;
235
+ }
228
236
}
229
237
} else {
230
238
return "any" ;
@@ -299,7 +307,7 @@ exports.handlers = {
299
307
prototypes [ path . normalize ( e . filename ) . toLowerCase ( ) ] = startingPoints ;
300
308
} ,
301
309
newDoclet : function ( e ) {
302
- // if (e.doclet.name.includes("Node ")) {
310
+ // if (e.doclet.name.includes("LayerColor ")) {
303
311
// console.log(e.doclet);
304
312
// }
305
313
@@ -391,9 +399,11 @@ exports.handlers = {
391
399
if ( param . name . indexOf ( "*" ) === 0 ) {
392
400
param . name = "..." + param . name . substr ( 1 ) ;
393
401
}
394
- paramString += param . name . replace ( / = / , "" , "g" ) + ":" ;
395
-
396
- paramString += getTypes ( param . type ) ;
402
+ paramString += param . name . replace ( / = / , "" , "g" ) ;
403
+ if ( param . optional ) {
404
+ paramString += "?" ;
405
+ }
406
+ paramString += ":" + getTypes ( param . type ) ;
397
407
if ( i < params . length - 1 ) {
398
408
paramString += "," ;
399
409
}
@@ -411,7 +421,7 @@ exports.handlers = {
411
421
412
422
if ( e . doclet . returns ) {
413
423
thisNode . kind = "function" ;
414
- thisNode . returns = getTypes ( e . doclet . returns [ 0 ] . type ) ;
424
+ thisNode . returns = getTypes ( e . doclet . returns [ 0 ] . type , e . doclet . returns [ 0 ] . nullable ) ;
415
425
}
416
426
if ( e . doclet . properties ) {
417
427
for ( var prop in e . doclet . properties ) {
0 commit comments