@@ -17,15 +17,20 @@ module.exports = function processClassDocs(log, getJSDocComment) {
1717 // Create a new doc for each member of the class
1818 _ . forEach ( classDoc . elements , function ( memberDoc ) {
1919
20- if ( ignorePrivateMembers && memberDoc . name . literalToken . value . charAt ( 0 ) === '_' ) return ;
20+ var memberName = memberDoc . name . location . toString ( ) ;
21+
22+ if ( ignorePrivateMembers && memberName . charAt ( 0 ) === '_' ) return ;
2123
22- classDoc . members . push ( memberDoc ) ;
2324 memberDocs . push ( memberDoc ) ;
2425
2526 memberDoc . docType = 'member' ;
2627 memberDoc . classDoc = classDoc ;
27- memberDoc . name = memberDoc . name . literalToken . value ;
28-
28+ memberDoc . name = memberName ;
29+ if ( memberDoc . parameterList ) {
30+ memberDoc . params = memberDoc . parameterList . parameters . map ( function ( param ) {
31+ return param . location . toString ( ) ;
32+ } ) ;
33+ }
2934
3035 if ( memberDoc . commentBefore ) {
3136 // If this export has a comment, remove it from the list of
@@ -37,6 +42,14 @@ module.exports = function processClassDocs(log, getJSDocComment) {
3742
3843 _ . assign ( memberDoc , getJSDocComment ( memberDoc . commentBefore ) ) ;
3944 }
45+
46+ // Constuctor is a special case member
47+ if ( memberName === 'constructor' ) {
48+ classDoc . constructorDoc = memberDoc ;
49+ } else {
50+ insertSorted ( classDoc . members , memberDoc , 'name' ) ;
51+ }
52+
4053 } ) ;
4154 }
4255 } ) ;
@@ -45,3 +58,13 @@ module.exports = function processClassDocs(log, getJSDocComment) {
4558 }
4659 } ;
4760} ;
61+
62+
63+ function insertSorted ( collection , item , property ) {
64+ var index = collection . length ;
65+ while ( index > 0 ) {
66+ if ( collection [ index - 1 ] [ property ] < item [ property ] ) break ;
67+ index -= 1 ;
68+ }
69+ collection . splice ( index , 0 , item ) ;
70+ }
0 commit comments