File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ namespace ts {
202202 */
203203 function createFileMap < T > ( ) : FileMap < T > {
204204 // tslint:disable-next-line:no-null-keyword
205- const lookup : { [ key : string ] : T } = Object . create ( /*prototype*/ null ) ;
205+ const lookup = createMap < T > ( ) ;
206206
207207 return {
208208 setValue,
@@ -218,21 +218,21 @@ namespace ts {
218218 }
219219
220220 function hasKey ( fileName : string ) {
221- return normalizePath ( fileName ) in lookup ;
221+ return lookup . has ( normalizePath ( fileName ) ) ;
222222 }
223223
224224 function removeKey ( fileName : string ) {
225- delete lookup [ fileName ] ;
225+ lookup . delete ( normalizePath ( fileName ) ) ;
226226 }
227227
228228 function setValue ( fileName : string , value : T ) {
229- lookup [ normalizePath ( fileName ) ] = value ;
229+ lookup . set ( normalizePath ( fileName ) , value ) ;
230230 }
231231
232232 function getValue ( fileName : string ) : T | never {
233233 const f = normalizePath ( fileName ) ;
234- if ( f in lookup ) {
235- return lookup [ f ] ;
234+ if ( lookup . has ( f ) ) {
235+ return lookup . get ( f ) ! ;
236236 }
237237 else {
238238 throw new Error ( `No value corresponding to ${ fileName } exists in this map` ) ;
@@ -241,12 +241,7 @@ namespace ts {
241241
242242 function getValueOrUndefined ( fileName : string ) : T | undefined {
243243 const f = normalizePath ( fileName ) ;
244- if ( f in lookup ) {
245- return lookup [ f ] ;
246- }
247- else {
248- return undefined ;
249- }
244+ return lookup . get ( f ) ;
250245 }
251246 }
252247
You can’t perform that action at this time.
0 commit comments