From e74f0f0f59eae020ca9d32bf8e7a8bb99da852f3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 31 Jul 2015 10:40:07 -0700 Subject: [PATCH] Fix issue with exit status by ensuring the same 'diagnostics' variable is reused. --- src/compiler/tsc.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 6872c4c876e..36f8eb226d6 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -355,18 +355,20 @@ namespace ts { return { program, exitStatus }; function compileProgram(): ExitStatus { - // First get any syntactic errors. - let diagnostics = program.getSyntacticDiagnostics(); + let diagnostics: Diagnostic[]; + + // 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) { - let diagnostics = program.getGlobalDiagnostics(); + diagnostics = program.getGlobalDiagnostics(); reportDiagnostics(diagnostics); if (diagnostics.length === 0) { - let diagnostics = program.getSemanticDiagnostics(); + diagnostics = program.getSemanticDiagnostics(); reportDiagnostics(diagnostics); } }