@@ -238,6 +238,7 @@ export class CompilerHost implements ts.CompilerHost {
238238 private _sourceFiles : collections . SortedMap < string , ts . SourceFile > ;
239239 private _parseConfigHost : ParseConfigHost | undefined ;
240240 private _newLine : string ;
241+ // private _skipJSDocParsing: boolean | undefined;
241242
242243 constructor ( sys : System | vfs . FileSystem , options = ts . getDefaultCompilerOptions ( ) , setParentNodes = false ) {
243244 if ( sys instanceof vfs . FileSystem ) sys = new System ( sys ) ;
@@ -247,6 +248,7 @@ export class CompilerHost implements ts.CompilerHost {
247248 this . _sourceFiles = new collections . SortedMap < string , ts . SourceFile > ( { comparer : sys . vfs . stringComparer , sort : "insertion" } ) ;
248249 this . _setParentNodes = setParentNodes ;
249250 this . _outputsMap = new collections . SortedMap ( this . vfs . stringComparer ) ;
251+ // this._skipJSDocParsing = options.skipJSDocParsing;
250252 }
251253
252254 public get vfs ( ) {
@@ -335,7 +337,7 @@ export class CompilerHost implements ts.CompilerHost {
335337 return vpath . resolve ( this . getDefaultLibLocation ( ) , ts . getDefaultLibFileName ( options ) ) ;
336338 }
337339
338- public getSourceFile ( fileName : string , languageVersion : number ) : ts . SourceFile | undefined {
340+ public getSourceFile ( fileName : string , languageVersionOrOptions : ts . ScriptTarget | ts . CreateSourceFileOptions ) : ts . SourceFile | undefined {
339341 const canonicalFileName = this . getCanonicalFileName ( vpath . resolve ( this . getCurrentDirectory ( ) , fileName ) ) ;
340342 const existing = this . _sourceFiles . get ( canonicalFileName ) ;
341343 if ( existing ) return existing ;
@@ -349,7 +351,7 @@ export class CompilerHost implements ts.CompilerHost {
349351 // reused across multiple tests. In that case, we cache the SourceFile we parse
350352 // so that it can be reused across multiple tests to avoid the cost of
351353 // repeatedly parsing the same file over and over (such as lib.d.ts).
352- const cacheKey = this . vfs . shadowRoot && `SourceFile[languageVersion =${ languageVersion } ,setParentNodes=${ this . _setParentNodes } ]` ;
354+ const cacheKey = this . vfs . shadowRoot && `SourceFile[languageVersionOrOptions =${ languageVersionOrOptions !== undefined ? JSON . stringify ( languageVersionOrOptions ) : undefined } ,setParentNodes=${ this . _setParentNodes } ]` ;
353355 if ( cacheKey ) {
354356 const meta = this . vfs . filemeta ( canonicalFileName ) ;
355357 const sourceFileFromMetadata = meta . get ( cacheKey ) as ts . SourceFile | undefined ;
@@ -359,7 +361,7 @@ export class CompilerHost implements ts.CompilerHost {
359361 }
360362 }
361363
362- const parsed = ts . createSourceFile ( fileName , content , languageVersion , this . _setParentNodes || this . shouldAssertInvariants ) ;
364+ const parsed = ts . createSourceFile ( fileName , content , languageVersionOrOptions , this . _setParentNodes || this . shouldAssertInvariants ) ;
363365 if ( this . shouldAssertInvariants ) {
364366 Utils . assertInvariants ( parsed , /*parent*/ undefined ) ;
365367 }
0 commit comments