From 58f155d06bd3aefcc6034d45051bee2d7c0487d2 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 16 Sep 2014 15:19:02 -0700 Subject: [PATCH] Update checking for semanticErrors and fix spelling --- src/compiler/emitter.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f3375a4d9e0..1e6f260f706 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3163,22 +3163,13 @@ module ts { } } - var hasSemanticErros = resolver.hasSemanticErrors(); - var returnCode = EmitReturnStatus.Succeeded; + var hasSemanticErrors = resolver.hasSemanticErrors(); function emitFile(jsFilePath: string, sourceFile?: SourceFile) { emitJavaScript(jsFilePath, sourceFile); - // Update the returnCode with appropriate value depended on whether we have semantic errors - if (!hasSemanticErros && compilerOptions.declaration) { - returnCode = EmitReturnStatus.Succeeded; + if (!hasSemanticErrors && compilerOptions.declaration) { emitDeclarations(jsFilePath, sourceFile); } - else if (hasSemanticErros && compilerOptions.declaration) { - returnCode = EmitReturnStatus.DeclarationGenerationSkipped; - } - else if (hasSemanticErros && !compilerOptions.declaration) { - returnCode = EmitReturnStatus.JSGeneratedWithSemanticErrors; - } } if (targetSourceFile === undefined) { @@ -3206,8 +3197,16 @@ module ts { // Update returnCode if there is any EmitterError var hasEmitterError = forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error); + // Check and update returnCode for syntactic and semantic + var returnCode: EmitReturnStatus; if (hasEmitterError) { returnCode = EmitReturnStatus.EmitErrorsEncountered; + } else if (hasSemanticErrors && compilerOptions.declaration) { + returnCode = EmitReturnStatus.DeclarationGenerationSkipped; + } else if (hasSemanticErrors && !compilerOptions.declaration) { + returnCode = EmitReturnStatus.JSGeneratedWithSemanticErrors; + } else { + returnCode = EmitReturnStatus.Succeeded; } return {