From cfc164b044d332e375cf0737a2a70941355aec03 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 20 Aug 2015 15:58:57 -0700 Subject: [PATCH 1/2] Consolidate option error messages into two --- .../diagnosticInformationMap.generated.ts | 13 +---- src/compiler/diagnosticMessages.json | 56 ++++--------------- src/compiler/program.ts | 28 ++++++---- .../reference/inlineSourceMap2.errors.txt | 12 ++-- .../isolatedModulesDeclaration.errors.txt | 4 +- .../isolatedModulesNoEmitOnError.errors.txt | 4 +- .../reference/isolatedModulesOut.errors.txt | 4 +- ...SourceRootWithNoSourceMapOption.errors.txt | 8 +-- ...SourceRootWithNoSourceMapOption.errors.txt | 8 +-- .../mapRootWithNoSourceMapOption.errors.txt | 4 +- .../mapRootWithNoSourceMapOption.errors.txt | 4 +- ...sourceRootWithNoSourceMapOption.errors.txt | 4 +- ...sourceRootWithNoSourceMapOption.errors.txt | 4 +- 13 files changed, 56 insertions(+), 97 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 5ccc0a0db9b..df3693fd99c 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -506,19 +506,11 @@ namespace ts { Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, - Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." }, - Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." }, - Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, - Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, - Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, - Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, + Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, + Option_0_cannot_be_specified_with_option_1: { code: 5053, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -569,7 +561,6 @@ namespace ts { Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, - Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e138e2ddac4..f17ceb96758 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2013,59 +2013,27 @@ "category": "Error", "code": 5033 }, - "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.": { - "category": "Error", - "code": 5038 - }, - "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.": { - "category": "Error", - "code": 5039 - }, - "Option 'noEmit' cannot be specified with option 'out' or 'outDir'.": { - "category": "Error", - "code": 5040 - }, - "Option 'noEmit' cannot be specified with option 'declaration'.": { - "category": "Error", - "code": 5041 - }, "Option 'project' cannot be mixed with source files on a command line.": { "category": "Error", "code": 5042 }, - "Option 'declaration' cannot be specified with option 'isolatedModules'.": { - "category": "Error", - "code": 5044 - }, - "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.": { - "category": "Error", - "code": 5045 - }, - "Option 'out' cannot be specified with option 'isolatedModules'.": { - "category": "Error", - "code": 5046 - }, "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": { "category": "Error", "code": 5047 }, - "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.": { - "category": "Error", - "code": 5048 - }, - "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.": { - "category": "Error", - "code": 5049 - }, - "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.": { - "category": "Error", - "code": 5050 - }, "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": { "category": "Error", "code": 5051 }, - + "Option '{0}' cannot be specified without specifying option '{1}'.": { + "category": "Error", + "code": 5052 + }, + "Option '{0}' cannot be specified with option '{1}'.": { + "category": "Error", + "code": 5053 + }, + "Concatenate and emit output to single file.": { "category": "Message", "code": 6001 @@ -2266,10 +2234,6 @@ "category": "Message", "code": 6081 }, - "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified.": { - "category": "Error", - "code": 6064 - }, "Enables experimental support for ES7 decorators.": { "category": "Message", "code": 6065 @@ -2286,7 +2250,7 @@ "category": "Message", "code": 6068 }, - + "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 07f08952d24..550d21149f0 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -794,27 +794,27 @@ namespace ts { function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } @@ -828,10 +828,10 @@ namespace ts { if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } @@ -886,18 +886,22 @@ namespace ts { } if (options.noEmit) { - if (options.out || options.outDir) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_out_or_outDir)); + if (options.out) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + } + + if (options.outDir) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && diff --git a/tests/baselines/reference/inlineSourceMap2.errors.txt b/tests/baselines/reference/inlineSourceMap2.errors.txt index 2d8bc4be0c1..24b0fddf942 100644 --- a/tests/baselines/reference/inlineSourceMap2.errors.txt +++ b/tests/baselines/reference/inlineSourceMap2.errors.txt @@ -1,12 +1,12 @@ -error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. -error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. -error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. +error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. tests/cases/compiler/inlineSourceMap2.ts(5,1): error TS2304: Cannot find name 'console'. -!!! error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. -!!! error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. -!!! error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +!!! error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +!!! error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. +!!! error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. ==== tests/cases/compiler/inlineSourceMap2.ts (1 errors) ==== // configuration errors diff --git a/tests/baselines/reference/isolatedModulesDeclaration.errors.txt b/tests/baselines/reference/isolatedModulesDeclaration.errors.txt index de5cb97586c..749e86116e8 100644 --- a/tests/baselines/reference/isolatedModulesDeclaration.errors.txt +++ b/tests/baselines/reference/isolatedModulesDeclaration.errors.txt @@ -1,7 +1,7 @@ -error TS5044: Option 'declaration' cannot be specified with option 'isolatedModules'. +error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'. -!!! error TS5044: Option 'declaration' cannot be specified with option 'isolatedModules'. +!!! error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'. ==== tests/cases/compiler/isolatedModulesDeclaration.ts (0 errors) ==== export var x; \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt b/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt index 68b2747cf6b..337fcb16ba3 100644 --- a/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt +++ b/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt @@ -1,7 +1,7 @@ -error TS5045: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'. +error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'. -!!! error TS5045: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'. +!!! error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'. ==== tests/cases/compiler/isolatedModulesNoEmitOnError.ts (0 errors) ==== export var x; \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesOut.errors.txt b/tests/baselines/reference/isolatedModulesOut.errors.txt index 8234ba94585..7d16ac94666 100644 --- a/tests/baselines/reference/isolatedModulesOut.errors.txt +++ b/tests/baselines/reference/isolatedModulesOut.errors.txt @@ -1,8 +1,8 @@ -error TS5046: Option 'out' cannot be specified with option 'isolatedModules'. +error TS5053: Option 'out' cannot be specified with option 'isolatedModules'. tests/cases/compiler/file2.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. -!!! error TS5046: Option 'out' cannot be specified with option 'isolatedModules'. +!!! error TS5053: Option 'out' cannot be specified with option 'isolatedModules'. ==== tests/cases/compiler/file1.ts (0 errors) ==== export var x; diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt index bef02272064..44d2c93d9a5 100644 --- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt @@ -1,9 +1,9 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. +error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. +!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt index bef02272064..44d2c93d9a5 100644 --- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt @@ -1,9 +1,9 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. +error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. +!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt index d00f552ef97..97e3ed02cf9 100644 --- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt index d00f552ef97..97e3ed02cf9 100644 --- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt index f4b65c12f35..56dab79dacf 100644 --- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt index f4b65c12f35..56dab79dacf 100644 --- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { From 00cd8ad7459e4045bc64cb2e2fe9310f72f38972 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 20 Aug 2015 17:37:56 -0700 Subject: [PATCH 2/2] Add --outFile and revert change make --out relative in tsconfig.json --- src/compiler/checker.ts | 2 +- src/compiler/commandLineParser.ts | 7 ++ src/compiler/declarationEmitter.ts | 2 +- src/compiler/emitter.ts | 8 +- src/compiler/program.ts | 17 ++- src/compiler/types.ts | 1 + src/compiler/utilities.ts | 2 +- src/harness/fourslash.ts | 8 +- src/harness/harness.ts | 9 +- src/harness/projectsRunner.ts | 4 +- tests/baselines/reference/out-flag2.js | 27 +++++ tests/baselines/reference/out-flag2.js.map | 2 + .../reference/out-flag2.sourcemap.txt | 104 ++++++++++++++++ tests/baselines/reference/out-flag2.symbols | 9 ++ tests/baselines/reference/out-flag2.types | 9 ++ .../baselines/reference/out-flag3.errors.txt | 12 ++ tests/baselines/reference/out-flag3.js | 30 +++++ tests/baselines/reference/out-flag3.js.map | 2 + .../reference/out-flag3.sourcemap.txt | 114 ++++++++++++++++++ tests/cases/compiler/out-flag2.ts | 11 ++ tests/cases/compiler/out-flag3.ts | 14 +++ 21 files changed, 379 insertions(+), 15 deletions(-) create mode 100644 tests/baselines/reference/out-flag2.js create mode 100644 tests/baselines/reference/out-flag2.js.map create mode 100644 tests/baselines/reference/out-flag2.sourcemap.txt create mode 100644 tests/baselines/reference/out-flag2.symbols create mode 100644 tests/baselines/reference/out-flag2.types create mode 100644 tests/baselines/reference/out-flag3.errors.txt create mode 100644 tests/baselines/reference/out-flag3.js create mode 100644 tests/baselines/reference/out-flag3.js.map create mode 100644 tests/baselines/reference/out-flag3.sourcemap.txt create mode 100644 tests/cases/compiler/out-flag2.ts create mode 100644 tests/cases/compiler/out-flag3.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 23baadd0762..58f0ec42d0c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -388,7 +388,7 @@ namespace ts { return node1.pos <= node2.pos; } - if (!compilerOptions.out) { + if (!compilerOptions.outFile && !compilerOptions.out) { return true; } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 9a984b9a2f1..9fa05a5d43e 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -120,6 +120,13 @@ namespace ts { { name: "out", type: "string", + isFilePath: false, // This is intentionally broken to support compatability with existing tsconfig files + // for correct behaviour, please use outFile + paramType: Diagnostics.FILE, + }, + { + name: "outFile", + type: "string", isFilePath: true, description: Diagnostics.Concatenate_and_emit_output_to_single_file, paramType: Diagnostics.FILE, diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index a490ba39a46..85513e8719f 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -1574,7 +1574,7 @@ namespace ts { ? referencedFile.fileName // Declaration file, use declaration file name : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file - : removeFileExtension(compilerOptions.out) + ".d.ts"; // Global out file + : removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; // Global out file declFileName = getRelativePathToDirectoryOrUrl( getDirectoryPath(normalizeSlashes(jsFilePath)), diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 150cc3321f8..d48ba94f2ea 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -78,8 +78,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } }); - if (compilerOptions.out) { - emitFile(compilerOptions.out); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } else { @@ -88,8 +88,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, forEach(host.getSourceFiles(), shouldEmitJsx) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!isDeclarationFile(targetSourceFile) && compilerOptions.out) { - emitFile(compilerOptions.out); + else if (!isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 550d21149f0..a4cf5febd63 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -413,7 +413,7 @@ namespace ts { // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); + let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out)? undefined : sourceFile); let start = new Date().getTime(); @@ -804,6 +804,10 @@ namespace ts { if (options.out) { diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); } + + if (options.outFile) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + } } if (options.inlineSourceMap) { @@ -825,6 +829,10 @@ namespace ts { } } + if (options.out && options.outFile) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + } + if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { @@ -837,6 +845,7 @@ namespace ts { } let languageVersion = options.target || ScriptTarget.ES3; + let outFile = options.outFile || options.out; let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); if (options.isolatedModules) { @@ -866,7 +875,7 @@ namespace ts { if (options.outDir || // there is --outDir specified options.sourceRoot || // there is --sourceRoot specified (options.mapRoot && // there is --mapRoot specified and there would be multiple js files generated - (!options.out || firstExternalModuleSourceFile !== undefined))) { + (!outFile || firstExternalModuleSourceFile !== undefined))) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory @@ -890,6 +899,10 @@ namespace ts { diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); } + if (options.outFile) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + } + if (options.outDir) { diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 1338d19e1a7..95c3aeecc27 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2032,6 +2032,7 @@ namespace ts { noLib?: boolean; noResolve?: boolean; out?: string; + outFile?: string; outDir?: string; preserveConstEnums?: boolean; project?: string; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 8dee87d29b6..8b53f10e14c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1766,7 +1766,7 @@ namespace ts { export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean { if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out)) { + if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { // 1. in-browser single file compilation scenario // 2. non .js file return compilerOptions.isolatedModules || !fileExtensionIs(sourceFile.fileName, ".js"); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 1d2ad83d98a..4b93dc3428e 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -123,6 +123,7 @@ module FourSlash { mapRoot: "mapRoot", module: "module", out: "out", + outFile: "outFile", outDir: "outDir", sourceMap: "sourceMap", sourceRoot: "sourceRoot", @@ -133,7 +134,7 @@ module FourSlash { // List of allowed metadata names let fileMetadataNames = [metadataOptionNames.fileName, metadataOptionNames.emitThisFile, metadataOptionNames.resolveReference]; let globalMetadataNames = [metadataOptionNames.allowNonTsExtensions, metadataOptionNames.baselineFile, metadataOptionNames.declaration, - metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out, + metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out, metadataOptionNames.outFile, metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot]; function convertGlobalOptionsToCompilerOptions(globalOptions: { [idx: string]: string }): ts.CompilerOptions { @@ -169,6 +170,9 @@ module FourSlash { case metadataOptionNames.out: settings.out = globalOptions[prop]; break; + case metadataOptionNames.outFile: + settings.outFile = globalOptions[prop]; + break; case metadataOptionNames.outDir: settings.outDir = globalOptions[prop]; break; @@ -2407,7 +2411,7 @@ module FourSlash { ts.ScriptTarget.Latest, ts.sys.useCaseSensitiveFileNames); - let program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host); + let program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { outFile: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host); let sourceFile = host.getSourceFile(fileName, ts.ScriptTarget.ES3); diff --git a/src/harness/harness.ts b/src/harness/harness.ts index a0366c0c40b..9b7b6e3d221 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1091,6 +1091,10 @@ module Harness { options.out = setting.value; break; + case "outfile": + options.outFile = setting.value; + break; + case "outdiroption": case "outdir": options.outDir = setting.value; @@ -1229,7 +1233,8 @@ module Harness { assert(sourceFile, "Program has no source file with name '" + fileName + "'"); // Is this file going to be emitted separately let sourceFileName: string; - if (ts.isExternalModule(sourceFile) || !options.out) { + let outFile = options.outFile || options.out; + if (ts.isExternalModule(sourceFile) || !outFile) { if (options.outDir) { let sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, result.currentDirectoryForProgram); sourceFilePath = sourceFilePath.replace(result.program.getCommonSourceDirectory(), ""); @@ -1241,7 +1246,7 @@ module Harness { } else { // Goes to single --out file - sourceFileName = options.out; + sourceFileName = outFile; } let dTsFileName = ts.removeFileExtension(sourceFileName) + ".d.ts"; diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 1790956755a..d1a20b948c1 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -158,7 +158,7 @@ class ProjectRunner extends RunnerBase { return { declaration: !!testCase.declaration, sourceMap: !!testCase.sourceMap, - out: testCase.out, + outFile: testCase.out, outDir: testCase.outDir, mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? ts.sys.resolvePath(testCase.mapRoot) : testCase.mapRoot, sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? ts.sys.resolvePath(testCase.sourceRoot) : testCase.sourceRoot, @@ -299,7 +299,7 @@ class ProjectRunner extends RunnerBase { allInputFiles.unshift(findOutpuDtsFile(outputDtsFileName)); } else { - let outputDtsFileName = ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + let outputDtsFileName = ts.removeFileExtension(compilerOptions.outFile|| compilerOptions.out) + ".d.ts"; let outputDtsFile = findOutpuDtsFile(outputDtsFileName); if (!ts.contains(allInputFiles, outputDtsFile)) { allInputFiles.unshift(outputDtsFile); diff --git a/tests/baselines/reference/out-flag2.js b/tests/baselines/reference/out-flag2.js new file mode 100644 index 00000000000..e2a30f169e3 --- /dev/null +++ b/tests/baselines/reference/out-flag2.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/out-flag2.ts] //// + +//// [a.ts] + +class A { } + +//// [b.ts] +class B { } + +//// [c.js] +var A = (function () { + function A() { + } + return A; +})(); +var B = (function () { + function B() { + } + return B; +})(); +//# sourceMappingURL=c.js.map + +//// [c.d.ts] +declare class A { +} +declare class B { +} diff --git a/tests/baselines/reference/out-flag2.js.map b/tests/baselines/reference/out-flag2.js.map new file mode 100644 index 00000000000..c1523e75784 --- /dev/null +++ b/tests/baselines/reference/out-flag2.js.map @@ -0,0 +1,2 @@ +//// [c.js.map] +{"version":3,"file":"c.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":"AACA;IAAAA;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW;ACDX;IAAAE;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/out-flag2.sourcemap.txt b/tests/baselines/reference/out-flag2.sourcemap.txt new file mode 100644 index 00000000000..6a67e61bc91 --- /dev/null +++ b/tests/baselines/reference/out-flag2.sourcemap.txt @@ -0,0 +1,104 @@ +=================================================================== +JsFile: c.js +mapUrl: c.js.map +sourceRoot: +sources: tests/cases/compiler/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:c.js +sourceFile:tests/cases/compiler/a.ts +------------------------------------------------------------------- +>>>var A = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(2, 5) Source(2, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class A { +2 > } +1->Emitted(3, 5) Source(2, 11) + SourceIndex(0) name (A.constructor) +2 >Emitted(3, 6) Source(2, 12) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(4, 5) Source(2, 11) + SourceIndex(0) name (A) +2 >Emitted(4, 13) Source(2, 12) + SourceIndex(0) name (A) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class A { } +1 >Emitted(5, 1) Source(2, 11) + SourceIndex(0) name (A) +2 >Emitted(5, 2) Source(2, 12) + SourceIndex(0) name (A) +3 >Emitted(5, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(5, 6) Source(2, 12) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:c.js +sourceFile:tests/cases/compiler/b.ts +------------------------------------------------------------------- +>>>var B = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(6, 1) Source(1, 1) + SourceIndex(1) +--- +>>> function B() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(7, 5) Source(1, 1) + SourceIndex(1) name (B) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class B { +2 > } +1->Emitted(8, 5) Source(1, 11) + SourceIndex(1) name (B.constructor) +2 >Emitted(8, 6) Source(1, 12) + SourceIndex(1) name (B.constructor) +--- +>>> return B; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(9, 5) Source(1, 11) + SourceIndex(1) name (B) +2 >Emitted(9, 13) Source(1, 12) + SourceIndex(1) name (B) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class B { } +1 >Emitted(10, 1) Source(1, 11) + SourceIndex(1) name (B) +2 >Emitted(10, 2) Source(1, 12) + SourceIndex(1) name (B) +3 >Emitted(10, 2) Source(1, 1) + SourceIndex(1) +4 >Emitted(10, 6) Source(1, 12) + SourceIndex(1) +--- +>>>//# sourceMappingURL=c.js.map \ No newline at end of file diff --git a/tests/baselines/reference/out-flag2.symbols b/tests/baselines/reference/out-flag2.symbols new file mode 100644 index 00000000000..1bca057c580 --- /dev/null +++ b/tests/baselines/reference/out-flag2.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/a.ts === + +class A { } +>A : Symbol(A, Decl(a.ts, 0, 0)) + +=== tests/cases/compiler/b.ts === +class B { } +>B : Symbol(B, Decl(b.ts, 0, 0)) + diff --git a/tests/baselines/reference/out-flag2.types b/tests/baselines/reference/out-flag2.types new file mode 100644 index 00000000000..5a13642f99f --- /dev/null +++ b/tests/baselines/reference/out-flag2.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/a.ts === + +class A { } +>A : A + +=== tests/cases/compiler/b.ts === +class B { } +>B : B + diff --git a/tests/baselines/reference/out-flag3.errors.txt b/tests/baselines/reference/out-flag3.errors.txt new file mode 100644 index 00000000000..6b7dda7c962 --- /dev/null +++ b/tests/baselines/reference/out-flag3.errors.txt @@ -0,0 +1,12 @@ +error TS5053: Option 'out' cannot be specified with option 'outFile'. + + +!!! error TS5053: Option 'out' cannot be specified with option 'outFile'. +==== tests/cases/compiler/a.ts (0 errors) ==== + + // --out and --outFile error + + class A { } + +==== tests/cases/compiler/b.ts (0 errors) ==== + class B { } \ No newline at end of file diff --git a/tests/baselines/reference/out-flag3.js b/tests/baselines/reference/out-flag3.js new file mode 100644 index 00000000000..8327c3429d3 --- /dev/null +++ b/tests/baselines/reference/out-flag3.js @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/out-flag3.ts] //// + +//// [a.ts] + +// --out and --outFile error + +class A { } + +//// [b.ts] +class B { } + +//// [c.js] +// --out and --outFile error +var A = (function () { + function A() { + } + return A; +})(); +var B = (function () { + function B() { + } + return B; +})(); +//# sourceMappingURL=c.js.map + +//// [c.d.ts] +declare class A { +} +declare class B { +} diff --git a/tests/baselines/reference/out-flag3.js.map b/tests/baselines/reference/out-flag3.js.map new file mode 100644 index 00000000000..a52d66589c7 --- /dev/null +++ b/tests/baselines/reference/out-flag3.js.map @@ -0,0 +1,2 @@ +//// [c.js.map] +{"version":3,"file":"c.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":"AACA,4BAA4B;AAE5B;IAAAA;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW;ACHX;IAAAE;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/out-flag3.sourcemap.txt b/tests/baselines/reference/out-flag3.sourcemap.txt new file mode 100644 index 00000000000..c30c9f63020 --- /dev/null +++ b/tests/baselines/reference/out-flag3.sourcemap.txt @@ -0,0 +1,114 @@ +=================================================================== +JsFile: c.js +mapUrl: c.js.map +sourceRoot: +sources: tests/cases/compiler/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:c.js +sourceFile:tests/cases/compiler/a.ts +------------------------------------------------------------------- +>>>// --out and --outFile error +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > + > +2 >// --out and --outFile error +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 29) Source(2, 29) + SourceIndex(0) +--- +>>>var A = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class A { +2 > } +1->Emitted(4, 5) Source(4, 11) + SourceIndex(0) name (A.constructor) +2 >Emitted(4, 6) Source(4, 12) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(5, 5) Source(4, 11) + SourceIndex(0) name (A) +2 >Emitted(5, 13) Source(4, 12) + SourceIndex(0) name (A) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class A { } +1 >Emitted(6, 1) Source(4, 11) + SourceIndex(0) name (A) +2 >Emitted(6, 2) Source(4, 12) + SourceIndex(0) name (A) +3 >Emitted(6, 2) Source(4, 1) + SourceIndex(0) +4 >Emitted(6, 6) Source(4, 12) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:c.js +sourceFile:tests/cases/compiler/b.ts +------------------------------------------------------------------- +>>>var B = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(7, 1) Source(1, 1) + SourceIndex(1) +--- +>>> function B() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(8, 5) Source(1, 1) + SourceIndex(1) name (B) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class B { +2 > } +1->Emitted(9, 5) Source(1, 11) + SourceIndex(1) name (B.constructor) +2 >Emitted(9, 6) Source(1, 12) + SourceIndex(1) name (B.constructor) +--- +>>> return B; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(10, 5) Source(1, 11) + SourceIndex(1) name (B) +2 >Emitted(10, 13) Source(1, 12) + SourceIndex(1) name (B) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class B { } +1 >Emitted(11, 1) Source(1, 11) + SourceIndex(1) name (B) +2 >Emitted(11, 2) Source(1, 12) + SourceIndex(1) name (B) +3 >Emitted(11, 2) Source(1, 1) + SourceIndex(1) +4 >Emitted(11, 6) Source(1, 12) + SourceIndex(1) +--- +>>>//# sourceMappingURL=c.js.map \ No newline at end of file diff --git a/tests/cases/compiler/out-flag2.ts b/tests/cases/compiler/out-flag2.ts new file mode 100644 index 00000000000..d3349563a9f --- /dev/null +++ b/tests/cases/compiler/out-flag2.ts @@ -0,0 +1,11 @@ +// @target: ES5 +// @sourcemap: true +// @declaration: true +// @module: commonjs +// @outFile: c.js + +// @Filename: a.ts +class A { } + +// @Filename: b.ts +class B { } \ No newline at end of file diff --git a/tests/cases/compiler/out-flag3.ts b/tests/cases/compiler/out-flag3.ts new file mode 100644 index 00000000000..cb3c6819811 --- /dev/null +++ b/tests/cases/compiler/out-flag3.ts @@ -0,0 +1,14 @@ +// @target: ES5 +// @sourcemap: true +// @declaration: true +// @module: commonjs +// @outFile: c.js +// @out: d.js + +// --out and --outFile error + +// @Filename: a.ts +class A { } + +// @Filename: b.ts +class B { } \ No newline at end of file