@@ -3163,22 +3163,13 @@ module ts {
3163
3163
}
3164
3164
}
3165
3165
3166
- var hasSemanticErros = resolver . hasSemanticErrors ( ) ;
3167
- var returnCode = EmitReturnStatus . Succeeded ;
3166
+ var hasSemanticErrors = resolver . hasSemanticErrors ( ) ;
3168
3167
3169
3168
function emitFile ( jsFilePath : string , sourceFile ?: SourceFile ) {
3170
3169
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 ) {
3174
3171
emitDeclarations ( jsFilePath , sourceFile ) ;
3175
3172
}
3176
- else if ( hasSemanticErros && compilerOptions . declaration ) {
3177
- returnCode = EmitReturnStatus . DeclarationGenerationSkipped ;
3178
- }
3179
- else if ( hasSemanticErros && ! compilerOptions . declaration ) {
3180
- returnCode = EmitReturnStatus . JSGeneratedWithSemanticErrors ;
3181
- }
3182
3173
}
3183
3174
3184
3175
if ( targetSourceFile === undefined ) {
@@ -3206,8 +3197,16 @@ module ts {
3206
3197
// Update returnCode if there is any EmitterError
3207
3198
var hasEmitterError = forEach ( diagnostics , diagnostic => diagnostic . category === DiagnosticCategory . Error ) ;
3208
3199
3200
+ // Check and update returnCode for syntactic and semantic
3201
+ var returnCode : EmitReturnStatus ;
3209
3202
if ( hasEmitterError ) {
3210
3203
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 ;
3211
3210
}
3212
3211
3213
3212
return {
0 commit comments