Emit error codes when reporting diagnostics.

Addresses part of issue #506.
This commit is contained in:
Daniel Rosenwasser 2014-08-21 16:52:39 -07:00
parent 16d1cfd29d
commit 07d56898ee

View File

@ -86,13 +86,18 @@ module ts {
}
function reportDiagnostic(diagnostic: Diagnostic) {
var output = "";
if (diagnostic.file) {
var loc = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
sys.write(diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): " + diagnostic.messageText + sys.newLine);
}
else {
sys.write(diagnostic.messageText + sys.newLine);
var output = diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): ";
}
var category = DiagnosticCategory[diagnostic.category];
output += category + " TS" + diagnostic.code + ": " + diagnostic.messageText + sys.newLine;
sys.write(output);
}
function reportDiagnostics(diagnostics: Diagnostic[]) {