Skip to content

Commit 4c5aeaf

Browse files
committed
Merge branch 'master' into namespaces
Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json src/compiler/program.ts tests/baselines/reference/constDeclarations-access5.errors.txt tests/baselines/reference/es6-amd.errors.txt tests/baselines/reference/es6-declaration-amd.errors.txt tests/baselines/reference/es6-sourcemap-amd.errors.txt tests/baselines/reference/es6-umd.errors.txt tests/baselines/reference/es6-umd2.errors.txt tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt tests/baselines/reference/es6ImportNameSpaceImport.errors.txt tests/baselines/reference/es6ImportNamedImport.errors.txt tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.errors.txt tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.errors.txt
2 parents 330d63a + cde3ed0 commit 4c5aeaf

File tree

102 files changed

+7976
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+7976
-147
lines changed

Jakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ var harnessSources = [
127127
"services/documentRegistry.ts",
128128
"services/preProcessFile.ts",
129129
"services/patternMatcher.ts",
130-
"versionCache.ts"
130+
"versionCache.ts",
131+
"convertToBase64.ts"
131132
].map(function (f) {
132133
return path.join(unittestsDirectory, f);
133134
})).concat([

src/compiler/checker.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10689,9 +10689,15 @@ module ts {
1068910689
}
1069010690
checkExternalModuleExports(container);
1069110691

10692-
if (node.isExportEquals && languageVersion >= ScriptTarget.ES6) {
10693-
// export assignment is deprecated in es6 or above
10694-
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead);
10692+
if (node.isExportEquals) {
10693+
if (languageVersion >= ScriptTarget.ES6) {
10694+
// export assignment is deprecated in es6 or above
10695+
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead);
10696+
}
10697+
else if (compilerOptions.module === ModuleKind.System) {
10698+
// system modules does not support export assignment
10699+
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
10700+
}
1069510701
}
1069610702
}
1069710703

@@ -11514,9 +11520,11 @@ module ts {
1151411520

1151511521
function getExportNameSubstitution(symbol: Symbol, location: Node, getGeneratedNameForNode: (Node: Node) => string): string {
1151611522
if (isExternalModuleSymbol(symbol.parent)) {
11517-
// If this is es6 or higher, just use the name of the export
11523+
// 1. If this is es6 or higher, just use the name of the export
1151811524
// no need to qualify it.
11519-
if (languageVersion >= ScriptTarget.ES6) {
11525+
// 2. export mechanism for System modules is different from CJS\AMD
11526+
// and it does not need qualifications for exports
11527+
if (languageVersion >= ScriptTarget.ES6 || compilerOptions.module === ModuleKind.System) {
1152011528
return undefined;
1152111529
}
1152211530
return "exports." + unescapeIdentifier(symbol.name);
@@ -11877,6 +11885,15 @@ module ts {
1187711885
return !!resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
1187811886
}
1187911887

11888+
function getReferencedValueDeclaration(reference: Identifier): Declaration {
11889+
Debug.assert(!nodeIsSynthesized(reference));
11890+
let symbol =
11891+
getNodeLinks(reference).resolvedSymbol ||
11892+
resolveName(reference, reference.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
11893+
11894+
return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration;
11895+
}
11896+
1188011897
function getBlockScopedVariableId(n: Identifier): number {
1188111898
Debug.assert(!nodeIsSynthesized(n));
1188211899

@@ -11935,6 +11952,7 @@ module ts {
1193511952
resolvesToSomeValue,
1193611953
collectLinkedAliases,
1193711954
getBlockScopedVariableId,
11955+
getReferencedValueDeclaration,
1193811956
serializeTypeOfNode,
1193911957
serializeParameterTypesOfNode,
1194011958
serializeReturnTypeOfNode,

src/compiler/commandLineParser.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ module ts {
3030
type: "boolean",
3131
description: Diagnostics.Print_this_message,
3232
},
33+
{
34+
name: "inlineSourceMap",
35+
type: "boolean",
36+
},
37+
{
38+
name: "inlineSources",
39+
type: "boolean",
40+
},
3341
{
3442
name: "listFiles",
3543
type: "boolean",
@@ -51,11 +59,12 @@ module ts {
5159
type: {
5260
"commonjs": ModuleKind.CommonJS,
5361
"amd": ModuleKind.AMD,
54-
"umd": ModuleKind.UMD
62+
"system": ModuleKind.System,
63+
"umd": ModuleKind.UMD,
5564
},
56-
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd,
65+
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd,
5766
paramType: Diagnostics.KIND,
58-
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd
67+
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd
5968
},
6069
{
6170
name: "noEmit",

src/compiler/diagnosticInformationMap.generated.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ module ts {
161161
Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
162162
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
163163
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
164-
Cannot_compile_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher." },
164+
Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." },
165165
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
166166
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
167167
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
@@ -173,6 +173,7 @@ module ts {
173173
Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
174174
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
175175
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
176+
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
176177
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
177178
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
178179
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@@ -451,6 +452,10 @@ module ts {
451452
Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." },
452453
Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." },
453454
Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
455+
Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." },
456+
Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." },
457+
Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." },
458+
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." },
454459
Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." },
455460
Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." },
456461
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." },
@@ -462,7 +467,7 @@ module ts {
462467
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
463468
Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." },
464469
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
465-
Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." },
470+
Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" },
466471
Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." },
467472
Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." },
468473
Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." },
@@ -483,7 +488,7 @@ module ts {
483488
Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
484489
Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
485490
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
486-
Argument_for_module_option_must_be_commonjs_amd_or_umd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'." },
491+
Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." },
487492
Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." },
488493
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
489494
Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },

src/compiler/diagnosticMessages.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@
631631
"category": "Error",
632632
"code": 1203
633633
},
634-
"Cannot compile modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher.": {
634+
"Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.": {
635635
"category": "Error",
636636
"code": 1204
637637
},
@@ -679,6 +679,11 @@
679679
"category": "Error",
680680
"code": 1216
681681
},
682+
"Export assignment is not supported when '--module' flag is 'system'.": {
683+
"category": "Error",
684+
"code": 1218
685+
},
686+
682687
"Duplicate identifier '{0}'.": {
683688
"category": "Error",
684689
"code": 2300
@@ -1792,6 +1797,23 @@
17921797
"category": "Error",
17931798
"code": 5047
17941799
},
1800+
"Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.": {
1801+
"category": "Error",
1802+
"code": 5048
1803+
},
1804+
"Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.": {
1805+
"category": "Error",
1806+
"code": 5049
1807+
},
1808+
"Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.": {
1809+
"category": "Error",
1810+
"code": 5050
1811+
},
1812+
"Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": {
1813+
"category": "Error",
1814+
"code": 5051
1815+
},
1816+
17951817
"Concatenate and emit output to single file.": {
17961818
"category": "Message",
17971819
"code": 6001
@@ -1836,7 +1858,7 @@
18361858
"category": "Message",
18371859
"code": 6015
18381860
},
1839-
"Specify module code generation: 'commonjs', 'amd', or 'umd'.": {
1861+
"Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'": {
18401862
"category": "Message",
18411863
"code": 6016
18421864
},
@@ -1920,7 +1942,7 @@
19201942
"category": "Error",
19211943
"code": 6045
19221944
},
1923-
"Argument for '--module' option must be 'commonjs', 'amd', or 'umd'.": {
1945+
"Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'.": {
19241946
"category": "Error",
19251947
"code": 6046
19261948
},

0 commit comments

Comments
 (0)