File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ namespace ts {
13
13
const rawSources : string [ ] = [ ] ;
14
14
const sources : string [ ] = [ ] ;
15
15
const sourceToSourceIndexMap = new Map < string , number > ( ) ;
16
+ const fileNameToSourceIndexMap = new Map < string , number > ( ) ;
16
17
let sourcesContent : ( string | null ) [ ] | undefined ;
17
18
18
19
const names : string [ ] = [ ] ;
@@ -51,6 +52,10 @@ namespace ts {
51
52
52
53
function addSource ( fileName : string ) {
53
54
enter ( ) ;
55
+ const sourceIndexByFileName = fileNameToSourceIndexMap . get ( fileName ) ;
56
+ if ( sourceIndexByFileName !== undefined ) {
57
+ return sourceIndexByFileName ;
58
+ }
54
59
const source = getRelativePathToDirectoryOrUrl ( sourcesDirectoryPath ,
55
60
fileName ,
56
61
host . getCurrentDirectory ( ) ,
@@ -64,6 +69,7 @@ namespace ts {
64
69
rawSources . push ( fileName ) ;
65
70
sourceToSourceIndexMap . set ( source , sourceIndex ) ;
66
71
}
72
+ fileNameToSourceIndexMap . set ( fileName , sourceIndex ) ;
67
73
exit ( ) ;
68
74
return sourceIndex ;
69
75
}
You can’t perform that action at this time.
0 commit comments