Revert to old tryLoad implementation

This commit is contained in:
Andy Hanson 2016-06-01 11:44:12 -07:00
parent 9179f4ca42
commit 9575b3c3ca

View file

@ -643,15 +643,13 @@ namespace ts {
onlyRecordFailures = !directoryProbablyExists(directory, state.host); onlyRecordFailures = !directoryProbablyExists(directory, state.host);
} }
} }
return forEach(extensions, tryLoad);
return forEach(extensions, ext => { function tryLoad(ext: string): string {
if (state.skipTsx && (ext === ".jsx" || ext === ".tsx")) { if (state.skipTsx && (ext === ".jsx" || ext === ".tsx")) {
return; return undefined;
} }
return tryLoad(fileExtensionIs(candidate, ext) ? candidate : candidate + ext); const fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext;
});
function tryLoad(fileName: string): string {
if (!onlyRecordFailures && state.host.fileExists(fileName)) { if (!onlyRecordFailures && state.host.fileExists(fileName)) {
if (state.traceEnabled) { if (state.traceEnabled) {
trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);