@@ -440,7 +440,14 @@ namespace ts {
440
440
441
441
/* @internal */
442
442
export function parseIsolatedJSDocComment ( content : string , start ?: number , length ?: number ) {
443
- return Parser . JSDocParser . parseIsolatedJSDocComment ( content , start , length ) ;
443
+ const result = Parser . JSDocParser . parseIsolatedJSDocComment ( content , start , length ) ;
444
+ if ( result && result . jsDocComment ) {
445
+ // because the jsDocComment was parsed out of the source file, it might
446
+ // not be covered by the fixupParentReferences.
447
+ Parser . fixupParentReferences ( result . jsDocComment ) ;
448
+ }
449
+
450
+ return result ;
444
451
}
445
452
446
453
/* @internal */
@@ -652,14 +659,14 @@ namespace ts {
652
659
return node ;
653
660
}
654
661
655
- export function fixupParentReferences ( sourceFile : Node ) {
662
+ export function fixupParentReferences ( rootNode : Node ) {
656
663
// normally parent references are set during binding. However, for clients that only need
657
664
// a syntax tree, and no semantic features, then the binding process is an unnecessary
658
665
// overhead. This functions allows us to set all the parents, without all the expense of
659
666
// binding.
660
667
661
- let parent : Node = sourceFile ;
662
- forEachChild ( sourceFile , visitNode ) ;
668
+ let parent : Node = rootNode ;
669
+ forEachChild ( rootNode , visitNode ) ;
663
670
return ;
664
671
665
672
function visitNode ( n : Node ) : void {
0 commit comments