@@ -238,6 +238,7 @@ export class CompilerHost implements ts.CompilerHost {
238
238
private _sourceFiles : collections . SortedMap < string , ts . SourceFile > ;
239
239
private _parseConfigHost : ParseConfigHost | undefined ;
240
240
private _newLine : string ;
241
+ // private _skipJSDocParsing: boolean | undefined;
241
242
242
243
constructor ( sys : System | vfs . FileSystem , options = ts . getDefaultCompilerOptions ( ) , setParentNodes = false ) {
243
244
if ( sys instanceof vfs . FileSystem ) sys = new System ( sys ) ;
@@ -247,6 +248,7 @@ export class CompilerHost implements ts.CompilerHost {
247
248
this . _sourceFiles = new collections . SortedMap < string , ts . SourceFile > ( { comparer : sys . vfs . stringComparer , sort : "insertion" } ) ;
248
249
this . _setParentNodes = setParentNodes ;
249
250
this . _outputsMap = new collections . SortedMap ( this . vfs . stringComparer ) ;
251
+ // this._skipJSDocParsing = options.skipJSDocParsing;
250
252
}
251
253
252
254
public get vfs ( ) {
@@ -335,7 +337,7 @@ export class CompilerHost implements ts.CompilerHost {
335
337
return vpath . resolve ( this . getDefaultLibLocation ( ) , ts . getDefaultLibFileName ( options ) ) ;
336
338
}
337
339
338
- public getSourceFile ( fileName : string , languageVersion : number ) : ts . SourceFile | undefined {
340
+ public getSourceFile ( fileName : string , languageVersionOrOptions : ts . ScriptTarget | ts . CreateSourceFileOptions ) : ts . SourceFile | undefined {
339
341
const canonicalFileName = this . getCanonicalFileName ( vpath . resolve ( this . getCurrentDirectory ( ) , fileName ) ) ;
340
342
const existing = this . _sourceFiles . get ( canonicalFileName ) ;
341
343
if ( existing ) return existing ;
@@ -349,7 +351,7 @@ export class CompilerHost implements ts.CompilerHost {
349
351
// reused across multiple tests. In that case, we cache the SourceFile we parse
350
352
// so that it can be reused across multiple tests to avoid the cost of
351
353
// 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 } ]` ;
353
355
if ( cacheKey ) {
354
356
const meta = this . vfs . filemeta ( canonicalFileName ) ;
355
357
const sourceFileFromMetadata = meta . get ( cacheKey ) as ts . SourceFile | undefined ;
@@ -359,7 +361,7 @@ export class CompilerHost implements ts.CompilerHost {
359
361
}
360
362
}
361
363
362
- const parsed = ts . createSourceFile ( fileName , content , languageVersion , this . _setParentNodes || this . shouldAssertInvariants ) ;
364
+ const parsed = ts . createSourceFile ( fileName , content , languageVersionOrOptions , this . _setParentNodes || this . shouldAssertInvariants ) ;
363
365
if ( this . shouldAssertInvariants ) {
364
366
Utils . assertInvariants ( parsed , /*parent*/ undefined ) ;
365
367
}
0 commit comments