Skip to content

Commit 58f155d

Browse files
author
Yui T
committed
Update checking for semanticErrors and fix spelling
1 parent 54dcf39 commit 58f155d

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/compiler/emitter.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3163,22 +3163,13 @@ module ts {
31633163
}
31643164
}
31653165

3166-
var hasSemanticErros = resolver.hasSemanticErrors();
3167-
var returnCode = EmitReturnStatus.Succeeded;
3166+
var hasSemanticErrors = resolver.hasSemanticErrors();
31683167

31693168
function emitFile(jsFilePath: string, sourceFile?: SourceFile) {
31703169
emitJavaScript(jsFilePath, sourceFile);
3171-
// Update the returnCode with appropriate value depended on whether we have semantic errors
3172-
if (!hasSemanticErros && compilerOptions.declaration) {
3173-
returnCode = EmitReturnStatus.Succeeded;
3170+
if (!hasSemanticErrors && compilerOptions.declaration) {
31743171
emitDeclarations(jsFilePath, sourceFile);
31753172
}
3176-
else if (hasSemanticErros && compilerOptions.declaration) {
3177-
returnCode = EmitReturnStatus.DeclarationGenerationSkipped;
3178-
}
3179-
else if (hasSemanticErros && !compilerOptions.declaration) {
3180-
returnCode = EmitReturnStatus.JSGeneratedWithSemanticErrors;
3181-
}
31823173
}
31833174

31843175
if (targetSourceFile === undefined) {
@@ -3206,8 +3197,16 @@ module ts {
32063197
// Update returnCode if there is any EmitterError
32073198
var hasEmitterError = forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error);
32083199

3200+
// Check and update returnCode for syntactic and semantic
3201+
var returnCode: EmitReturnStatus;
32093202
if (hasEmitterError) {
32103203
returnCode = EmitReturnStatus.EmitErrorsEncountered;
3204+
} else if (hasSemanticErrors && compilerOptions.declaration) {
3205+
returnCode = EmitReturnStatus.DeclarationGenerationSkipped;
3206+
} else if (hasSemanticErrors && !compilerOptions.declaration) {
3207+
returnCode = EmitReturnStatus.JSGeneratedWithSemanticErrors;
3208+
} else {
3209+
returnCode = EmitReturnStatus.Succeeded;
32113210
}
32123211

32133212
return {

0 commit comments

Comments
 (0)