@@ -476,6 +476,8 @@ namespace ts.FindAllReferences.Core {
476
476
*/
477
477
readonly markSeenReExportRHS = nodeSeenTracker ( ) ;
478
478
479
+ private readonly includedSourceFiles : Map < true > ;
480
+
479
481
constructor (
480
482
readonly sourceFiles : ReadonlyArray < SourceFile > ,
481
483
/** True if we're searching for constructor references. */
@@ -484,7 +486,13 @@ namespace ts.FindAllReferences.Core {
484
486
readonly cancellationToken : CancellationToken ,
485
487
readonly searchMeaning : SemanticMeaning ,
486
488
readonly options : Options ,
487
- private readonly result : Push < SymbolAndEntries > ) { }
489
+ private readonly result : Push < SymbolAndEntries > ) {
490
+ this . includedSourceFiles = arrayToSet ( sourceFiles , s => s . fileName ) ;
491
+ }
492
+
493
+ includesSourceFile ( sourceFile : SourceFile ) : boolean {
494
+ return this . includedSourceFiles . has ( sourceFile . fileName ) ;
495
+ }
488
496
489
497
private importTracker : ImportTracker | undefined ;
490
498
/** Gets every place to look for references of an exported symbols. See `ImportsResult` in `importTracker.ts` for more documentation. */
@@ -586,7 +594,10 @@ namespace ts.FindAllReferences.Core {
586
594
// Go to the symbol we imported from and find references for it.
587
595
function searchForImportedSymbol ( symbol : Symbol , state : State ) : void {
588
596
for ( const declaration of symbol . declarations ) {
589
- getReferencesInSourceFile ( declaration . getSourceFile ( ) , state . createSearch ( declaration , symbol , ImportExport . Import ) , state ) ;
597
+ const exportingFile = declaration . getSourceFile ( ) ;
598
+ if ( state . includesSourceFile ( exportingFile ) ) {
599
+ getReferencesInSourceFile ( exportingFile , state . createSearch ( declaration , symbol , ImportExport . Import ) , state ) ;
600
+ }
590
601
}
591
602
}
592
603
0 commit comments