@@ -37,7 +37,12 @@ function setID (identifier) {
3737 identifier . id = identifier . longname
3838 }
3939 if ( identifier . kind === 'constructor' ) {
40- identifier . id = identifier . longname + '()'
40+ if ( identifier . scope === 'static' ) {
41+ identifier . id = identifier . longname
42+ delete identifier . scope
43+ } else {
44+ identifier . id = identifier . longname + '()'
45+ }
4146 }
4247 if ( identifier . isExported ) {
4348 identifier . id = identifier . longname + '--' + identifier . codeName
@@ -101,10 +106,26 @@ function createConstructor (class_) {
101106/* split each class found into two new items, then re-insert them over the original class */
102107function insertConstructors ( data ) {
103108 var replacements = [ ]
109+ var toDelete = [ ]
104110
105111 data . forEach ( function ( identifier , index ) {
106- if ( identifier . kind === 'class' ) {
107- replacements . push ( { index : index , items : createConstructor ( identifier ) } )
112+ if ( identifier . kind === 'class' && identifier . scope !== 'static' ) {
113+ const es6constructor = a . findWhere ( data , { kind : 'class' , scope : 'static' , memberof : identifier . longname } )
114+ if ( es6constructor ) {
115+ if ( ! ( es6constructor . description || ( es6constructor . params && es6constructor . params . length ) ) ) {
116+ toDelete . push ( es6constructor )
117+ }
118+ es6constructor . kind = 'constructor'
119+ const constructorChildren = a . where ( data , { memberof : es6constructor . longname } )
120+ constructorChildren . forEach ( i => {
121+ i . memberof = identifier . longname
122+ } )
123+ identifier . description = identifier . classdesc
124+ delete identifier . classdesc
125+ delete identifier . params
126+ } else {
127+ replacements . push ( { index : index , items : createConstructor ( identifier ) } )
128+ }
108129 }
109130 } )
110131
@@ -113,6 +134,10 @@ function insertConstructors (data) {
113134 data . splice . apply ( data , spliceArgs )
114135 } )
115136
137+ toDelete . forEach ( d => {
138+ data . splice ( data . indexOf ( d ) , 1 )
139+ } )
140+
116141 return data
117142}
118143
@@ -259,7 +284,7 @@ function sort (object, sortFunction) {
259284}
260285
261286function sortIdentifier ( identifier ) {
262- var fieldOrder = [ 'id' , 'longname' , 'name' , 'scope' , 'kind' , 'isExported' , 'classdesc' , 'augments' , 'inherits' , 'inherited' , 'overrides' , 'mixes' , 'description' , 'memberof' , 'alias' , 'params' , 'fires' , 'examples' , 'returns' , 'type' , 'defaultvalue' , 'readonly' , 'thisvalue' , 'isEnum' , 'properties' , 'optional' , 'nullable' , 'variable' , 'author' , 'deprecated' , 'ignore' , 'access' , 'requires' , 'version' , 'since' , 'licenses' , 'license' , 'typicalname' , 'category' , 'see' , 'exceptions' , 'codeName' , 'todoList' , 'customTags' , 'chainable' , 'order' ]
287+ var fieldOrder = [ 'id' , 'longname' , 'name' , 'scope' , 'kind' , 'isExported' , 'classdesc' , 'augments' , 'inherits' , 'inherited' , 'implements' , ' overrides', 'mixes' , 'description' , 'memberof' , 'alias' , 'params' , 'fires' , 'examples' , 'returns' , 'type' , 'defaultvalue' , 'readonly' , 'thisvalue' , 'isEnum' , 'properties' , 'optional' , 'nullable' , 'variable' , 'author' , 'deprecated' , 'ignore' , 'access' , 'requires' , 'version' , 'since' , 'licenses' , 'license' , 'typicalname' , 'category' , 'see' , 'exceptions' , 'codeName' , 'todoList' , 'customTags' , 'chainable' , 'meta ', 'order' ]
263288 return sort ( identifier , function ( a , b ) {
264289 if ( fieldOrder . indexOf ( a ) === - 1 && fieldOrder . indexOf ( b ) > - 1 ) {
265290 return 1
0 commit comments