@@ -490,7 +490,6 @@ namespace ts.NavigationBar {
490490 [ AssignmentDeclarationKind . ThisProperty ] : false ,
491491 } ;
492492 function tryMergeEs5Class ( a : NavigationBarNode , b : NavigationBarNode , bIndex : number , parent : NavigationBarNode ) : boolean | undefined {
493-
494493 function isPossibleConstructor ( node : Node ) {
495494 return isFunctionExpression ( node ) || isFunctionDeclaration ( node ) || isVariableDeclaration ( node ) ;
496495 }
@@ -506,10 +505,10 @@ namespace ts.NavigationBar {
506505 if ( ( isEs5ClassMember [ bAssignmentDeclarationKind ] && isEs5ClassMember [ aAssignmentDeclarationKind ] ) // merge two class elements
507506 || ( isPossibleConstructor ( a . node ) && isEs5ClassMember [ bAssignmentDeclarationKind ] ) // ctor function & member
508507 || ( isPossibleConstructor ( b . node ) && isEs5ClassMember [ aAssignmentDeclarationKind ] ) // member & ctor function
509- || ( isClassDeclaration ( a . node ) && isEs5ClassMember [ bAssignmentDeclarationKind ] ) // class (generated) & member
508+ || ( isClassDeclaration ( a . node ) && isSynthesized ( a . node ) && isEs5ClassMember [ bAssignmentDeclarationKind ] ) // class (generated) & member
510509 || ( isClassDeclaration ( b . node ) && isEs5ClassMember [ aAssignmentDeclarationKind ] ) // member & class (generated)
511- || ( isClassDeclaration ( a . node ) && isPossibleConstructor ( b . node ) ) // class (generated) & ctor
512- || ( isClassDeclaration ( b . node ) && isPossibleConstructor ( a . node ) ) // ctor & class (generated)
510+ || ( isClassDeclaration ( a . node ) && isSynthesized ( a . node ) && isPossibleConstructor ( b . node ) ) // class (generated) & ctor
511+ || ( isClassDeclaration ( b . node ) && isPossibleConstructor ( a . node ) && isSynthesized ( a . node ) ) // ctor & class (generated)
513512 ) {
514513
515514 let lastANode = a . additionalNodes && lastOrUndefined ( a . additionalNodes ) || a . node ;
@@ -528,11 +527,11 @@ namespace ts.NavigationBar {
528527 const ctor = emptyNavigationBarNode ( ctorNode ) ;
529528 ctor . indent = a . indent + 1 ;
530529 ctor . children = a . node === ctorFunction ? a . children : b . children ;
531- a . children = a . node === ctorFunction ? concatenate ( [ ctor ] , b . children || [ b ] ) : concatenate ( a . children || [ a ] , [ ctor ] ) ;
530+ a . children = a . node === ctorFunction ? concatenate ( [ ctor ] , b . children || [ b ] ) : concatenate ( a . children || [ { ... a } ] , [ ctor ] ) ;
532531 }
533532 else {
534533 if ( a . children || b . children ) {
535- a . children = concatenate ( a . children || [ a ] , b . children || [ b ] ) ;
534+ a . children = concatenate ( a . children || [ { ... a } ] , b . children || [ b ] ) ;
536535 if ( a . children ) {
537536 mergeChildren ( a . children , a ) ;
538537 sortChildren ( a . children ) ;
@@ -612,6 +611,10 @@ namespace ts.NavigationBar {
612611 }
613612 }
614613
614+ function isSynthesized ( node : Node ) {
615+ return ! ! ( node . flags & NodeFlags . Synthesized ) ;
616+ }
617+
615618 // We want to merge own children like `I` in in `module A { interface I {} } module A { interface I {} }`
616619 // We don't want to merge unrelated children like `m` in `const o = { a: { m() {} }, b: { m() {} } };`
617620 function isOwnChild ( n : Node , parent : NavigationBarNode ) : boolean {
0 commit comments