mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Address PR: merge two functions to get-default-library-file
This commit is contained in:
@@ -827,8 +827,8 @@ namespace Harness {
|
||||
return libFileNameSourceFileMap[fileName];
|
||||
}
|
||||
|
||||
export function getDefaultLibSourceFile(languageVersion: ts.ScriptTarget) {
|
||||
return languageVersion === ts.ScriptTarget.ES6 ? getDefaultLibrarySourceFile(es2015DefaultLibFileName) : getDefaultLibrarySourceFile(defaultLibFileName);
|
||||
export function getDefaultLibFileName(options: ts.CompilerOptions): string {
|
||||
return options.target === ts.ScriptTarget.ES6 ? es2015DefaultLibFileName : defaultLibFileName
|
||||
}
|
||||
|
||||
// Cache these between executions so we don't have to re-parse them for every test
|
||||
@@ -887,7 +887,7 @@ namespace Harness {
|
||||
return {
|
||||
getCurrentDirectory: () => currentDirectory,
|
||||
getSourceFile,
|
||||
getDefaultLibFileName: options => options.target === ts.ScriptTarget.ES6 ? es2015DefaultLibFileName : defaultLibFileName,
|
||||
getDefaultLibFileName,
|
||||
writeFile,
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
|
||||
@@ -156,7 +156,7 @@ class ProjectRunner extends RunnerBase {
|
||||
function getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile {
|
||||
let sourceFile: ts.SourceFile = undefined;
|
||||
if (fileName === Harness.Compiler.defaultLibFileName) {
|
||||
sourceFile = Harness.Compiler.getDefaultLibSourceFile(languageVersion);
|
||||
sourceFile = Harness.Compiler.getDefaultLibrarySourceFile(Harness.Compiler.getDefaultLibFileName(compilerOptions));
|
||||
}
|
||||
else {
|
||||
const text = getSourceFileText(fileName);
|
||||
|
||||
Reference in New Issue
Block a user