From 3b896f5837fc284d103aad6f78acdaaf2216cbc6 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 7 Oct 2014 21:38:51 -0700 Subject: [PATCH] Dix throwing exception from emitting file --- src/compiler/emitter.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 1e1c57f5700..61ff5f90906 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3243,13 +3243,15 @@ module ts { emitFile(compilerOptions.out); } } else { - // targetSourceFile is specified (e.g calling emitter from language service) - if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + // targetSourceFile is specified (e.g calling emitter from language service or user language service getSemanticDiagnostic) + var shouldEmitTargetToOwnFile = shouldEmitToOwnFile(targetSourceFile, compilerOptions); + if (shouldEmitTargetToOwnFile) { // If shouldEmitToOwnFile is true or targetSourceFile is an external module file, then emit targetSourceFile in its own output file var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, ".js"); emitFile(jsFilePath, targetSourceFile); - } else { - // If shouldEmitToOwnFile is false, then emit all, non-external-module file, into one single output file + } + else if (!shouldEmitTargetToOwnFile && compilerOptions.out) { + // If shouldEmitToOwnFile is false and --out is specified, then emit all, non-external-module file, into one single output file emitFile(compilerOptions.out); } }