@@ -336,46 +336,53 @@ namespace ts.NavigationBar {
336336 nameToItems . set ( name , [ itemWithSameName , child ] ) ;
337337 return true ;
338338 }
339-
340- function tryMerge ( a : NavigationBarNode , b : NavigationBarNode ) : boolean {
341- if ( shouldReallyMerge ( a . node , b . node ) ) {
342- merge ( a , b ) ;
343- return true ;
344- }
345- return false ;
346- }
347339 } ) ;
340+ }
348341
349- /** a and b have the same name, but they may not be mergeable. */
350- function shouldReallyMerge ( a : Node , b : Node ) : boolean {
351- return a . kind === b . kind && ( a . kind !== SyntaxKind . ModuleDeclaration || areSameModule ( < ModuleDeclaration > a , < ModuleDeclaration > b ) ) ;
342+ function tryMerge ( a : NavigationBarNode , b : NavigationBarNode ) : boolean {
343+ if ( shouldReallyMerge ( a . node , b . node ) ) {
344+ merge ( a , b ) ;
345+ return true ;
346+ }
347+ return false ;
348+ }
352349
353- // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes.
354- // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
355- function areSameModule ( a : ModuleDeclaration , b : ModuleDeclaration ) : boolean {
356- if ( a . body . kind !== b . body . kind ) {
357- return false ;
358- }
359- if ( a . body . kind !== SyntaxKind . ModuleDeclaration ) {
360- return true ;
361- }
362- return areSameModule ( < ModuleDeclaration > a . body , < ModuleDeclaration > b . body ) ;
363- }
350+ /** a and b have the same name, but they may not be mergeable. */
351+ function shouldReallyMerge ( a : Node , b : Node ) : boolean {
352+ if ( a . kind !== b . kind ) {
353+ return false ;
364354 }
355+ switch ( a . kind ) {
356+ case SyntaxKind . PropertyDeclaration :
357+ case SyntaxKind . MethodDeclaration :
358+ case SyntaxKind . GetAccessor :
359+ case SyntaxKind . SetAccessor :
360+ return hasModifier ( a , ModifierFlags . Static ) === hasModifier ( b , ModifierFlags . Static ) ;
361+ case SyntaxKind . ModuleDeclaration :
362+ return areSameModule ( < ModuleDeclaration > a , < ModuleDeclaration > b ) ;
363+ default :
364+ return true ;
365+ }
366+ }
365367
366- /** Merge source into target. Source should be thrown away after this is called. */
367- function merge ( target : NavigationBarNode , source : NavigationBarNode ) : void {
368- target . additionalNodes = target . additionalNodes || [ ] ;
369- target . additionalNodes . push ( source . node ) ;
370- if ( source . additionalNodes ) {
371- target . additionalNodes . push ( ...source . additionalNodes ) ;
372- }
368+ // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes.
369+ // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
370+ function areSameModule ( a : ModuleDeclaration , b : ModuleDeclaration ) : boolean {
371+ return a . body . kind === b . body . kind && ( a . body . kind !== SyntaxKind . ModuleDeclaration || areSameModule ( < ModuleDeclaration > a . body , < ModuleDeclaration > b . body ) ) ;
372+ }
373373
374- target . children = concatenate ( target . children , source . children ) ;
375- if ( target . children ) {
376- mergeChildren ( target . children ) ;
377- sortChildren ( target . children ) ;
378- }
374+ /** Merge source into target. Source should be thrown away after this is called. */
375+ function merge ( target : NavigationBarNode , source : NavigationBarNode ) : void {
376+ target . additionalNodes = target . additionalNodes || [ ] ;
377+ target . additionalNodes . push ( source . node ) ;
378+ if ( source . additionalNodes ) {
379+ target . additionalNodes . push ( ...source . additionalNodes ) ;
380+ }
381+
382+ target . children = concatenate ( target . children , source . children ) ;
383+ if ( target . children ) {
384+ mergeChildren ( target . children ) ;
385+ sortChildren ( target . children ) ;
379386 }
380387 }
381388
0 commit comments