Skip to content

Commit 616dae2

Browse files
Fixed diagnostic generator; added messages.
1 parent 9102322 commit 616dae2

File tree

4 files changed

+163
-10
lines changed

4 files changed

+163
-10
lines changed

Jakefile

+2
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnostic
199199
var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json");
200200
var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts");
201201

202+
file(processDiagnosticMessagesTs)
203+
202204
// processDiagnosticMessages script
203205
compileFile(processDiagnosticMessagesJs,
204206
[processDiagnosticMessagesTs],

scripts/processDiagnosticMessages.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ function convertPropertyName(origName: string): string {
9494
}
9595

9696
module NameGenerator {
97-
export function ensureUniqueness(
98-
names: string[],
99-
isFixed: boolean[]= names.map(() => false),
100-
isCaseSensitive: boolean = true): string[] {
97+
export function ensureUniqueness(names: string[], isFixed: boolean[] = names.map(() => false), isCaseSensitive: boolean = false): string[] {
10198

10299
var names = names.map(x => x);
103100
ensureUniquenessInPlace(names, isFixed, isCaseSensitive);
@@ -133,7 +130,7 @@ module NameGenerator {
133130
while (true) {
134131
var newName = name + suffix++;
135132

136-
if (proposedNames.some((name) => Utilities.stringEquals(name, newName, isCaseSensitive))) {
133+
if (!proposedNames.some((name) => Utilities.stringEquals(name, newName, isCaseSensitive))) {
137134
proposedNames[collisionIndex] = newName;
138135
break;
139136
}
@@ -144,7 +141,7 @@ module NameGenerator {
144141

145142
module Utilities {
146143
/// Return a list of all indices where a string occurs.
147-
export function collectMatchingIndices(name: string, proposedNames: string[], isCaseSensitive: boolean = true): number[] {
144+
export function collectMatchingIndices(name: string, proposedNames: string[], isCaseSensitive: boolean = false): number[] {
148145
var matchingIndices: number[] = [];
149146

150147
for (var i = 0; i < proposedNames.length; i++) {
@@ -156,8 +153,8 @@ module Utilities {
156153
return matchingIndices;
157154
}
158155

159-
export function stringEquals(s1: string, s2: string, caseSensitive: boolean = true): boolean {
160-
if (!caseSensitive) {
156+
export function stringEquals(s1: string, s2: string, caseSensitive: boolean = false): boolean {
157+
if (caseSensitive) {
161158
s1 = s1.toLowerCase();
162159
s2 = s2.toLowerCase();
163160
}

src/compiler/diagnosticInformationMap.generated.ts

+30
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,38 @@ module ts {
216216
Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
217217
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option mapRoot cannot be specified without specifying sourcemap option." },
218218
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option sourceRoot cannot be specified without specifying sourcemap option." },
219+
Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." },
220+
Generates_corresponding_0_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding {0} file." },
221+
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." },
222+
Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." },
223+
Watch_input_files: { code: 6005, category: DiagnosticCategory.Message, key: "Watch input files." },
224+
Redirect_output_structure_to_the_directory: { code: 6006, category: DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
225+
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
226+
Skip_resolution_and_preprocessing: { code: 6010, category: DiagnosticCategory.Message, key: "Skip resolution and preprocessing." },
227+
Specify_ECMAScript_target_version_Colon_0_default_or_1: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: '{0}' (default), or '{1}'" },
228+
Specify_module_code_generation_Colon_0_or_1: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: '{0}' or '{1}'" },
229+
Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." },
230+
Print_the_compiler_s_version_Colon_0: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version: {0}" },
231+
Allow_use_of_deprecated_0_keyword_when_referencing_an_external_module: { code: 6021, category: DiagnosticCategory.Message, key: "Allow use of deprecated '{0}' keyword when referencing an external module." },
232+
Specify_locale_for_errors_and_messages_For_example_0_or_1: { code: 6022, category: DiagnosticCategory.Message, key: "Specify locale for errors and messages. For example '{0}' or '{1}'" },
233+
Syntax_Colon_0: { code: 6023, category: DiagnosticCategory.Message, key: "Syntax: {0}" },
234+
options: { code: 6024, category: DiagnosticCategory.Message, key: "options" },
235+
file: { code: 6025, category: DiagnosticCategory.Message, key: "file" },
236+
Examples_Colon: { code: 6026, category: DiagnosticCategory.Message, key: "Examples:" },
237+
Options_Colon: { code: 6027, category: DiagnosticCategory.Message, key: "Options:" },
238+
Insert_command_line_options_and_files_from_a_file: { code: 6030, category: DiagnosticCategory.Message, key: "Insert command line options and files from a file." },
219239
Version_0: { code: 6029, category: DiagnosticCategory.Message, key: "Version {0}" },
240+
Use_the_0_flag_to_see_options: { code: 6031, category: DiagnosticCategory.Message, key: "Use the '{0}' flag to see options." },
220241
File_Changed_Compiling: { code: 6032, category: DiagnosticCategory.Message, key: "File Changed. Compiling." },
242+
STRING: { code: 6033, category: DiagnosticCategory.Message, key: "STRING" },
243+
KIND: { code: 6034, category: DiagnosticCategory.Message, key: "KIND" },
244+
FILE: { code: 6035, category: DiagnosticCategory.Message, key: "FILE" },
245+
VERSION: { code: 6036, category: DiagnosticCategory.Message, key: "VERSION" },
246+
LOCATION: { code: 6037, category: DiagnosticCategory.Message, key: "LOCATION" },
247+
DIRECTORY: { code: 6038, category: DiagnosticCategory.Message, key: "DIRECTORY" },
248+
NUMBER: { code: 6039, category: DiagnosticCategory.Message, key: "NUMBER" },
249+
Specify_the_codepage_to_use_when_opening_source_files: { code: 6040, category: DiagnosticCategory.Message, key: "Specify the codepage to use when opening source files." },
250+
Additional_locations_Colon: { code: 6041, category: DiagnosticCategory.Message, key: "Additional locations:" },
221251
Compile_complete_Listening_for_changed_files: { code: 6042, category: DiagnosticCategory.Message, key: "Compile complete. Listening for changed files." },
222252
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
223253
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },

src/compiler/diagnosticMessages.json

+126-2
Original file line numberDiff line numberDiff line change
@@ -858,14 +858,138 @@
858858
"category": "Error",
859859
"code": 5039
860860
},
861+
"Concatenate and emit output to single file.": {
862+
"category": "Message",
863+
"code": 6001
864+
},
865+
"Generates corresponding {0} file.": {
866+
"category": "Message",
867+
"code": 6002
868+
},
869+
"Specifies the location where debugger should locate map files instead of generated locations.": {
870+
"category": "Message",
871+
"code": 6003
872+
},
873+
"Specifies the location where debugger should locate TypeScript files instead of source locations.": {
874+
"category": "Message",
875+
"code": 6004
876+
},
877+
"Watch input files.": {
878+
"category": "Message",
879+
"code": 6005
880+
},
881+
"Redirect output structure to the directory.": {
882+
"category": "Message",
883+
"code": 6006
884+
},
885+
"Do not emit comments to output.": {
886+
"category": "Message",
887+
"code": 6009
888+
},
889+
"Skip resolution and preprocessing.": {
890+
"category": "Message",
891+
"code": 6010
892+
},
893+
"Specify ECMAScript target version: '{0}' (default), or '{1}'": {
894+
"category": "Message",
895+
"code": 6015
896+
},
897+
"Specify module code generation: '{0}' or '{1}'": {
898+
"category": "Message",
899+
"code": 6016
900+
},
901+
"Print this message.": {
902+
"category": "Message",
903+
"code": 6017
904+
},
905+
"Print the compiler's version: {0}": {
906+
"category": "Message",
907+
"code": 6019
908+
},
909+
"Allow use of deprecated '{0}' keyword when referencing an external module.": {
910+
"category": "Message",
911+
"code": 6021
912+
},
913+
"Specify locale for errors and messages. For example '{0}' or '{1}'": {
914+
"category": "Message",
915+
"code": 6022
916+
},
917+
"Syntax: {0}": {
918+
"category": "Message",
919+
"code": 6023
920+
},
921+
"options": {
922+
"category": "Message",
923+
"code": 6024
924+
},
925+
"file": {
926+
"category": "Message",
927+
"code": 6025
928+
},
929+
"Examples:": {
930+
"category": "Message",
931+
"code": 6026
932+
},
933+
"Options:": {
934+
"category": "Message",
935+
"code": 6027
936+
},
937+
"Insert command line options and files from a file.": {
938+
"category": "Message",
939+
"code": 6028
940+
},
861941
"Version {0}": {
862-
"category": "Message",
863-
"code": 6029
942+
"category": "Message",
943+
"code": 6029
944+
},
945+
"Insert command line options and files from a file.": {
946+
"category": "Message",
947+
"code": 6030
948+
},
949+
"Use the '{0}' flag to see options.": {
950+
"category": "Message",
951+
"code": 6031
864952
},
865953
"File Changed. Compiling.": {
866954
"category": "Message",
867955
"code": 6032
868956
},
957+
"STRING": {
958+
"category": "Message",
959+
"code": 6033
960+
},
961+
"KIND": {
962+
"category": "Message",
963+
"code": 6034
964+
},
965+
"FILE": {
966+
"category": "Message",
967+
"code": 6035
968+
},
969+
"VERSION": {
970+
"category": "Message",
971+
"code": 6036
972+
},
973+
"LOCATION": {
974+
"category": "Message",
975+
"code": 6037
976+
},
977+
"DIRECTORY": {
978+
"category": "Message",
979+
"code": 6038
980+
},
981+
"NUMBER": {
982+
"category": "Message",
983+
"code": 6039
984+
},
985+
"Specify the codepage to use when opening source files.": {
986+
"category": "Message",
987+
"code": 6040
988+
},
989+
"Additional locations:": {
990+
"category": "Message",
991+
"code": 6041
992+
},
869993
"Compile complete. Listening for changed files.": {
870994
"category": "Message",
871995
"code": 6042

0 commit comments

Comments
 (0)