From cd6eb180c6a87a91a0d0d0fc6310b2088be42f2e Mon Sep 17 00:00:00 2001 From: Arnavion Date: Tue, 16 Dec 2014 20:25:19 -0800 Subject: [PATCH] Don't emit outputs when -noEmit is specified. --- src/compiler/tsc.ts | 3 +++ src/compiler/types.ts | 2 +- tests/cases/fourslash/fourslash.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index bc4d48b7513..32725bfe0fc 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -296,6 +296,9 @@ module ts { if (checker.isEmitBlocked()) { exitStatus = EmitReturnStatus.AllOutputGenerationSkipped; } + else if (compilerOptions.noEmit) { + exitStatus = EmitReturnStatus.Succeeded; + } else { var emitStart = new Date().getTime(); var emitOutput = checker.emitFiles(); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9ed58746922..c44c148c6ae 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -943,7 +943,7 @@ module ts { // Return code used by getEmitOutput function to indicate status of the function export enum EmitReturnStatus { - Succeeded = 0, // All outputs generated as requested (.js, .map, .d.ts), no errors reported + Succeeded = 0, // All outputs generated if requested (.js, .map, .d.ts), no errors reported AllOutputGenerationSkipped = 1, // No .js generated because of syntax errors, nothing generated JSGeneratedWithSemanticErrors = 2, // .js and .map generated with semantic errors DeclarationGenerationSkipped = 3, // .d.ts generation skipped because of semantic errors or declaration emitter specific errors; Output .js with semantic errors diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index f5a582868e5..9ad1734178d 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -34,7 +34,7 @@ declare var FourSlash; // Return code used by getEmitOutput function to indicate status of the function // It is a duplicate of the one in types.ts to expose it to testcases in fourslash enum EmitReturnStatus { - Succeeded = 0, // All outputs generated as requested (.js, .map, .d.ts), no errors reported + Succeeded = 0, // All outputs generated if requested (.js, .map, .d.ts), no errors reported AllOutputGenerationSkipped = 1, // No .js generated because of syntax errors, or compiler options errors, nothing generated JSGeneratedWithSemanticErrors = 2, // .js and .map generated with semantic errors DeclarationGenerationSkipped = 3, // .d.ts generation skipped because of semantic errors or declaration emitter specific errors; Output .js with semantic errors