Removed Diagnostics from sys.ts in order to avoid cyclical build dependency.
Specifically, processDiagnosticMessages.ts was dependent on sys.ts, which was dependent on the rest of the compiler, which meant that in a broken state of diagnostics, you could never compile processDiagnosticMessages.ts.
This commit is contained in:
parent
a6eb698f5b
commit
aac8b3fae5
|
@ -27,6 +27,10 @@ declare var module: any;
|
|||
declare var process: any;
|
||||
declare var global: any;
|
||||
|
||||
enum SystemError {
|
||||
UnsupportedFileEncoding
|
||||
}
|
||||
|
||||
var sys: System = (function () {
|
||||
|
||||
function getWScriptSystem(): System {
|
||||
|
@ -68,7 +72,9 @@ var sys: System = (function () {
|
|||
return fileStream.ReadText();
|
||||
}
|
||||
catch (e) {
|
||||
throw e.number === -2147024809 ? new Error(ts.Diagnostics.Unsupported_file_encoding.key) : e;
|
||||
if (e.number === -2147024809) {
|
||||
e.systemError = SystemError.UnsupportedFileEncoding;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
fileStream.Close();
|
||||
|
|
|
@ -71,6 +71,15 @@ module ts {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getSystemErrorMessage(e: SystemError): string {
|
||||
switch (e) {
|
||||
case SystemError.UnsupportedFileEncoding:
|
||||
return getDiagnosticText(Diagnostics.Unsupported_file_encoding);
|
||||
default:
|
||||
Debug.assert("Unreachable code in 'getSystemErrorMessage'");
|
||||
}
|
||||
}
|
||||
|
||||
function countLines(program: Program): number {
|
||||
var count = 0;
|
||||
|
@ -149,7 +158,7 @@ module ts {
|
|||
}
|
||||
catch (e) {
|
||||
if (onError) {
|
||||
onError(e.message);
|
||||
onError(e.systemError ? getSystemErrorMessage(e.systemError) : e.message);
|
||||
}
|
||||
text = "";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue