From 616dae20f0894eb47cd957130e0eb47daa796374 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 31 Jul 2014 17:20:57 -0700 Subject: [PATCH] Fixed diagnostic generator; added messages. --- Jakefile | 2 + scripts/processDiagnosticMessages.ts | 13 +- .../diagnosticInformationMap.generated.ts | 30 ++++ src/compiler/diagnosticMessages.json | 128 +++++++++++++++++- 4 files changed, 163 insertions(+), 10 deletions(-) diff --git a/Jakefile b/Jakefile index 7a8ee59d532..bf5201b696b 100644 --- a/Jakefile +++ b/Jakefile @@ -199,6 +199,8 @@ var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnostic var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json"); var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts"); +file(processDiagnosticMessagesTs) + // processDiagnosticMessages script compileFile(processDiagnosticMessagesJs, [processDiagnosticMessagesTs], diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts index e1a198a2124..31449c88e3a 100644 --- a/scripts/processDiagnosticMessages.ts +++ b/scripts/processDiagnosticMessages.ts @@ -94,10 +94,7 @@ function convertPropertyName(origName: string): string { } module NameGenerator { - export function ensureUniqueness( - names: string[], - isFixed: boolean[]= names.map(() => false), - isCaseSensitive: boolean = true): string[] { + export function ensureUniqueness(names: string[], isFixed: boolean[] = names.map(() => false), isCaseSensitive: boolean = false): string[] { var names = names.map(x => x); ensureUniquenessInPlace(names, isFixed, isCaseSensitive); @@ -133,7 +130,7 @@ module NameGenerator { while (true) { var newName = name + suffix++; - if (proposedNames.some((name) => Utilities.stringEquals(name, newName, isCaseSensitive))) { + if (!proposedNames.some((name) => Utilities.stringEquals(name, newName, isCaseSensitive))) { proposedNames[collisionIndex] = newName; break; } @@ -144,7 +141,7 @@ module NameGenerator { module Utilities { /// Return a list of all indices where a string occurs. - export function collectMatchingIndices(name: string, proposedNames: string[], isCaseSensitive: boolean = true): number[] { + export function collectMatchingIndices(name: string, proposedNames: string[], isCaseSensitive: boolean = false): number[] { var matchingIndices: number[] = []; for (var i = 0; i < proposedNames.length; i++) { @@ -156,8 +153,8 @@ module Utilities { return matchingIndices; } - export function stringEquals(s1: string, s2: string, caseSensitive: boolean = true): boolean { - if (!caseSensitive) { + export function stringEquals(s1: string, s2: string, caseSensitive: boolean = false): boolean { + if (caseSensitive) { s1 = s1.toLowerCase(); s2 = s2.toLowerCase(); } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index a3b85cfb013..b97e3974f7b 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -216,8 +216,38 @@ module ts { 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." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, + Generates_corresponding_0_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding {0} 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." }, + 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." }, + Watch_input_files: { code: 6005, category: DiagnosticCategory.Message, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, + Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." }, + Skip_resolution_and_preprocessing: { code: 6010, category: DiagnosticCategory.Message, key: "Skip resolution and preprocessing." }, + Specify_ECMAScript_target_version_Colon_0_default_or_1: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: '{0}' (default), or '{1}'" }, + Specify_module_code_generation_Colon_0_or_1: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: '{0}' or '{1}'" }, + Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." }, + Print_the_compiler_s_version_Colon_0: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version: {0}" }, + 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." }, + 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}'" }, + Syntax_Colon_0: { code: 6023, category: DiagnosticCategory.Message, key: "Syntax: {0}" }, + options: { code: 6024, category: DiagnosticCategory.Message, key: "options" }, + file: { code: 6025, category: DiagnosticCategory.Message, key: "file" }, + Examples_Colon: { code: 6026, category: DiagnosticCategory.Message, key: "Examples:" }, + Options_Colon: { code: 6027, category: DiagnosticCategory.Message, key: "Options:" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: DiagnosticCategory.Message, key: "Insert command line options and files from a file." }, Version_0: { code: 6029, category: DiagnosticCategory.Message, key: "Version {0}" }, + Use_the_0_flag_to_see_options: { code: 6031, category: DiagnosticCategory.Message, key: "Use the '{0}' flag to see options." }, File_Changed_Compiling: { code: 6032, category: DiagnosticCategory.Message, key: "File Changed. Compiling." }, + STRING: { code: 6033, category: DiagnosticCategory.Message, key: "STRING" }, + KIND: { code: 6034, category: DiagnosticCategory.Message, key: "KIND" }, + FILE: { code: 6035, category: DiagnosticCategory.Message, key: "FILE" }, + VERSION: { code: 6036, category: DiagnosticCategory.Message, key: "VERSION" }, + LOCATION: { code: 6037, category: DiagnosticCategory.Message, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: DiagnosticCategory.Message, key: "DIRECTORY" }, + NUMBER: { code: 6039, category: DiagnosticCategory.Message, key: "NUMBER" }, + Specify_the_codepage_to_use_when_opening_source_files: { code: 6040, category: DiagnosticCategory.Message, key: "Specify the codepage to use when opening source files." }, + Additional_locations_Colon: { code: 6041, category: DiagnosticCategory.Message, key: "Additional locations:" }, Compile_complete_Listening_for_changed_files: { code: 6042, category: DiagnosticCategory.Message, key: "Compile complete. Listening for changed files." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 9ace46f4202..d4ae58e8705 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -858,14 +858,138 @@ "category": "Error", "code": 5039 }, + "Concatenate and emit output to single file.": { + "category": "Message", + "code": 6001 + }, + "Generates corresponding {0} file.": { + "category": "Message", + "code": 6002 + }, + "Specifies the location where debugger should locate map files instead of generated locations.": { + "category": "Message", + "code": 6003 + }, + "Specifies the location where debugger should locate TypeScript files instead of source locations.": { + "category": "Message", + "code": 6004 + }, + "Watch input files.": { + "category": "Message", + "code": 6005 + }, + "Redirect output structure to the directory.": { + "category": "Message", + "code": 6006 + }, + "Do not emit comments to output.": { + "category": "Message", + "code": 6009 + }, + "Skip resolution and preprocessing.": { + "category": "Message", + "code": 6010 + }, + "Specify ECMAScript target version: '{0}' (default), or '{1}'": { + "category": "Message", + "code": 6015 + }, + "Specify module code generation: '{0}' or '{1}'": { + "category": "Message", + "code": 6016 + }, + "Print this message.": { + "category": "Message", + "code": 6017 + }, + "Print the compiler's version: {0}": { + "category": "Message", + "code": 6019 + }, + "Allow use of deprecated '{0}' keyword when referencing an external module.": { + "category": "Message", + "code": 6021 + }, + "Specify locale for errors and messages. For example '{0}' or '{1}'": { + "category": "Message", + "code": 6022 + }, + "Syntax: {0}": { + "category": "Message", + "code": 6023 + }, + "options": { + "category": "Message", + "code": 6024 + }, + "file": { + "category": "Message", + "code": 6025 + }, + "Examples:": { + "category": "Message", + "code": 6026 + }, + "Options:": { + "category": "Message", + "code": 6027 + }, + "Insert command line options and files from a file.": { + "category": "Message", + "code": 6028 + }, "Version {0}": { - "category": "Message", - "code": 6029 + "category": "Message", + "code": 6029 + }, + "Insert command line options and files from a file.": { + "category": "Message", + "code": 6030 + }, + "Use the '{0}' flag to see options.": { + "category": "Message", + "code": 6031 }, "File Changed. Compiling.": { "category": "Message", "code": 6032 }, + "STRING": { + "category": "Message", + "code": 6033 + }, + "KIND": { + "category": "Message", + "code": 6034 + }, + "FILE": { + "category": "Message", + "code": 6035 + }, + "VERSION": { + "category": "Message", + "code": 6036 + }, + "LOCATION": { + "category": "Message", + "code": 6037 + }, + "DIRECTORY": { + "category": "Message", + "code": 6038 + }, + "NUMBER": { + "category": "Message", + "code": 6039 + }, + "Specify the codepage to use when opening source files.": { + "category": "Message", + "code": 6040 + }, + "Additional locations:": { + "category": "Message", + "code": 6041 + }, "Compile complete. Listening for changed files.": { "category": "Message", "code": 6042