Use one call to 'reportDiagnostics'.

This commit is contained in:
Daniel Rosenwasser
2015-07-31 10:47:36 -07:00
parent 074a33d120
commit 8b8a138bd0

View File

@@ -359,20 +359,19 @@ namespace ts {
// First get and report any syntactic errors.
diagnostics = program.getSyntacticDiagnostics();
reportDiagnostics(diagnostics);
// If we didn't have any syntactic errors, then also try getting the global and
// semantic errors.
if (diagnostics.length === 0) {
diagnostics = program.getGlobalDiagnostics();
reportDiagnostics(diagnostics);
if (diagnostics.length === 0) {
diagnostics = program.getSemanticDiagnostics();
reportDiagnostics(diagnostics);
}
}
reportDiagnostics(diagnostics);
// If the user doesn't want us to emit, then we're done at this point.
if (compilerOptions.noEmit) {
return diagnostics.length