Merge branch 'fixMissingScriptInfo' into tsbuild

This commit is contained in:
Ryan Cavanaugh 2018-06-04 10:59:42 -07:00
commit 9b0dc37f42
4 changed files with 6 additions and 3 deletions

View File

@ -990,7 +990,7 @@ namespace ts {
for (const oldSourceFile of oldSourceFiles) {
let newSourceFile = host.getSourceFileByPath
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target!, /*onError*/ undefined, shouldCreateNewSourceFile)
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath || oldSourceFile.path, options.target!, /*onError*/ undefined, shouldCreateNewSourceFile)
: host.getSourceFile(oldSourceFile.fileName, options.target!, /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217
if (!newSourceFile) {
@ -1994,6 +1994,7 @@ namespace ts {
if (file) {
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
file.path = path;
file.resolvedPath = toPath(fileName);
if (host.useCaseSensitiveFileNames()) {
const pathLowerCase = path.toLowerCase();

View File

@ -2551,6 +2551,7 @@ namespace ts {
fileName: string;
/* @internal */ path: Path;
text: string;
/* @internal */ resolvedPath: Path;
/**
* If two source files are for the same version of the same package, one will redirect to the other.

View File

@ -629,8 +629,8 @@ namespace ts.server {
return this.rootFiles;
}
return map(this.program.getSourceFiles(), sourceFile => {
const scriptInfo = this.projectService.getScriptInfoForPath(sourceFile.path);
Debug.assert(!!scriptInfo, "getScriptInfo", () => `scriptInfo for a file '${sourceFile.fileName}' Path: '${sourceFile.path}' is missing.`);
const scriptInfo = this.projectService.getScriptInfoForPath(sourceFile.resolvedPath || sourceFile.path);
Debug.assert(!!scriptInfo, "getScriptInfo", () => `scriptInfo for a file '${sourceFile.fileName}' Path: '${sourceFile.path}' / '${sourceFile.resolvedPath}' is missing.`);
return scriptInfo!;
});
}

View File

@ -540,6 +540,7 @@ namespace ts {
public _declarationBrand: any;
public fileName: string;
public path: Path;
public resolvedPath: Path;
public text: string;
public scriptSnapshot: IScriptSnapshot;
public lineMap: ReadonlyArray<number>;