@@ -48,11 +48,6 @@ namespace ts {
48
48
*/
49
49
readonly exportedModulesMap : BuilderState . ManyToManyPathMap | undefined ;
50
50
51
- previousCache ?: {
52
- id : number ,
53
- version : number ,
54
- } ;
55
-
56
51
/**
57
52
* true if file version is used as signature
58
53
* This helps in delaying the calculation of the d.ts hash as version for the file till reasonable time
@@ -86,7 +81,6 @@ namespace ts {
86
81
}
87
82
88
83
export interface ReadonlyManyToManyPathMap {
89
- readonly id : number ;
90
84
clone ( ) : ManyToManyPathMap ;
91
85
forEach ( action : ( v : ReadonlySet < Path > , k : Path ) => void ) : void ;
92
86
getKeys ( v : Path ) : ReadonlySet < Path > | undefined ;
@@ -103,18 +97,13 @@ namespace ts {
103
97
}
104
98
105
99
export interface ManyToManyPathMap extends ReadonlyManyToManyPathMap {
106
- version ( ) : number ; // Incremented each time the contents are changed
107
100
deleteKey ( k : Path ) : boolean ;
108
101
set ( k : Path , v : ReadonlySet < Path > ) : void ;
109
102
}
110
103
111
- let manyToManyPathMapCount = 0 ;
112
104
export function createManyToManyPathMap ( ) : ManyToManyPathMap {
113
105
function create ( forward : ESMap < Path , ReadonlySet < Path > > , reverse : ESMap < Path , Set < Path > > , deleted : Set < Path > | undefined ) : ManyToManyPathMap {
114
- let version = 0 ;
115
106
const map : ManyToManyPathMap = {
116
- id : manyToManyPathMapCount ++ ,
117
- version : ( ) => version ,
118
107
clone : ( ) => create ( new Map ( forward ) , new Map ( reverse ) , deleted && new Set ( deleted ) ) ,
119
108
forEach : fn => forward . forEach ( fn ) ,
120
109
getKeys : v => reverse . get ( v ) ,
@@ -133,33 +122,26 @@ namespace ts {
133
122
134
123
set . forEach ( v => deleteFromMultimap ( reverse , v , k ) ) ;
135
124
forward . delete ( k ) ;
136
- version ++ ;
137
125
return true ;
138
126
} ,
139
127
set : ( k , vSet ) => {
140
- let changed = ! ! deleted ?. delete ( k ) ;
128
+ deleted ?. delete ( k ) ;
141
129
142
130
const existingVSet = forward . get ( k ) ;
143
131
forward . set ( k , vSet ) ;
144
132
145
133
existingVSet ?. forEach ( v => {
146
134
if ( ! vSet . has ( v ) ) {
147
- changed = true ;
148
135
deleteFromMultimap ( reverse , v , k ) ;
149
136
}
150
137
} ) ;
151
138
152
139
vSet . forEach ( v => {
153
140
if ( ! existingVSet ?. has ( v ) ) {
154
- changed = true ;
155
141
addToMultimap ( reverse , v , k ) ;
156
142
}
157
143
} ) ;
158
144
159
- if ( changed ) {
160
- version ++ ;
161
- }
162
-
163
145
return map ;
164
146
} ,
165
147
} ;
@@ -494,22 +476,6 @@ namespace ts {
494
476
export function updateExportedFilesMapFromCache ( state : BuilderState , exportedModulesMapCache : ManyToManyPathMap | undefined ) {
495
477
if ( exportedModulesMapCache ) {
496
478
Debug . assert ( ! ! state . exportedModulesMap ) ;
497
-
498
- const cacheId = exportedModulesMapCache . id ;
499
- const cacheVersion = exportedModulesMapCache . version ( ) ;
500
- if ( state . previousCache ) {
501
- if ( state . previousCache . id === cacheId && state . previousCache . version === cacheVersion ) {
502
- // If this is the same cache at the same version as last time this BuilderState
503
- // was updated, there's no need to update again
504
- return ;
505
- }
506
- state . previousCache . id = cacheId ;
507
- state . previousCache . version = cacheVersion ;
508
- }
509
- else {
510
- state . previousCache = { id : cacheId , version : cacheVersion } ;
511
- }
512
-
513
479
exportedModulesMapCache . deletedKeys ( ) ?. forEach ( path => state . exportedModulesMap ! . deleteKey ( path ) ) ;
514
480
exportedModulesMapCache . forEach ( ( exportedModules , path ) => state . exportedModulesMap ! . set ( path , exportedModules ) ) ;
515
481
}
0 commit comments