@@ -444,19 +444,7 @@ namespace ts {
444
444
if ( result && result . jsDocComment ) {
445
445
// because the jsDocComment was parsed out of the source file, it might
446
446
// not be covered by the fixupParentReferences.
447
- let parentNode : Node = result . jsDocComment ;
448
- forEachChild ( result . jsDocComment , visitNode ) ;
449
-
450
- function visitNode ( n : Node ) : void {
451
- if ( n . parent === undefined ) {
452
- n . parent = parentNode ;
453
-
454
- const saveParent = parentNode ;
455
- parentNode = n ;
456
- forEachChild ( n , visitNode ) ;
457
- parentNode = saveParent ;
458
- }
459
- }
447
+ Parser . fixupParentReferences ( result . jsDocComment ) ;
460
448
}
461
449
462
450
return result ;
@@ -671,14 +659,14 @@ namespace ts {
671
659
return node ;
672
660
}
673
661
674
- export function fixupParentReferences ( sourceFile : Node ) {
662
+ export function fixupParentReferences ( rootNode : Node ) {
675
663
// normally parent references are set during binding. However, for clients that only need
676
664
// a syntax tree, and no semantic features, then the binding process is an unnecessary
677
665
// overhead. This functions allows us to set all the parents, without all the expense of
678
666
// binding.
679
667
680
- let parent : Node = sourceFile ;
681
- forEachChild ( sourceFile , visitNode ) ;
668
+ let parent : Node = rootNode ;
669
+ forEachChild ( rootNode , visitNode ) ;
682
670
return ;
683
671
684
672
function visitNode ( n : Node ) : void {
0 commit comments