@@ -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 ;
@@ -88,10 +93,26 @@ function createConstructor(class_) {
8893
8994function insertConstructors ( data ) {
9095 var replacements = [ ] ;
96+ var toDelete = [ ] ;
9197
9298 data . forEach ( function ( identifier , index ) {
93- if ( identifier . kind === 'class' ) {
94- replacements . push ( { index : index , items : createConstructor ( identifier ) } ) ;
99+ if ( identifier . kind === 'class' && identifier . scope !== 'static' ) {
100+ var es6constructor = a . findWhere ( data , { kind : 'class' , scope : 'static' , memberof : identifier . longname } ) ;
101+ if ( es6constructor ) {
102+ if ( ! ( es6constructor . description || es6constructor . params && es6constructor . params . length ) ) {
103+ toDelete . push ( es6constructor ) ;
104+ }
105+ es6constructor . kind = 'constructor' ;
106+ var constructorChildren = a . where ( data , { memberof : es6constructor . longname } ) ;
107+ constructorChildren . forEach ( function ( i ) {
108+ i . memberof = identifier . longname ;
109+ } ) ;
110+ identifier . description = identifier . classdesc ;
111+ delete identifier . classdesc ;
112+ delete identifier . params ;
113+ } else {
114+ replacements . push ( { index : index , items : createConstructor ( identifier ) } ) ;
115+ }
95116 }
96117 } ) ;
97118
@@ -100,6 +121,10 @@ function insertConstructors(data) {
100121 data . splice . apply ( data , spliceArgs ) ;
101122 } ) ;
102123
124+ toDelete . forEach ( function ( d ) {
125+ data . splice ( data . indexOf ( d ) , 1 ) ;
126+ } ) ;
127+
103128 return data ;
104129}
105130
@@ -238,7 +263,7 @@ function sort(object, sortFunction) {
238263}
239264
240265function sortIdentifier ( identifier ) {
241- 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' ] ;
266+ 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' ] ;
242267 return sort ( identifier , function ( a , b ) {
243268 if ( fieldOrder . indexOf ( a ) === - 1 && fieldOrder . indexOf ( b ) > - 1 ) {
244269 return 1 ;
0 commit comments