Fix throwing exception from emitFile

This commit is contained in:
Yui T 2014-10-07 21:38:51 -07:00
parent 37a839fcf7
commit 96cdc4f163

View file

@ -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);
}
}