@@ -290,7 +290,7 @@ namespace ts {
290290 return path in files ? createSourceFile ( fileName , files [ path ] , languageVersion ) : undefined ;
291291 } ,
292292 getDefaultLibFileName : ( ) => "lib.d.ts" ,
293- writeFile : ( ) : void => { throw new Error ( "NotImplemented" ) ; } ,
293+ writeFile : notImplemented ,
294294 getCurrentDirectory : ( ) => currentDirectory ,
295295 getDirectories : ( ) => [ ] ,
296296 getCanonicalFileName : fileName => fileName . toLowerCase ( ) ,
@@ -300,7 +300,7 @@ namespace ts {
300300 const path = normalizePath ( combinePaths ( currentDirectory , fileName ) ) ;
301301 return path in files ;
302302 } ,
303- readFile : ( ) : string => { throw new Error ( "NotImplemented" ) ; }
303+ readFile : notImplemented
304304 } ;
305305
306306 const program = createProgram ( rootFiles , options , host ) ;
@@ -370,7 +370,7 @@ export = C;
370370 return path in files ? createSourceFile ( fileName , files [ path ] , languageVersion ) : undefined ;
371371 } ,
372372 getDefaultLibFileName : ( ) => "lib.d.ts" ,
373- writeFile : ( ) : void => { throw new Error ( "NotImplemented" ) ; } ,
373+ writeFile : notImplemented ,
374374 getCurrentDirectory : ( ) => currentDirectory ,
375375 getDirectories : ( ) => [ ] ,
376376 getCanonicalFileName,
@@ -380,7 +380,7 @@ export = C;
380380 const path = getCanonicalFileName ( normalizePath ( combinePaths ( currentDirectory , fileName ) ) ) ;
381381 return path in files ;
382382 } ,
383- readFile : ( ) : string => { throw new Error ( "NotImplemented" ) ; }
383+ readFile : notImplemented
384384 } ;
385385 const program = createProgram ( rootFiles , options , host ) ;
386386 const diagnostics = sortAndDeduplicateDiagnostics ( program . getSemanticDiagnostics ( ) . concat ( program . getOptionsDiagnostics ( ) ) ) ;
@@ -911,15 +911,11 @@ import b = require("./moduleB");
911911 } ) ;
912912 } ) ;
913913
914- function notImplemented ( name : string ) : ( ) => any {
915- return ( ) => assert ( `${ name } is not implemented and should not be called` ) ;
916- }
917-
918914 describe ( "ModuleResolutionHost.directoryExists" , ( ) => {
919915 it ( "No 'fileExists' calls if containing directory is missing" , ( ) => {
920916 const host : ModuleResolutionHost = {
921- readFile : notImplemented ( "readFile" ) ,
922- fileExists : notImplemented ( "fileExists" ) ,
917+ readFile : notImplemented ,
918+ fileExists : notImplemented ,
923919 directoryExists : _ => false
924920 } ;
925921
@@ -1022,9 +1018,7 @@ import b = require("./moduleB");
10221018 fileExists : fileName => fileName in sourceFiles ,
10231019 getSourceFile : fileName => sourceFiles [ fileName ] ,
10241020 getDefaultLibFileName : ( ) => "lib.d.ts" ,
1025- writeFile ( _file , _text ) {
1026- throw new Error ( "NYI" ) ;
1027- } ,
1021+ writeFile : notImplemented ,
10281022 getCurrentDirectory : ( ) => "/" ,
10291023 getDirectories : ( ) => [ ] ,
10301024 getCanonicalFileName : f => f . toLowerCase ( ) ,
0 commit comments