From 2a3c4ea3c2a2591cc916adf394fa04dbe0698417 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 11:39:32 -0800 Subject: [PATCH 01/35] LKG short-hand property --- bin/lib.core.d.ts | 4 + bin/lib.d.ts | 4 + bin/tsc.js | 4982 ++++---- bin/typescriptServices.js | 22326 ++++++++---------------------------- 4 files changed, 7731 insertions(+), 19585 deletions(-) diff --git a/bin/lib.core.d.ts b/bin/lib.core.d.ts index 1d3ed6dca4..00dc83fa80 100644 --- a/bin/lib.core.d.ts +++ b/bin/lib.core.d.ts @@ -499,6 +499,10 @@ declare var Number: { POSITIVE_INFINITY: number; } +interface TemplateStringsArray extends Array { + raw: string[]; +} + interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ E: number; diff --git a/bin/lib.d.ts b/bin/lib.d.ts index 8fb56ba312..8890fab428 100644 --- a/bin/lib.d.ts +++ b/bin/lib.d.ts @@ -499,6 +499,10 @@ declare var Number: { POSITIVE_INFINITY: number; } +interface TemplateStringsArray extends Array { + raw: string[]; +} + interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ E: number; diff --git a/bin/tsc.js b/bin/tsc.js index 53e1047e85..a674901557 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -13,1421 +13,6 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var ts; -(function (ts) { - ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: 1 /* Error */, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: 1 /* Error */, key: "Identifier expected." }, - _0_expected: { code: 1005, category: 1 /* Error */, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1 /* Error */, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: 1 /* Error */, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: 1 /* Error */, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: 1 /* Error */, key: "Unexpected token." }, - Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1 /* Error */, key: "Catch clause parameter cannot have a type annotation." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1 /* Error */, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1 /* Error */, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1 /* Error */, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1 /* Error */, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1 /* Error */, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1 /* Error */, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1 /* Error */, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1 /* Error */, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1 /* Error */, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1 /* Error */, key: "An index signature parameter type must be 'string' or 'number'." }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1 /* Error */, key: "A class or interface declaration can only have one 'extends' clause." }, - An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1 /* Error */, key: "An 'extends' clause must precede an 'implements' clause." }, - A_class_can_only_extend_a_single_class: { code: 1026, category: 1 /* Error */, key: "A class can only extend a single class." }, - A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1 /* Error */, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: 1 /* Error */, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: 1 /* Error */, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: 1 /* Error */, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a class element." }, - An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1 /* Error */, key: "An interface declaration cannot have an 'implements' clause." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1 /* Error */, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1 /* Error */, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1 /* Error */, key: "Statements are not allowed in ambient contexts." }, - A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: 1 /* Error */, key: "A function implementation cannot be declared in an ambient context." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1 /* Error */, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1 /* Error */, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a module element." }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1 /* Error */, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: 1 /* Error */, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1 /* Error */, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1 /* Error */, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1 /* Error */, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1 /* Error */, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1 /* Error */, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: 1 /* Error */, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1 /* Error */, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: 1 /* Error */, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1 /* Error */, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1 /* Error */, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1 /* Error */, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: 1 /* Error */, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1 /* Error */, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1 /* Error */, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1 /* Error */, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1 /* Error */, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1 /* Error */, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: 1 /* Error */, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1 /* Error */, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1 /* Error */, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: 1 /* Error */, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: 1 /* Error */, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: 1 /* Error */, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1 /* Error */, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1 /* Error */, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1 /* Error */, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1 /* Error */, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1 /* Error */, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1 /* Error */, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1 /* Error */, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: 1 /* Error */, key: "Expression expected." }, - Type_expected: { code: 1110, category: 1 /* Error */, key: "Type expected." }, - A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: 1 /* Error */, key: "A constructor implementation cannot be declared in an ambient context." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: 1 /* Error */, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1 /* Error */, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: 1 /* Error */, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1 /* Error */, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1 /* Error */, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1 /* Error */, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1 /* Error */, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1 /* Error */, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1 /* Error */, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1 /* Error */, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1 /* Error */, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1 /* Error */, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: 1 /* Error */, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: 1 /* Error */, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: 1 /* Error */, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: 1 /* Error */, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: 1 /* Error */, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: 1 /* Error */, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: 1 /* Error */, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: 1 /* Error */, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: 1 /* Error */, key: "Enum member expected." }, - Type_reference_expected: { code: 1133, category: 1 /* Error */, key: "Type reference expected." }, - Variable_declaration_expected: { code: 1134, category: 1 /* Error */, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: 1 /* Error */, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: 1 /* Error */, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: 1 /* Error */, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: 1 /* Error */, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: 1 /* Error */, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: 1 /* Error */, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: 1 /* Error */, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: 1 /* Error */, key: "Line break not permitted here." }, - catch_or_finally_expected: { code: 1143, category: 1 /* Error */, key: "'catch' or 'finally' expected." }, - Block_or_expected: { code: 1144, category: 1 /* Error */, key: "Block or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1 /* Error */, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: 1 /* Error */, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1 /* Error */, key: "Import declarations in an internal module cannot reference an external module." }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1 /* Error */, key: "Cannot compile external modules unless the '--module' flag is provided." }, - Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: 1 /* Error */, key: "Filename '{0}' differs from already included filename '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - var_let_or_const_expected: { code: 1152, category: 1 /* Error */, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1 /* Error */, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1 /* Error */, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: 1 /* Error */, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1 /* Error */, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1 /* Error */, key: "'let' declarations can only be declared inside a block." }, - Invalid_template_literal_expected: { code: 1158, category: 1 /* Error */, key: "Invalid template literal; expected '}'" }, - Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1 /* Error */, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, - Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* Error */, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1 /* Error */, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: 1 /* Error */, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: 1 /* Error */, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: 1 /* Error */, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: 1 /* Error */, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: 1 /* Error */, key: "Cannot find external module '{0}'." }, - A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1 /* Error */, key: "A module cannot have more than one export assignment." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1 /* Error */, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1 /* Error */, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: 1 /* Error */, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1 /* Error */, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1 /* Error */, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1 /* Error */, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: 1 /* Error */, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1 /* Error */, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1 /* Error */, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: 1 /* Error */, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1 /* Error */, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1 /* Error */, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1 /* Error */, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2323, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: 1 /* Error */, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1 /* Error */, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: 1 /* Error */, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1 /* Error */, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1 /* Error */, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: 1 /* Error */, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: 1 /* Error */, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1 /* Error */, key: "'this' cannot be referenced in a module body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: 1 /* Error */, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1 /* Error */, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1 /* Error */, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1 /* Error */, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1 /* Error */, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1 /* Error */, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1 /* Error */, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: 1 /* Error */, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1 /* Error */, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1 /* Error */, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1 /* Error */, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1 /* Error */, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1 /* Error */, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1 /* Error */, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1 /* Error */, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1 /* Error */, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1 /* Error */, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1 /* Error */, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1 /* Error */, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1 /* Error */, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1 /* Error */, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1 /* Error */, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1 /* Error */, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1 /* Error */, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1 /* Error */, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1 /* Error */, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1 /* Error */, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1 /* Error */, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1 /* Error */, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: 1 /* Error */, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1 /* Error */, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1 /* Error */, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1 /* Error */, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1 /* Error */, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1 /* Error */, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: 1 /* Error */, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: 1 /* Error */, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1 /* Error */, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1 /* Error */, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1 /* Error */, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1 /* Error */, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1 /* Error */, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1 /* Error */, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1 /* Error */, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1 /* Error */, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1 /* Error */, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1 /* Error */, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: 1 /* Error */, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: 1 /* Error */, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: 1 /* Error */, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: 1 /* Error */, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1 /* Error */, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1 /* Error */, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: 1 /* Error */, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1 /* Error */, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1 /* Error */, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1 /* Error */, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: { code: 2397, category: 1 /* Error */, key: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter." }, - Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2398, category: 1 /* Error */, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1 /* Error */, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1 /* Error */, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1 /* Error */, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1 /* Error */, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1 /* Error */, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1 /* Error */, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1 /* Error */, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: 1 /* Error */, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1 /* Error */, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1 /* Error */, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1 /* Error */, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: 1 /* Error */, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1 /* Error */, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1 /* Error */, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1 /* Error */, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1 /* Error */, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1 /* Error */, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1 /* Error */, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1 /* Error */, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: 1 /* Error */, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1 /* Error */, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1 /* Error */, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: 1 /* Error */, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1 /* Error */, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1 /* Error */, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1 /* Error */, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1 /* Error */, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1 /* Error */, key: "Ambient external module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1 /* Error */, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: 1 /* Error */, key: "Import name cannot be '{0}'" }, - Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1 /* Error */, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1 /* Error */, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1 /* Error */, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1 /* Error */, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1 /* Error */, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1 /* Error */, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1 /* Error */, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1 /* Error */, key: "Block-scoped variable '{0}' used before its declaration.", isEarly: true }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1 /* Error */, key: "The operand of an increment or decrement operator cannot be a constant.", isEarly: true }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1 /* Error */, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1 /* Error */, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1 /* Error */, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1 /* Error */, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1 /* Error */, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: 1 /* Error */, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: 1 /* Error */, key: "Type alias name cannot be '{0}'" }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* Error */, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4003, category: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4005, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4007, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4009, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4011, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4013, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4015, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4017, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4018, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2: { code: 4021, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using name '{1}' from private module '{2}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1 /* Error */, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1 /* Error */, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1 /* Error */, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1 /* Error */, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1 /* Error */, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4079, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_type_alias_0_has_or_is_using_name_1_from_private_module_2: { code: 4080, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1 /* Error */, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1 /* Error */, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1 /* Error */, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - Index_expression_arguments_in_const_enums_must_be_of_type_string: { code: 4085, category: 1 /* Error */, key: "Index expression arguments in 'const' enums must be of type 'string'." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: 1 /* Error */, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1 /* Error */, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: 1 /* Error */, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: 1 /* Error */, key: "Unsupported file encoding." }, - Unknown_compiler_option_0: { code: 5023, category: 1 /* Error */, key: "Unknown compiler option '{0}'." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: 1 /* Error */, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1 /* Error */, key: "Option mapRoot cannot be specified without specifying sourcemap option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1 /* Error */, key: "Option sourceRoot cannot be specified without specifying sourcemap option." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2 /* Message */, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: 2 /* Message */, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2 /* 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: 2 /* Message */, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: 2 /* Message */, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: 2 /* Message */, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2 /* Message */, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_comments_to_output: { code: 6009, category: 2 /* Message */, key: "Do not emit comments to output." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2 /* Message */, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2 /* Message */, key: "Specify module code generation: 'commonjs' or 'amd'" }, - Print_this_message: { code: 6017, category: 2 /* Message */, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: 2 /* Message */, key: "Print the compiler's version." }, - Syntax_Colon_0: { code: 6023, category: 2 /* Message */, key: "Syntax: {0}" }, - options: { code: 6024, category: 2 /* Message */, key: "options" }, - file: { code: 6025, category: 2 /* Message */, key: "file" }, - Examples_Colon_0: { code: 6026, category: 2 /* Message */, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: 2 /* Message */, key: "Options:" }, - Version_0: { code: 6029, category: 2 /* Message */, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2 /* Message */, key: "Insert command line options and files from a file." }, - File_change_detected_Compiling: { code: 6032, category: 2 /* Message */, key: "File change detected. Compiling..." }, - KIND: { code: 6034, category: 2 /* Message */, key: "KIND" }, - FILE: { code: 6035, category: 2 /* Message */, key: "FILE" }, - VERSION: { code: 6036, category: 2 /* Message */, key: "VERSION" }, - LOCATION: { code: 6037, category: 2 /* Message */, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: 2 /* Message */, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2 /* Message */, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: 2 /* Message */, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: 1 /* Error */, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1 /* Error */, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1 /* Error */, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1 /* Error */, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1 /* Error */, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: 1 /* Error */, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: 1 /* Error */, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: 1 /* Error */, key: "Corrupted locale file {0}." }, - Warn_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2 /* Message */, key: "Warn on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: 1 /* Error */, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1 /* Error */, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1 /* Error */, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1 /* Error */, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: 1 /* Error */, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1 /* Error */, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1 /* Error */, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1 /* Error */, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1 /* Error */, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1 /* Error */, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1 /* Error */, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1 /* Error */, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1 /* Error */, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." } - }; -})(ts || (ts = {})); -var ts; -(function (ts) { - var textToToken = { - "any": 109 /* AnyKeyword */, - "boolean": 110 /* BooleanKeyword */, - "break": 64 /* BreakKeyword */, - "case": 65 /* CaseKeyword */, - "catch": 66 /* CatchKeyword */, - "class": 67 /* ClassKeyword */, - "continue": 69 /* ContinueKeyword */, - "const": 68 /* ConstKeyword */, - "constructor": 111 /* ConstructorKeyword */, - "debugger": 70 /* DebuggerKeyword */, - "declare": 112 /* DeclareKeyword */, - "default": 71 /* DefaultKeyword */, - "delete": 72 /* DeleteKeyword */, - "do": 73 /* DoKeyword */, - "else": 74 /* ElseKeyword */, - "enum": 75 /* EnumKeyword */, - "export": 76 /* ExportKeyword */, - "extends": 77 /* ExtendsKeyword */, - "false": 78 /* FalseKeyword */, - "finally": 79 /* FinallyKeyword */, - "for": 80 /* ForKeyword */, - "function": 81 /* FunctionKeyword */, - "get": 113 /* GetKeyword */, - "if": 82 /* IfKeyword */, - "implements": 100 /* ImplementsKeyword */, - "import": 83 /* ImportKeyword */, - "in": 84 /* InKeyword */, - "instanceof": 85 /* InstanceOfKeyword */, - "interface": 101 /* InterfaceKeyword */, - "let": 102 /* LetKeyword */, - "module": 114 /* ModuleKeyword */, - "new": 86 /* NewKeyword */, - "null": 87 /* NullKeyword */, - "number": 116 /* NumberKeyword */, - "package": 103 /* PackageKeyword */, - "private": 104 /* PrivateKeyword */, - "protected": 105 /* ProtectedKeyword */, - "public": 106 /* PublicKeyword */, - "require": 115 /* RequireKeyword */, - "return": 88 /* ReturnKeyword */, - "set": 117 /* SetKeyword */, - "static": 107 /* StaticKeyword */, - "string": 118 /* StringKeyword */, - "super": 89 /* SuperKeyword */, - "switch": 90 /* SwitchKeyword */, - "this": 91 /* ThisKeyword */, - "throw": 92 /* ThrowKeyword */, - "true": 93 /* TrueKeyword */, - "try": 94 /* TryKeyword */, - "type": 119 /* TypeKeyword */, - "typeof": 95 /* TypeOfKeyword */, - "var": 96 /* VarKeyword */, - "void": 97 /* VoidKeyword */, - "while": 98 /* WhileKeyword */, - "with": 99 /* WithKeyword */, - "yield": 108 /* YieldKeyword */, - "{": 13 /* OpenBraceToken */, - "}": 14 /* CloseBraceToken */, - "(": 15 /* OpenParenToken */, - ")": 16 /* CloseParenToken */, - "[": 17 /* OpenBracketToken */, - "]": 18 /* CloseBracketToken */, - ".": 19 /* DotToken */, - "...": 20 /* DotDotDotToken */, - ";": 21 /* SemicolonToken */, - ",": 22 /* CommaToken */, - "<": 23 /* LessThanToken */, - ">": 24 /* GreaterThanToken */, - "<=": 25 /* LessThanEqualsToken */, - ">=": 26 /* GreaterThanEqualsToken */, - "==": 27 /* EqualsEqualsToken */, - "!=": 28 /* ExclamationEqualsToken */, - "===": 29 /* EqualsEqualsEqualsToken */, - "!==": 30 /* ExclamationEqualsEqualsToken */, - "=>": 31 /* EqualsGreaterThanToken */, - "+": 32 /* PlusToken */, - "-": 33 /* MinusToken */, - "*": 34 /* AsteriskToken */, - "/": 35 /* SlashToken */, - "%": 36 /* PercentToken */, - "++": 37 /* PlusPlusToken */, - "--": 38 /* MinusMinusToken */, - "<<": 39 /* LessThanLessThanToken */, - ">>": 40 /* GreaterThanGreaterThanToken */, - ">>>": 41 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 42 /* AmpersandToken */, - "|": 43 /* BarToken */, - "^": 44 /* CaretToken */, - "!": 45 /* ExclamationToken */, - "~": 46 /* TildeToken */, - "&&": 47 /* AmpersandAmpersandToken */, - "||": 48 /* BarBarToken */, - "?": 49 /* QuestionToken */, - ":": 50 /* ColonToken */, - "=": 51 /* EqualsToken */, - "+=": 52 /* PlusEqualsToken */, - "-=": 53 /* MinusEqualsToken */, - "*=": 54 /* AsteriskEqualsToken */, - "/=": 55 /* SlashEqualsToken */, - "%=": 56 /* PercentEqualsToken */, - "<<=": 57 /* LessThanLessThanEqualsToken */, - ">>=": 58 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 60 /* AmpersandEqualsToken */, - "|=": 61 /* BarEqualsToken */, - "^=": 62 /* CaretEqualsToken */ - }; - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - function lookupInUnicodeMap(code, map) { - if (code < map[0]) { - return false; - } - var lo = 0; - var hi = map.length; - var mid; - while (lo + 1 < hi) { - mid = lo + (hi - lo) / 2; - mid -= mid % 2; - if (map[mid] <= code && code <= map[mid + 1]) { - return true; - } - if (code < map[mid]) { - hi = mid; - } - else { - lo = mid + 2; - } - } - return false; - } - function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierStart) : lookupInUnicodeMap(code, unicodeES5IdentifierStart); - } - function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierPart) : lookupInUnicodeMap(code, unicodeES5IdentifierPart); - } - function makeReverseMap(source) { - var result = []; - for (var name in source) { - if (source.hasOwnProperty(name)) { - result[source[name]] = name; - } - } - return result; - } - var tokenStrings = makeReverseMap(textToToken); - function tokenToString(t) { - return tokenStrings[t]; - } - ts.tokenToString = tokenToString; - function getLineStarts(text) { - var result = new Array(); - var pos = 0; - var lineStart = 0; - while (pos < text.length) { - var ch = text.charCodeAt(pos++); - switch (ch) { - case 13 /* carriageReturn */: - if (text.charCodeAt(pos) === 10 /* lineFeed */) { - pos++; - } - case 10 /* lineFeed */: - result.push(lineStart); - lineStart = pos; - break; - default: - if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) { - result.push(lineStart); - lineStart = pos; - } - break; - } - } - result.push(lineStart); - return result; - } - ts.getLineStarts = getLineStarts; - function getPositionFromLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line > 0); - return lineStarts[line - 1] + character - 1; - } - ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; - function getLineAndCharacterOfPosition(lineStarts, position) { - var lineNumber = ts.binarySearch(lineStarts, position); - if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; - } - return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 - }; - } - ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - function positionToLineAndCharacter(text, pos) { - var lineStarts = getLineStarts(text); - return getLineAndCharacterOfPosition(lineStarts, pos); - } - ts.positionToLineAndCharacter = positionToLineAndCharacter; - var hasOwnProperty = Object.prototype.hasOwnProperty; - function isWhiteSpace(ch) { - return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; - } - ts.isWhiteSpace = isWhiteSpace; - function isLineBreak(ch) { - return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */ || ch === 133 /* nextLine */; - } - ts.isLineBreak = isLineBreak; - function isDigit(ch) { - return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; - } - function isOctalDigit(ch) { - return ch >= 48 /* _0 */ && ch <= 55 /* _7 */; - } - ts.isOctalDigit = isOctalDigit; - function skipTrivia(text, pos, stopAfterLineBreak) { - while (true) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13 /* carriageReturn */: - if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) - pos++; - case 10 /* lineFeed */: - pos++; - if (stopAfterLineBreak) - return pos; - continue; - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 32 /* space */: - pos++; - continue; - case 47 /* slash */: - if (text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - while (pos < text.length) { - if (isLineBreak(text.charCodeAt(pos))) { - break; - } - pos++; - } - continue; - } - if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { - pos += 2; - while (pos < text.length) { - if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - break; - } - pos++; - } - continue; - } - break; - default: - if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { - pos++; - continue; - } - break; - } - return pos; - } - } - ts.skipTrivia = skipTrivia; - function getCommentRanges(text, pos, trailing) { - var result; - var collecting = trailing || pos === 0; - while (true) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13 /* carriageReturn */: - if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) - pos++; - case 10 /* lineFeed */: - pos++; - if (trailing) { - return result; - } - collecting = true; - if (result && result.length) { - result[result.length - 1].hasTrailingNewLine = true; - } - continue; - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 32 /* space */: - pos++; - continue; - case 47 /* slash */: - var nextChar = text.charCodeAt(pos + 1); - var hasTrailingNewLine = false; - if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) { - var startPos = pos; - pos += 2; - if (nextChar === 47 /* slash */) { - while (pos < text.length) { - if (isLineBreak(text.charCodeAt(pos))) { - hasTrailingNewLine = true; - break; - } - pos++; - } - } - else { - while (pos < text.length) { - if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - break; - } - pos++; - } - } - if (collecting) { - if (!result) - result = []; - result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); - } - continue; - } - break; - default: - if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { - if (result && result.length && isLineBreak(ch)) { - result[result.length - 1].hasTrailingNewLine = true; - } - pos++; - continue; - } - break; - } - return result; - } - } - function getLeadingCommentRanges(text, pos) { - return getCommentRanges(text, pos, false); - } - ts.getLeadingCommentRanges = getLeadingCommentRanges; - function getTrailingCommentRanges(text, pos) { - return getCommentRanges(text, pos, true); - } - ts.getTrailingCommentRanges = getTrailingCommentRanges; - function isIdentifierStart(ch, languageVersion) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); - } - ts.isIdentifierStart = isIdentifierStart; - function isIdentifierPart(ch, languageVersion) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); - } - ts.isIdentifierPart = isIdentifierPart; - function createScanner(languageVersion, skipTrivia, text, onError, onComment) { - var pos; - var len; - var startPos; - var tokenPos; - var token; - var tokenValue; - var precedingLineBreak; - function error(message) { - if (onError) { - onError(message); - } - } - function isIdentifierStart(ch) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); - } - function isIdentifierPart(ch) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); - } - function scanNumber() { - var start = pos; - while (isDigit(text.charCodeAt(pos))) - pos++; - if (text.charCodeAt(pos) === 46 /* dot */) { - pos++; - while (isDigit(text.charCodeAt(pos))) - pos++; - } - var end = pos; - if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) { - pos++; - if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) - pos++; - if (isDigit(text.charCodeAt(pos))) { - pos++; - while (isDigit(text.charCodeAt(pos))) - pos++; - end = pos; - } - else { - error(ts.Diagnostics.Digit_expected); - } - } - return +(text.substring(start, end)); - } - function scanOctalDigits() { - var start = pos; - while (isOctalDigit(text.charCodeAt(pos))) { - pos++; - } - return +(text.substring(start, pos)); - } - function scanHexDigits(count, mustMatchCount) { - var digits = 0; - var value = 0; - while (digits < count || !mustMatchCount) { - var ch = text.charCodeAt(pos); - if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { - value = value * 16 + ch - 48 /* _0 */; - } - else if (ch >= 65 /* A */ && ch <= 70 /* F */) { - value = value * 16 + ch - 65 /* A */ + 10; - } - else if (ch >= 97 /* a */ && ch <= 102 /* f */) { - value = value * 16 + ch - 97 /* a */ + 10; - } - else { - break; - } - pos++; - digits++; - } - if (digits < count) { - value = -1; - } - return value; - } - function scanString() { - var quote = text.charCodeAt(pos++); - var result = ""; - var start = pos; - while (true) { - if (pos >= len) { - result += text.substring(start, pos); - error(ts.Diagnostics.Unexpected_end_of_text); - break; - } - var ch = text.charCodeAt(pos); - if (ch === quote) { - result += text.substring(start, pos); - pos++; - break; - } - if (ch === 92 /* backslash */) { - result += text.substring(start, pos); - result += scanEscapeSequence(); - start = pos; - continue; - } - if (isLineBreak(ch)) { - result += text.substring(start, pos); - error(ts.Diagnostics.Unterminated_string_literal); - break; - } - pos++; - } - return result; - } - function scanTemplateAndSetTokenValue() { - var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; - pos++; - var start = pos; - var contents = ""; - var resultingToken; - while (true) { - if (pos >= len) { - contents += text.substring(start, pos); - error(ts.Diagnostics.Unexpected_end_of_text); - resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; - break; - } - var currChar = text.charCodeAt(pos); - if (currChar === 96 /* backtick */) { - contents += text.substring(start, pos); - pos++; - resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; - break; - } - if (currChar === 36 /* $ */ && pos + 1 < len && text.charCodeAt(pos + 1) === 123 /* openBrace */) { - contents += text.substring(start, pos); - pos += 2; - resultingToken = startedWithBacktick ? 10 /* TemplateHead */ : 11 /* TemplateMiddle */; - break; - } - if (currChar === 92 /* backslash */) { - contents += text.substring(start, pos); - contents += scanEscapeSequence(); - start = pos; - continue; - } - if (currChar === 13 /* carriageReturn */) { - contents += text.substring(start, pos); - if (pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { - pos++; - } - pos++; - contents += "\n"; - start = pos; - continue; - } - pos++; - } - ts.Debug.assert(resultingToken !== undefined); - tokenValue = contents; - return resultingToken; - } - function scanEscapeSequence() { - pos++; - if (pos >= len) { - error(ts.Diagnostics.Unexpected_end_of_text); - return ""; - } - var ch = text.charCodeAt(pos++); - switch (ch) { - case 48 /* _0 */: - return "\0"; - case 98 /* b */: - return "\b"; - case 116 /* t */: - return "\t"; - case 110 /* n */: - return "\n"; - case 118 /* v */: - return "\v"; - case 102 /* f */: - return "\f"; - case 114 /* r */: - return "\r"; - case 39 /* singleQuote */: - return "\'"; - case 34 /* doubleQuote */: - return "\""; - case 120 /* x */: - case 117 /* u */: - var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); - if (ch >= 0) { - return String.fromCharCode(ch); - } - else { - error(ts.Diagnostics.Hexadecimal_digit_expected); - return ""; - } - case 13 /* carriageReturn */: - if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { - pos++; - } - case 10 /* lineFeed */: - case 8232 /* lineSeparator */: - case 8233 /* paragraphSeparator */: - return ""; - default: - return String.fromCharCode(ch); - } - } - function peekUnicodeEscape() { - if (pos + 5 < len && text.charCodeAt(pos + 1) === 117 /* u */) { - var start = pos; - pos += 2; - var value = scanHexDigits(4, true); - pos = start; - return value; - } - return -1; - } - function scanIdentifierParts() { - var result = ""; - var start = pos; - while (pos < len) { - var ch = text.charCodeAt(pos); - if (isIdentifierPart(ch)) { - pos++; - } - else if (ch === 92 /* backslash */) { - ch = peekUnicodeEscape(); - if (!(ch >= 0 && isIdentifierPart(ch))) { - break; - } - result += text.substring(start, pos); - result += String.fromCharCode(ch); - pos += 6; - start = pos; - } - else { - break; - } - } - result += text.substring(start, pos); - return result; - } - function getIdentifierToken() { - var len = tokenValue.length; - if (len >= 2 && len <= 11) { - var ch = tokenValue.charCodeAt(0); - if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; - } - } - return token = 63 /* Identifier */; - } - function scan() { - startPos = pos; - precedingLineBreak = false; - while (true) { - tokenPos = pos; - if (pos >= len) { - return token = 1 /* EndOfFileToken */; - } - var ch = text.charCodeAt(pos); - switch (ch) { - case 10 /* lineFeed */: - case 13 /* carriageReturn */: - precedingLineBreak = true; - if (skipTrivia) { - pos++; - continue; - } - else { - if (ch === 13 /* carriageReturn */ && pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { - pos += 2; - } - else { - pos++; - } - return token = 4 /* NewLineTrivia */; - } - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 32 /* space */: - if (skipTrivia) { - pos++; - continue; - } - else { - while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { - pos++; - } - return token = 5 /* WhitespaceTrivia */; - } - case 33 /* exclamation */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 30 /* ExclamationEqualsEqualsToken */; - } - return pos += 2, token = 28 /* ExclamationEqualsToken */; - } - return pos++, token = 45 /* ExclamationToken */; - case 34 /* doubleQuote */: - case 39 /* singleQuote */: - tokenValue = scanString(); - return token = 7 /* StringLiteral */; - case 96 /* backtick */: - return token = scanTemplateAndSetTokenValue(); - case 37 /* percent */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 56 /* PercentEqualsToken */; - } - return pos++, token = 36 /* PercentToken */; - case 38 /* ampersand */: - if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 47 /* AmpersandAmpersandToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 60 /* AmpersandEqualsToken */; - } - return pos++, token = 42 /* AmpersandToken */; - case 40 /* openParen */: - return pos++, token = 15 /* OpenParenToken */; - case 41 /* closeParen */: - return pos++, token = 16 /* CloseParenToken */; - case 42 /* asterisk */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 54 /* AsteriskEqualsToken */; - } - return pos++, token = 34 /* AsteriskToken */; - case 43 /* plus */: - if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 37 /* PlusPlusToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 52 /* PlusEqualsToken */; - } - return pos++, token = 32 /* PlusToken */; - case 44 /* comma */: - return pos++, token = 22 /* CommaToken */; - case 45 /* minus */: - if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 38 /* MinusMinusToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 53 /* MinusEqualsToken */; - } - return pos++, token = 33 /* MinusToken */; - case 46 /* dot */: - if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanNumber(); - return token = 6 /* NumericLiteral */; - } - if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 20 /* DotDotDotToken */; - } - return pos++, token = 19 /* DotToken */; - case 47 /* slash */: - if (text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - while (pos < len) { - if (isLineBreak(text.charCodeAt(pos))) { - break; - } - pos++; - } - if (onComment) { - onComment(tokenPos, pos); - } - if (skipTrivia) { - continue; - } - else { - return token = 2 /* SingleLineCommentTrivia */; - } - } - if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { - pos += 2; - var commentClosed = false; - while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - commentClosed = true; - break; - } - if (isLineBreak(ch)) { - precedingLineBreak = true; - } - pos++; - } - if (!commentClosed) { - error(ts.Diagnostics.Asterisk_Slash_expected); - } - if (onComment) { - onComment(tokenPos, pos); - } - if (skipTrivia) { - continue; - } - else { - return token = 3 /* MultiLineCommentTrivia */; - } - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 55 /* SlashEqualsToken */; - } - return pos++, token = 35 /* SlashToken */; - case 48 /* _0 */: - if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { - pos += 2; - var value = scanHexDigits(1, false); - if (value < 0) { - error(ts.Diagnostics.Hexadecimal_digit_expected); - value = 0; - } - tokenValue = "" + value; - return 6 /* NumericLiteral */; - } - if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanOctalDigits(); - return 6 /* NumericLiteral */; - } - case 49 /* _1 */: - case 50 /* _2 */: - case 51 /* _3 */: - case 52 /* _4 */: - case 53 /* _5 */: - case 54 /* _6 */: - case 55 /* _7 */: - case 56 /* _8 */: - case 57 /* _9 */: - tokenValue = "" + scanNumber(); - return token = 6 /* NumericLiteral */; - case 58 /* colon */: - return pos++, token = 50 /* ColonToken */; - case 59 /* semicolon */: - return pos++, token = 21 /* SemicolonToken */; - case 60 /* lessThan */: - if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 57 /* LessThanLessThanEqualsToken */; - } - return pos += 2, token = 39 /* LessThanLessThanToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 25 /* LessThanEqualsToken */; - } - return pos++, token = 23 /* LessThanToken */; - case 61 /* equals */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 29 /* EqualsEqualsEqualsToken */; - } - return pos += 2, token = 27 /* EqualsEqualsToken */; - } - if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 31 /* EqualsGreaterThanToken */; - } - return pos++, token = 51 /* EqualsToken */; - case 62 /* greaterThan */: - return pos++, token = 24 /* GreaterThanToken */; - case 63 /* question */: - return pos++, token = 49 /* QuestionToken */; - case 91 /* openBracket */: - return pos++, token = 17 /* OpenBracketToken */; - case 93 /* closeBracket */: - return pos++, token = 18 /* CloseBracketToken */; - case 94 /* caret */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 62 /* CaretEqualsToken */; - } - return pos++, token = 44 /* CaretToken */; - case 123 /* openBrace */: - return pos++, token = 13 /* OpenBraceToken */; - case 124 /* bar */: - if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 48 /* BarBarToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 61 /* BarEqualsToken */; - } - return pos++, token = 43 /* BarToken */; - case 125 /* closeBrace */: - return pos++, token = 14 /* CloseBraceToken */; - case 126 /* tilde */: - return pos++, token = 46 /* TildeToken */; - case 92 /* backslash */: - var ch = peekUnicodeEscape(); - if (ch >= 0 && isIdentifierStart(ch)) { - pos += 6; - tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); - return token = getIdentifierToken(); - } - error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; - default: - if (isIdentifierStart(ch)) { - pos++; - while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) - pos++; - tokenValue = text.substring(tokenPos, pos); - if (ch === 92 /* backslash */) { - tokenValue += scanIdentifierParts(); - } - return token = getIdentifierToken(); - } - else if (isWhiteSpace(ch)) { - pos++; - continue; - } - else if (isLineBreak(ch)) { - precedingLineBreak = true; - pos++; - continue; - } - error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; - } - } - } - function reScanGreaterToken() { - if (token === 24 /* GreaterThanToken */) { - if (text.charCodeAt(pos) === 62 /* greaterThan */) { - if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */; - } - return pos += 2, token = 41 /* GreaterThanGreaterThanGreaterThanToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 58 /* GreaterThanGreaterThanEqualsToken */; - } - return pos++, token = 40 /* GreaterThanGreaterThanToken */; - } - if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 26 /* GreaterThanEqualsToken */; - } - } - return token; - } - function reScanSlashToken() { - if (token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) { - var p = tokenPos + 1; - var inEscape = false; - var inCharacterClass = false; - while (true) { - if (p >= len) { - return token; - } - var ch = text.charCodeAt(p); - if (isLineBreak(ch)) { - return token; - } - if (inEscape) { - inEscape = false; - } - else if (ch === 47 /* slash */ && !inCharacterClass) { - break; - } - else if (ch === 91 /* openBracket */) { - inCharacterClass = true; - } - else if (ch === 92 /* backslash */) { - inEscape = true; - } - else if (ch === 93 /* closeBracket */) { - inCharacterClass = false; - } - p++; - } - p++; - while (isIdentifierPart(text.charCodeAt(p))) { - p++; - } - pos = p; - tokenValue = text.substring(tokenPos, pos); - token = 8 /* RegularExpressionLiteral */; - } - return token; - } - function reScanTemplateToken() { - ts.Debug.assert(token === 14 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); - pos = tokenPos; - return token = scanTemplateAndSetTokenValue(); - } - function tryScan(callback) { - var savePos = pos; - var saveStartPos = startPos; - var saveTokenPos = tokenPos; - var saveToken = token; - var saveTokenValue = tokenValue; - var savePrecedingLineBreak = precedingLineBreak; - var result = callback(); - if (!result) { - pos = savePos; - startPos = saveStartPos; - tokenPos = saveTokenPos; - token = saveToken; - tokenValue = saveTokenValue; - precedingLineBreak = savePrecedingLineBreak; - } - return result; - } - function setText(newText) { - text = newText || ""; - len = text.length; - setTextPos(0); - } - function setTextPos(textPos) { - pos = textPos; - startPos = textPos; - tokenPos = textPos; - token = 0 /* Unknown */; - precedingLineBreak = false; - } - setText(text); - return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 63 /* Identifier */ || token > 99 /* LastReservedWord */; }, - isReservedWord: function () { return token >= 64 /* FirstReservedWord */ && token <= 99 /* LastReservedWord */; }, - reScanGreaterToken: reScanGreaterToken, - reScanSlashToken: reScanSlashToken, - reScanTemplateToken: reScanTemplateToken, - scan: scan, - setText: setText, - setTextPos: setTextPos, - tryScan: tryScan - }; - } - ts.createScanner = createScanner; -})(ts || (ts = {})); var ts; (function (ts) { (function (EmitReturnStatus) { @@ -1545,6 +130,13 @@ var ts; return result; } ts.sum = sum; + function lastOrUndefined(array) { + if (array.length === 0) { + return undefined; + } + return array[array.length - 1]; + } + ts.lastOrUndefined = lastOrUndefined; function binarySearch(array, value) { var low = 0; var high = array.length - 1; @@ -2192,7 +784,1428 @@ var sys = (function () { })(); var ts; (function (ts) { - var nodeConstructors = new Array(196 /* Count */); + ts.Diagnostics = { + Unterminated_string_literal: { code: 1002, category: 1 /* Error */, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1 /* Error */, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1 /* Error */, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1 /* Error */, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1 /* Error */, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1 /* Error */, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1 /* Error */, key: "Unexpected token." }, + Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1 /* Error */, key: "Catch clause parameter cannot have a type annotation." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1 /* Error */, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1 /* Error */, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1 /* Error */, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1 /* Error */, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1 /* Error */, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1 /* Error */, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1 /* Error */, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1 /* Error */, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1 /* Error */, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1 /* Error */, key: "An index signature parameter type must be 'string' or 'number'." }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1 /* Error */, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1 /* Error */, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1 /* Error */, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1 /* Error */, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1 /* Error */, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1 /* Error */, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1 /* Error */, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1 /* Error */, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1 /* Error */, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1 /* Error */, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1 /* Error */, key: "Statements are not allowed in ambient contexts." }, + A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: 1 /* Error */, key: "A function implementation cannot be declared in an ambient context." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1 /* Error */, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1 /* Error */, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1 /* Error */, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: 1 /* Error */, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1 /* Error */, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1 /* Error */, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1 /* Error */, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1 /* Error */, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1 /* Error */, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1 /* Error */, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1 /* Error */, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1 /* Error */, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1 /* Error */, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1 /* Error */, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1 /* Error */, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1 /* Error */, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1 /* Error */, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1 /* Error */, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1 /* Error */, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1 /* Error */, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1 /* Error */, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1 /* Error */, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1 /* Error */, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1 /* Error */, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1 /* Error */, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1 /* Error */, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1 /* Error */, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1 /* Error */, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1 /* Error */, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1 /* Error */, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1 /* Error */, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1 /* Error */, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1 /* Error */, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1 /* Error */, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1 /* Error */, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1 /* Error */, key: "Type expected." }, + A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: 1 /* Error */, key: "A constructor implementation cannot be declared in an ambient context." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1 /* Error */, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1 /* Error */, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1 /* Error */, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1 /* Error */, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1 /* Error */, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1 /* Error */, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1 /* Error */, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1 /* Error */, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1 /* Error */, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1 /* Error */, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1 /* Error */, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1 /* Error */, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1 /* Error */, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1 /* Error */, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1 /* Error */, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1 /* Error */, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1 /* Error */, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1 /* Error */, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1 /* Error */, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1 /* Error */, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1 /* Error */, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1 /* Error */, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1 /* Error */, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1 /* Error */, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1 /* Error */, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1 /* Error */, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1 /* Error */, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1 /* Error */, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1 /* Error */, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1 /* Error */, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1 /* Error */, key: "Line break not permitted here." }, + catch_or_finally_expected: { code: 1143, category: 1 /* Error */, key: "'catch' or 'finally' expected." }, + Block_or_expected: { code: 1144, category: 1 /* Error */, key: "Block or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1 /* Error */, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1 /* Error */, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1 /* Error */, key: "Import declarations in an internal module cannot reference an external module." }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1 /* Error */, key: "Cannot compile external modules unless the '--module' flag is provided." }, + Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: 1 /* Error */, key: "Filename '{0}' differs from already included filename '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1 /* Error */, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1 /* Error */, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1 /* Error */, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1 /* Error */, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1 /* Error */, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1 /* Error */, key: "'let' declarations can only be declared inside a block." }, + Invalid_template_literal_expected: { code: 1158, category: 1 /* Error */, key: "Invalid template literal; expected '}'" }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1 /* Error */, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, + Unterminated_template_literal: { code: 1160, category: 1 /* Error */, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1 /* Error */, key: "Unterminated regular expression literal." }, + A_object_member_cannot_be_declared_optional: { code: 1160, category: 1 /* Error */, key: "A object member cannot be declared optional." }, + Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* Error */, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, + Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1 /* Error */, key: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1 /* Error */, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1 /* Error */, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1 /* Error */, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1 /* Error */, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1 /* Error */, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1 /* Error */, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1 /* Error */, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1 /* Error */, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1 /* Error */, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1 /* Error */, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1 /* Error */, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1 /* Error */, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1 /* Error */, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1 /* Error */, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1 /* Error */, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1 /* Error */, key: "Cannot find global type '{0}'." }, + Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1 /* Error */, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1 /* Error */, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1 /* Error */, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1 /* Error */, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1 /* Error */, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1 /* Error */, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1 /* Error */, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1 /* Error */, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1 /* Error */, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1 /* Error */, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1 /* Error */, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1 /* Error */, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1 /* Error */, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1 /* Error */, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1 /* Error */, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1 /* Error */, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1 /* Error */, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1 /* Error */, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1 /* Error */, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1 /* Error */, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1 /* Error */, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1 /* Error */, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1 /* Error */, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1 /* Error */, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1 /* Error */, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1 /* Error */, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1 /* Error */, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1 /* Error */, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1 /* Error */, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1 /* Error */, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1 /* Error */, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1 /* Error */, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1 /* Error */, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1 /* Error */, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1 /* Error */, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1 /* Error */, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1 /* Error */, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1 /* Error */, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1 /* Error */, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1 /* Error */, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1 /* Error */, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1 /* Error */, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1 /* Error */, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1 /* Error */, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1 /* Error */, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1 /* Error */, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1 /* Error */, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1 /* Error */, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1 /* Error */, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1 /* Error */, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1 /* Error */, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1 /* Error */, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1 /* Error */, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1 /* Error */, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1 /* Error */, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1 /* Error */, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1 /* Error */, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1 /* Error */, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1 /* Error */, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1 /* Error */, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1 /* Error */, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1 /* Error */, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1 /* Error */, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1 /* Error */, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1 /* Error */, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1 /* Error */, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1 /* Error */, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1 /* Error */, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: { code: 2397, category: 1 /* Error */, key: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter." }, + Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2398, category: 1 /* Error */, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1 /* Error */, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1 /* Error */, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1 /* Error */, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1 /* Error */, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1 /* Error */, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1 /* Error */, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1 /* Error */, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1 /* Error */, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1 /* Error */, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1 /* Error */, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1 /* Error */, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1 /* Error */, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1 /* Error */, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1 /* Error */, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1 /* Error */, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1 /* Error */, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1 /* Error */, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1 /* Error */, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1 /* Error */, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1 /* Error */, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1 /* Error */, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1 /* Error */, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1 /* Error */, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1 /* Error */, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1 /* Error */, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1 /* Error */, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1 /* Error */, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1 /* Error */, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1 /* Error */, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1 /* Error */, key: "Import name cannot be '{0}'" }, + Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1 /* Error */, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1 /* Error */, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1 /* Error */, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1 /* Error */, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1 /* Error */, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1 /* Error */, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1 /* Error */, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1 /* Error */, key: "Block-scoped variable '{0}' used before its declaration.", isEarly: true }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1 /* Error */, key: "The operand of an increment or decrement operator cannot be a constant.", isEarly: true }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1 /* Error */, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1 /* Error */, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1 /* Error */, key: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1 /* Error */, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1 /* Error */, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1 /* Error */, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1 /* Error */, key: "Type alias name cannot be '{0}'" }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* Error */, key: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4003, category: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4005, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4007, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4009, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4011, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4013, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4015, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4017, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4018, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2: { code: 4021, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using name '{1}' from private module '{2}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1 /* Error */, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1 /* Error */, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1 /* Error */, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1 /* Error */, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1 /* Error */, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4079, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_type_alias_0_has_or_is_using_name_1_from_private_module_2: { code: 4080, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1 /* Error */, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1 /* Error */, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1 /* Error */, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + Index_expression_arguments_in_const_enums_must_be_of_type_string: { code: 4085, category: 1 /* Error */, key: "Index expression arguments in 'const' enums must be of type 'string'." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: 1 /* Error */, key: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1 /* Error */, key: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: 1 /* Error */, key: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: 1 /* Error */, key: "Unsupported file encoding." }, + Unknown_compiler_option_0: { code: 5023, category: 1 /* Error */, key: "Unknown compiler option '{0}'." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: 1 /* Error */, key: "Could not write file '{0}': {1}" }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1 /* Error */, key: "Option mapRoot cannot be specified without specifying sourcemap option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1 /* Error */, key: "Option sourceRoot cannot be specified without specifying sourcemap option." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2 /* Message */, key: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: 2 /* Message */, key: "Generates corresponding '.d.ts' file." }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2 /* 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: 2 /* Message */, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2 /* Message */, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2 /* Message */, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2 /* Message */, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2 /* Message */, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2 /* Message */, key: "Do not emit comments to output." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2 /* Message */, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2 /* Message */, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Print_this_message: { code: 6017, category: 2 /* Message */, key: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: 2 /* Message */, key: "Print the compiler's version." }, + Syntax_Colon_0: { code: 6023, category: 2 /* Message */, key: "Syntax: {0}" }, + options: { code: 6024, category: 2 /* Message */, key: "options" }, + file: { code: 6025, category: 2 /* Message */, key: "file" }, + Examples_Colon_0: { code: 6026, category: 2 /* Message */, key: "Examples: {0}" }, + Options_Colon: { code: 6027, category: 2 /* Message */, key: "Options:" }, + Version_0: { code: 6029, category: 2 /* Message */, key: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2 /* Message */, key: "Insert command line options and files from a file." }, + File_change_detected_Compiling: { code: 6032, category: 2 /* Message */, key: "File change detected. Compiling..." }, + KIND: { code: 6034, category: 2 /* Message */, key: "KIND" }, + FILE: { code: 6035, category: 2 /* Message */, key: "FILE" }, + VERSION: { code: 6036, category: 2 /* Message */, key: "VERSION" }, + LOCATION: { code: 6037, category: 2 /* Message */, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2 /* Message */, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2 /* Message */, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2 /* Message */, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1 /* Error */, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1 /* Error */, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1 /* Error */, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1 /* Error */, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1 /* Error */, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: 1 /* Error */, key: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: 1 /* Error */, key: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: 1 /* Error */, key: "Corrupted locale file {0}." }, + Warn_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2 /* Message */, key: "Warn on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: 1 /* Error */, key: "File '{0}' not found." }, + File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1 /* Error */, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1 /* Error */, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1 /* Error */, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1 /* Error */, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1 /* Error */, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1 /* Error */, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1 /* Error */, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1 /* Error */, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1 /* Error */, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1 /* Error */, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1 /* Error */, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1 /* Error */, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." } + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + var textToToken = { + "any": 109 /* AnyKeyword */, + "boolean": 110 /* BooleanKeyword */, + "break": 64 /* BreakKeyword */, + "case": 65 /* CaseKeyword */, + "catch": 66 /* CatchKeyword */, + "class": 67 /* ClassKeyword */, + "continue": 69 /* ContinueKeyword */, + "const": 68 /* ConstKeyword */, + "constructor": 111 /* ConstructorKeyword */, + "debugger": 70 /* DebuggerKeyword */, + "declare": 112 /* DeclareKeyword */, + "default": 71 /* DefaultKeyword */, + "delete": 72 /* DeleteKeyword */, + "do": 73 /* DoKeyword */, + "else": 74 /* ElseKeyword */, + "enum": 75 /* EnumKeyword */, + "export": 76 /* ExportKeyword */, + "extends": 77 /* ExtendsKeyword */, + "false": 78 /* FalseKeyword */, + "finally": 79 /* FinallyKeyword */, + "for": 80 /* ForKeyword */, + "function": 81 /* FunctionKeyword */, + "get": 113 /* GetKeyword */, + "if": 82 /* IfKeyword */, + "implements": 100 /* ImplementsKeyword */, + "import": 83 /* ImportKeyword */, + "in": 84 /* InKeyword */, + "instanceof": 85 /* InstanceOfKeyword */, + "interface": 101 /* InterfaceKeyword */, + "let": 102 /* LetKeyword */, + "module": 114 /* ModuleKeyword */, + "new": 86 /* NewKeyword */, + "null": 87 /* NullKeyword */, + "number": 116 /* NumberKeyword */, + "package": 103 /* PackageKeyword */, + "private": 104 /* PrivateKeyword */, + "protected": 105 /* ProtectedKeyword */, + "public": 106 /* PublicKeyword */, + "require": 115 /* RequireKeyword */, + "return": 88 /* ReturnKeyword */, + "set": 117 /* SetKeyword */, + "static": 107 /* StaticKeyword */, + "string": 118 /* StringKeyword */, + "super": 89 /* SuperKeyword */, + "switch": 90 /* SwitchKeyword */, + "this": 91 /* ThisKeyword */, + "throw": 92 /* ThrowKeyword */, + "true": 93 /* TrueKeyword */, + "try": 94 /* TryKeyword */, + "type": 119 /* TypeKeyword */, + "typeof": 95 /* TypeOfKeyword */, + "var": 96 /* VarKeyword */, + "void": 97 /* VoidKeyword */, + "while": 98 /* WhileKeyword */, + "with": 99 /* WithKeyword */, + "yield": 108 /* YieldKeyword */, + "{": 13 /* OpenBraceToken */, + "}": 14 /* CloseBraceToken */, + "(": 15 /* OpenParenToken */, + ")": 16 /* CloseParenToken */, + "[": 17 /* OpenBracketToken */, + "]": 18 /* CloseBracketToken */, + ".": 19 /* DotToken */, + "...": 20 /* DotDotDotToken */, + ";": 21 /* SemicolonToken */, + ",": 22 /* CommaToken */, + "<": 23 /* LessThanToken */, + ">": 24 /* GreaterThanToken */, + "<=": 25 /* LessThanEqualsToken */, + ">=": 26 /* GreaterThanEqualsToken */, + "==": 27 /* EqualsEqualsToken */, + "!=": 28 /* ExclamationEqualsToken */, + "===": 29 /* EqualsEqualsEqualsToken */, + "!==": 30 /* ExclamationEqualsEqualsToken */, + "=>": 31 /* EqualsGreaterThanToken */, + "+": 32 /* PlusToken */, + "-": 33 /* MinusToken */, + "*": 34 /* AsteriskToken */, + "/": 35 /* SlashToken */, + "%": 36 /* PercentToken */, + "++": 37 /* PlusPlusToken */, + "--": 38 /* MinusMinusToken */, + "<<": 39 /* LessThanLessThanToken */, + ">>": 40 /* GreaterThanGreaterThanToken */, + ">>>": 41 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 42 /* AmpersandToken */, + "|": 43 /* BarToken */, + "^": 44 /* CaretToken */, + "!": 45 /* ExclamationToken */, + "~": 46 /* TildeToken */, + "&&": 47 /* AmpersandAmpersandToken */, + "||": 48 /* BarBarToken */, + "?": 49 /* QuestionToken */, + ":": 50 /* ColonToken */, + "=": 51 /* EqualsToken */, + "+=": 52 /* PlusEqualsToken */, + "-=": 53 /* MinusEqualsToken */, + "*=": 54 /* AsteriskEqualsToken */, + "/=": 55 /* SlashEqualsToken */, + "%=": 56 /* PercentEqualsToken */, + "<<=": 57 /* LessThanLessThanEqualsToken */, + ">>=": 58 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 60 /* AmpersandEqualsToken */, + "|=": 61 /* BarEqualsToken */, + "^=": 62 /* CaretEqualsToken */ + }; + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + function lookupInUnicodeMap(code, map) { + if (code < map[0]) { + return false; + } + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { + return true; + } + if (code < map[mid]) { + hi = mid; + } + else { + lo = mid + 2; + } + } + return false; + } + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierStart) : lookupInUnicodeMap(code, unicodeES5IdentifierStart); + } + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierPart) : lookupInUnicodeMap(code, unicodeES5IdentifierPart); + } + function makeReverseMap(source) { + var result = []; + for (var name in source) { + if (source.hasOwnProperty(name)) { + result[source[name]] = name; + } + } + return result; + } + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; + } + ts.tokenToString = tokenToString; + function computeLineStarts(text) { + var result = new Array(); + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos++); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; + } + } + result.push(lineStart); + return result; + } + ts.computeLineStarts = computeLineStarts; + function getPositionFromLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line > 0); + return lineStarts[line - 1] + character - 1; + } + ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; + function getLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = ts.binarySearch(lineStarts, position); + if (lineNumber < 0) { + lineNumber = (~lineNumber) - 1; + } + return { + line: lineNumber + 1, + character: position - lineStarts[lineNumber] + 1 + }; + } + ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; + function positionToLineAndCharacter(text, pos) { + var lineStarts = computeLineStarts(text); + return getLineAndCharacterOfPosition(lineStarts, pos); + } + ts.positionToLineAndCharacter = positionToLineAndCharacter; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function isWhiteSpace(ch) { + return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; + } + ts.isWhiteSpace = isWhiteSpace; + function isLineBreak(ch) { + return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */ || ch === 133 /* nextLine */; + } + ts.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; + } + function isOctalDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 55 /* _7 */; + } + ts.isOctalDigit = isOctalDigit; + function skipTrivia(text, pos, stopAfterLineBreak) { + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) + pos++; + case 10 /* lineFeed */: + pos++; + if (stopAfterLineBreak) + return pos; + continue; + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + pos++; + continue; + case 47 /* slash */: + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + continue; + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + break; + } + pos++; + } + continue; + } + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + pos++; + continue; + } + break; + } + return pos; + } + } + ts.skipTrivia = skipTrivia; + function getCommentRanges(text, pos, trailing) { + var result; + var collecting = trailing || pos === 0; + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) + pos++; + case 10 /* lineFeed */: + pos++; + if (trailing) { + return result; + } + collecting = true; + if (result && result.length) { + result[result.length - 1].hasTrailingNewLine = true; + } + continue; + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + pos++; + continue; + case 47 /* slash */: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) { + var startPos = pos; + pos += 2; + if (nextChar === 47 /* slash */) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } + else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (!result) + result = []; + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + } + continue; + } + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + if (result && result.length && isLineBreak(ch)) { + result[result.length - 1].hasTrailingNewLine = true; + } + pos++; + continue; + } + break; + } + return result; + } + } + function getLeadingCommentRanges(text, pos) { + return getCommentRanges(text, pos, false); + } + ts.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return getCommentRanges(text, pos, true); + } + ts.getTrailingCommentRanges = getTrailingCommentRanges; + function isIdentifierStart(ch, languageVersion) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); + } + ts.isIdentifierStart = isIdentifierStart; + function isIdentifierPart(ch, languageVersion) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); + } + ts.isIdentifierPart = isIdentifierPart; + function createScanner(languageVersion, skipTrivia, text, onError, onComment) { + var pos; + var len; + var startPos; + var tokenPos; + var token; + var tokenValue; + var precedingLineBreak; + function error(message) { + if (onError) { + onError(message); + } + } + function isIdentifierStart(ch) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); + } + function isIdentifierPart(ch) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); + } + function scanNumber() { + var start = pos; + while (isDigit(text.charCodeAt(pos))) + pos++; + if (text.charCodeAt(pos) === 46 /* dot */) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + } + var end = pos; + if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) { + pos++; + if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) + pos++; + if (isDigit(text.charCodeAt(pos))) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + end = pos; + } + else { + error(ts.Diagnostics.Digit_expected); + } + } + return +(text.substring(start, end)); + } + function scanOctalDigits() { + var start = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + return +(text.substring(start, pos)); + } + function scanHexDigits(count, mustMatchCount) { + var digits = 0; + var value = 0; + while (digits < count || !mustMatchCount) { + var ch = text.charCodeAt(pos); + if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { + value = value * 16 + ch - 48 /* _0 */; + } + else if (ch >= 65 /* A */ && ch <= 70 /* F */) { + value = value * 16 + ch - 65 /* A */ + 10; + } + else if (ch >= 97 /* a */ && ch <= 102 /* f */) { + value = value * 16 + ch - 97 /* a */ + 10; + } + else { + break; + } + pos++; + digits++; + } + if (digits < count) { + value = -1; + } + return value; + } + function scanString() { + var quote = text.charCodeAt(pos++); + var result = ""; + var start = pos; + while (true) { + if (pos >= len) { + result += text.substring(start, pos); + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92 /* backslash */) { + result += text.substring(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; + } + if (isLineBreak(ch)) { + result += text.substring(start, pos); + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + pos++; + } + return result; + } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= len) { + contents += text.substring(start, pos); + error(ts.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96 /* backtick */) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + if (currChar === 36 /* $ */ && pos + 1 < len && text.charCodeAt(pos + 1) === 123 /* openBrace */) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 10 /* TemplateHead */ : 11 /* TemplateMiddle */; + break; + } + if (currChar === 92 /* backslash */) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13 /* carriageReturn */) { + contents += text.substring(start, pos); + if (pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos++; + } + pos++; + contents += "\n"; + start = pos; + continue; + } + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence() { + pos++; + if (pos >= len) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos++); + switch (ch) { + case 48 /* _0 */: + return "\0"; + case 98 /* b */: + return "\b"; + case 116 /* t */: + return "\t"; + case 110 /* n */: + return "\n"; + case 118 /* v */: + return "\v"; + case 102 /* f */: + return "\f"; + case 114 /* r */: + return "\r"; + case 39 /* singleQuote */: + return "\'"; + case 34 /* doubleQuote */: + return "\""; + case 120 /* x */: + case 117 /* u */: + var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); + if (ch >= 0) { + return String.fromCharCode(ch); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + case 13 /* carriageReturn */: + if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + case 8232 /* lineSeparator */: + case 8233 /* paragraphSeparator */: + return ""; + default: + return String.fromCharCode(ch); + } + } + function peekUnicodeEscape() { + if (pos + 5 < len && text.charCodeAt(pos + 1) === 117 /* u */) { + var start = pos; + pos += 2; + var value = scanHexDigits(4, true); + pos = start; + return value; + } + return -1; + } + function scanIdentifierParts() { + var result = ""; + var start = pos; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (isIdentifierPart(ch)) { + pos++; + } + else if (ch === 92 /* backslash */) { + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch))) { + break; + } + result += text.substring(start, pos); + result += String.fromCharCode(ch); + pos += 6; + start = pos; + } + else { + break; + } + } + result += text.substring(start, pos); + return result; + } + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { + return token = textToToken[tokenValue]; + } + } + return token = 63 /* Identifier */; + } + function scan() { + startPos = pos; + precedingLineBreak = false; + while (true) { + tokenPos = pos; + if (pos >= len) { + return token = 1 /* EndOfFileToken */; + } + var ch = text.charCodeAt(pos); + switch (ch) { + case 10 /* lineFeed */: + case 13 /* carriageReturn */: + precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === 13 /* carriageReturn */ && pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos += 2; + } + else { + pos++; + } + return token = 4 /* NewLineTrivia */; + } + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { + pos++; + } + return token = 5 /* WhitespaceTrivia */; + } + case 33 /* exclamation */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 30 /* ExclamationEqualsEqualsToken */; + } + return pos += 2, token = 28 /* ExclamationEqualsToken */; + } + return pos++, token = 45 /* ExclamationToken */; + case 34 /* doubleQuote */: + case 39 /* singleQuote */: + tokenValue = scanString(); + return token = 7 /* StringLiteral */; + case 96 /* backtick */: + return token = scanTemplateAndSetTokenValue(); + case 37 /* percent */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 56 /* PercentEqualsToken */; + } + return pos++, token = 36 /* PercentToken */; + case 38 /* ampersand */: + if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { + return pos += 2, token = 47 /* AmpersandAmpersandToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 60 /* AmpersandEqualsToken */; + } + return pos++, token = 42 /* AmpersandToken */; + case 40 /* openParen */: + return pos++, token = 15 /* OpenParenToken */; + case 41 /* closeParen */: + return pos++, token = 16 /* CloseParenToken */; + case 42 /* asterisk */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 54 /* AsteriskEqualsToken */; + } + return pos++, token = 34 /* AsteriskToken */; + case 43 /* plus */: + if (text.charCodeAt(pos + 1) === 43 /* plus */) { + return pos += 2, token = 37 /* PlusPlusToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 52 /* PlusEqualsToken */; + } + return pos++, token = 32 /* PlusToken */; + case 44 /* comma */: + return pos++, token = 22 /* CommaToken */; + case 45 /* minus */: + if (text.charCodeAt(pos + 1) === 45 /* minus */) { + return pos += 2, token = 38 /* MinusMinusToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 53 /* MinusEqualsToken */; + } + return pos++, token = 33 /* MinusToken */; + case 46 /* dot */: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanNumber(); + return token = 6 /* NumericLiteral */; + } + if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { + return pos += 3, token = 20 /* DotDotDotToken */; + } + return pos++, token = 19 /* DotToken */; + case 47 /* slash */: + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < len) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + if (onComment) { + onComment(tokenPos, pos); + } + if (skipTrivia) { + continue; + } + else { + return token = 2 /* SingleLineCommentTrivia */; + } + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + var commentClosed = false; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + commentClosed = true; + break; + } + if (isLineBreak(ch)) { + precedingLineBreak = true; + } + pos++; + } + if (!commentClosed) { + error(ts.Diagnostics.Asterisk_Slash_expected); + } + if (onComment) { + onComment(tokenPos, pos); + } + if (skipTrivia) { + continue; + } + else { + return token = 3 /* MultiLineCommentTrivia */; + } + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 55 /* SlashEqualsToken */; + } + return pos++, token = 35 /* SlashToken */; + case 48 /* _0 */: + if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { + pos += 2; + var value = scanHexDigits(1, false); + if (value < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return 6 /* NumericLiteral */; + } + if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + return 6 /* NumericLiteral */; + } + case 49 /* _1 */: + case 50 /* _2 */: + case 51 /* _3 */: + case 52 /* _4 */: + case 53 /* _5 */: + case 54 /* _6 */: + case 55 /* _7 */: + case 56 /* _8 */: + case 57 /* _9 */: + tokenValue = "" + scanNumber(); + return token = 6 /* NumericLiteral */; + case 58 /* colon */: + return pos++, token = 50 /* ColonToken */; + case 59 /* semicolon */: + return pos++, token = 21 /* SemicolonToken */; + case 60 /* lessThan */: + if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 57 /* LessThanLessThanEqualsToken */; + } + return pos += 2, token = 39 /* LessThanLessThanToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 25 /* LessThanEqualsToken */; + } + return pos++, token = 23 /* LessThanToken */; + case 61 /* equals */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 29 /* EqualsEqualsEqualsToken */; + } + return pos += 2, token = 27 /* EqualsEqualsToken */; + } + if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { + return pos += 2, token = 31 /* EqualsGreaterThanToken */; + } + return pos++, token = 51 /* EqualsToken */; + case 62 /* greaterThan */: + return pos++, token = 24 /* GreaterThanToken */; + case 63 /* question */: + return pos++, token = 49 /* QuestionToken */; + case 91 /* openBracket */: + return pos++, token = 17 /* OpenBracketToken */; + case 93 /* closeBracket */: + return pos++, token = 18 /* CloseBracketToken */; + case 94 /* caret */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 62 /* CaretEqualsToken */; + } + return pos++, token = 44 /* CaretToken */; + case 123 /* openBrace */: + return pos++, token = 13 /* OpenBraceToken */; + case 124 /* bar */: + if (text.charCodeAt(pos + 1) === 124 /* bar */) { + return pos += 2, token = 48 /* BarBarToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 61 /* BarEqualsToken */; + } + return pos++, token = 43 /* BarToken */; + case 125 /* closeBrace */: + return pos++, token = 14 /* CloseBraceToken */; + case 126 /* tilde */: + return pos++, token = 46 /* TildeToken */; + case 92 /* backslash */: + var ch = peekUnicodeEscape(); + if (ch >= 0 && isIdentifierStart(ch)) { + pos += 6; + tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0 /* Unknown */; + default: + if (isIdentifierStart(ch)) { + pos++; + while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) + pos++; + tokenValue = text.substring(tokenPos, pos); + if (ch === 92 /* backslash */) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } + else if (isWhiteSpace(ch)) { + pos++; + continue; + } + else if (isLineBreak(ch)) { + precedingLineBreak = true; + pos++; + continue; + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0 /* Unknown */; + } + } + } + function reScanGreaterToken() { + if (token === 24 /* GreaterThanToken */) { + if (text.charCodeAt(pos) === 62 /* greaterThan */) { + if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + } + return pos += 2, token = 41 /* GreaterThanGreaterThanGreaterThanToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 58 /* GreaterThanGreaterThanEqualsToken */; + } + return pos++, token = 40 /* GreaterThanGreaterThanToken */; + } + if (text.charCodeAt(pos) === 61 /* equals */) { + return pos++, token = 26 /* GreaterThanEqualsToken */; + } + } + return token; + } + function reScanSlashToken() { + if (token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= len) { + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + if (inEscape) { + inEscape = false; + } + else if (ch === 47 /* slash */ && !inCharacterClass) { + p++; + break; + } + else if (ch === 91 /* openBracket */) { + inCharacterClass = true; + } + else if (ch === 92 /* backslash */) { + inEscape = true; + } + else if (ch === 93 /* closeBracket */) { + inCharacterClass = false; + } + p++; + } + while (p < len && isIdentifierPart(text.charCodeAt(p))) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 8 /* RegularExpressionLiteral */; + } + return token; + } + function reScanTemplateToken() { + ts.Debug.assert(token === 14 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } + function tryScan(callback) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var savePrecedingLineBreak = precedingLineBreak; + var result = callback(); + if (!result) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + precedingLineBreak = savePrecedingLineBreak; + } + return result; + } + function setText(newText) { + text = newText || ""; + len = text.length; + setTextPos(0); + } + function setTextPos(textPos) { + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0 /* Unknown */; + precedingLineBreak = false; + } + setText(text); + return { + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 63 /* Identifier */ || token > 99 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 64 /* FirstReservedWord */ && token <= 99 /* LastReservedWord */; }, + reScanGreaterToken: reScanGreaterToken, + reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, + scan: scan, + setText: setText, + setTextPos: setTextPos, + tryScan: tryScan + }; + } + ts.createScanner = createScanner; +})(ts || (ts = {})); +var ts; +(function (ts) { + var nodeConstructors = new Array(199 /* Count */); function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); } @@ -2205,7 +2218,7 @@ var ts; return node; } function getSourceFileOfNode(node) { - while (node && node.kind !== 193 /* SourceFile */) + while (node && node.kind !== 196 /* SourceFile */) node = node.parent; return node; } @@ -2221,6 +2234,9 @@ var ts; } ts.getStartPosOfNode = getStartPosOfNode; function getTokenPosOfNode(node, sourceFile) { + if (node.pos === node.end) { + return node.pos; + } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; @@ -2241,10 +2257,10 @@ var ts; return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier; } ts.unescapeIdentifier = unescapeIdentifier; - function identifierToString(identifier) { - return identifier.kind === 120 /* Missing */ ? "(Missing)" : getTextOfNode(identifier); + function declarationNameToString(name) { + return name.kind === 120 /* Missing */ ? "(Missing)" : getTextOfNode(name); } - ts.identifierToString = identifierToString; + ts.declarationNameToString = declarationNameToString; function createDiagnosticForNode(node, message, arg0, arg1, arg2) { node = getErrorSpanForNode(node); var file = getSourceFileOfNode(node); @@ -2264,12 +2280,12 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 181 /* VariableDeclaration */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 188 /* ModuleDeclaration */: - case 187 /* EnumDeclaration */: - case 192 /* EnumMember */: + case 184 /* VariableDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 191 /* ModuleDeclaration */: + case 190 /* EnumDeclaration */: + case 195 /* EnumMember */: errorSpan = node.name; break; } @@ -2289,7 +2305,7 @@ var ts; } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isPrologueDirective(node) { - return node.kind === 161 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; + return node.kind === 164 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function isEvalOrArgumentsIdentifier(node) { @@ -2344,8 +2360,11 @@ var ts; case 123 /* Parameter */: return child(node.name) || child(node.type) || child(node.initializer); case 124 /* Property */: - case 141 /* PropertyAssignment */: + case 143 /* PropertyAssignment */: + case 144 /* ShorthandPropertyAssignment */: return child(node.name) || child(node.type) || child(node.initializer); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: case 129 /* CallSignature */: case 130 /* ConstructSignature */: case 131 /* IndexSignature */: @@ -2354,110 +2373,110 @@ var ts; case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 149 /* FunctionExpression */: - case 182 /* FunctionDeclaration */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 153 /* ArrowFunction */: return child(node.name) || children(node.typeParameters) || children(node.parameters) || child(node.type) || child(node.body); case 132 /* TypeReference */: return child(node.typeName) || children(node.typeArguments); - case 133 /* TypeQuery */: + case 135 /* TypeQuery */: return child(node.exprName); - case 134 /* TypeLiteral */: + case 136 /* TypeLiteral */: return children(node.members); - case 135 /* ArrayType */: + case 137 /* ArrayType */: return child(node.elementType); - case 136 /* TupleType */: + case 138 /* TupleType */: return children(node.elementTypes); - case 137 /* UnionType */: + case 139 /* UnionType */: return children(node.types); - case 138 /* ParenType */: + case 140 /* ParenType */: return child(node.type); - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: return children(node.elements); - case 140 /* ObjectLiteral */: + case 142 /* ObjectLiteral */: return children(node.properties); - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: return child(node.left) || child(node.right); - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: return child(node.object) || child(node.index); - case 144 /* CallExpression */: - case 145 /* NewExpression */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: return child(node.func) || children(node.typeArguments) || children(node.arguments); - case 146 /* TaggedTemplateExpression */: + case 149 /* TaggedTemplateExpression */: return child(node.tag) || child(node.template); - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return child(node.type) || child(node.operand); - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return child(node.expression); - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: return child(node.operand); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return child(node.left) || child(node.right); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return child(node.condition) || child(node.whenTrue) || child(node.whenFalse); - case 158 /* Block */: - case 177 /* TryBlock */: - case 179 /* FinallyBlock */: - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: - case 193 /* SourceFile */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 182 /* FinallyBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: + case 196 /* SourceFile */: return children(node.statements); - case 159 /* VariableStatement */: + case 162 /* VariableStatement */: return children(node.declarations); - case 161 /* ExpressionStatement */: + case 164 /* ExpressionStatement */: return child(node.expression); - case 162 /* IfStatement */: + case 165 /* IfStatement */: return child(node.expression) || child(node.thenStatement) || child(node.elseStatement); - case 163 /* DoStatement */: + case 166 /* DoStatement */: return child(node.statement) || child(node.expression); - case 164 /* WhileStatement */: + case 167 /* WhileStatement */: return child(node.expression) || child(node.statement); - case 165 /* ForStatement */: + case 168 /* ForStatement */: return children(node.declarations) || child(node.initializer) || child(node.condition) || child(node.iterator) || child(node.statement); - case 166 /* ForInStatement */: + case 169 /* ForInStatement */: return child(node.declaration) || child(node.variable) || child(node.expression) || child(node.statement); - case 167 /* ContinueStatement */: - case 168 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 171 /* BreakStatement */: return child(node.label); - case 169 /* ReturnStatement */: + case 172 /* ReturnStatement */: return child(node.expression); - case 170 /* WithStatement */: + case 173 /* WithStatement */: return child(node.expression) || child(node.statement); - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: return child(node.expression) || children(node.clauses); - case 172 /* CaseClause */: - case 173 /* DefaultClause */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: return child(node.expression) || children(node.statements); - case 174 /* LabeledStatement */: + case 177 /* LabeledStatement */: return child(node.label) || child(node.statement); - case 175 /* ThrowStatement */: + case 178 /* ThrowStatement */: return child(node.expression); - case 176 /* TryStatement */: + case 179 /* TryStatement */: return child(node.tryBlock) || child(node.catchBlock) || child(node.finallyBlock); - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: return child(node.variable) || children(node.statements); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return child(node.name) || child(node.type) || child(node.initializer); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return child(node.name) || children(node.typeParameters) || child(node.baseType) || children(node.implementedTypes) || children(node.members); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return child(node.name) || children(node.typeParameters) || children(node.baseTypes) || children(node.members); - case 186 /* TypeAliasDeclaration */: + case 189 /* TypeAliasDeclaration */: return child(node.name) || child(node.type); - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: return child(node.name) || children(node.members); - case 192 /* EnumMember */: + case 195 /* EnumMember */: return child(node.name) || child(node.initializer); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return child(node.name) || child(node.body); - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return child(node.name) || child(node.entityName) || child(node.externalModuleName); - case 191 /* ExportAssignment */: + case 194 /* ExportAssignment */: return child(node.exportName); - case 155 /* TemplateExpression */: + case 158 /* TemplateExpression */: return child(node.head) || children(node.templateSpans); - case 156 /* TemplateSpan */: + case 159 /* TemplateSpan */: return child(node.expression) || child(node.literal); } } @@ -2466,24 +2485,24 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 169 /* ReturnStatement */: + case 172 /* ReturnStatement */: return visitor(node); - case 158 /* Block */: - case 183 /* FunctionBlock */: - case 162 /* IfStatement */: - case 163 /* DoStatement */: - case 164 /* WhileStatement */: - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 170 /* WithStatement */: - case 171 /* SwitchStatement */: - case 172 /* CaseClause */: - case 173 /* DefaultClause */: - case 174 /* LabeledStatement */: - case 176 /* TryStatement */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: + case 161 /* Block */: + case 186 /* FunctionBlock */: + case 165 /* IfStatement */: + case 166 /* DoStatement */: + case 167 /* WhileStatement */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 173 /* WithStatement */: + case 174 /* SwitchStatement */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: return forEachChild(node, traverse); } } @@ -2492,9 +2511,9 @@ var ts; function isAnyFunction(node) { if (node) { switch (node.kind) { - case 149 /* FunctionExpression */: - case 182 /* FunctionDeclaration */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 153 /* ArrowFunction */: case 125 /* Method */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: @@ -2521,20 +2540,20 @@ var ts; return undefined; } switch (node.kind) { - case 150 /* ArrowFunction */: + case 153 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 188 /* ModuleDeclaration */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 191 /* ModuleDeclaration */: case 124 /* Property */: case 125 /* Method */: case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 187 /* EnumDeclaration */: - case 193 /* SourceFile */: + case 190 /* EnumDeclaration */: + case 196 /* SourceFile */: return node; } } @@ -2565,60 +2584,62 @@ var ts; case 93 /* TrueKeyword */: case 78 /* FalseKeyword */: case 8 /* RegularExpressionLiteral */: - case 139 /* ArrayLiteral */: - case 140 /* ObjectLiteral */: - case 142 /* PropertyAccess */: - case 143 /* IndexedAccess */: - case 144 /* CallExpression */: - case 145 /* NewExpression */: - case 146 /* TaggedTemplateExpression */: - case 147 /* TypeAssertion */: - case 148 /* ParenExpression */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: - case 153 /* BinaryExpression */: - case 154 /* ConditionalExpression */: - case 155 /* TemplateExpression */: - case 157 /* OmittedExpression */: + case 141 /* ArrayLiteral */: + case 142 /* ObjectLiteral */: + case 145 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: + case 149 /* TaggedTemplateExpression */: + case 150 /* TypeAssertion */: + case 151 /* ParenExpression */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: + case 156 /* BinaryExpression */: + case 157 /* ConditionalExpression */: + case 158 /* TemplateExpression */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 160 /* OmittedExpression */: return true; case 121 /* QualifiedName */: while (node.parent.kind === 121 /* QualifiedName */) node = node.parent; - return node.parent.kind === 133 /* TypeQuery */; + return node.parent.kind === 135 /* TypeQuery */; case 63 /* Identifier */: - if (node.parent.kind === 133 /* TypeQuery */) { + if (node.parent.kind === 135 /* TypeQuery */) { return true; } case 6 /* NumericLiteral */: case 7 /* StringLiteral */: - case 9 /* NoSubstitutionTemplateLiteral */: var parent = node.parent; switch (parent.kind) { - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 123 /* Parameter */: case 124 /* Property */: - case 192 /* EnumMember */: - case 141 /* PropertyAssignment */: + case 195 /* EnumMember */: + case 143 /* PropertyAssignment */: return parent.initializer === node; - case 161 /* ExpressionStatement */: - case 162 /* IfStatement */: - case 163 /* DoStatement */: - case 164 /* WhileStatement */: - case 169 /* ReturnStatement */: - case 170 /* WithStatement */: - case 171 /* SwitchStatement */: - case 172 /* CaseClause */: - case 175 /* ThrowStatement */: - case 171 /* SwitchStatement */: + case 164 /* ExpressionStatement */: + case 165 /* IfStatement */: + case 166 /* DoStatement */: + case 167 /* WhileStatement */: + case 172 /* ReturnStatement */: + case 173 /* WithStatement */: + case 174 /* SwitchStatement */: + case 175 /* CaseClause */: + case 178 /* ThrowStatement */: + case 174 /* SwitchStatement */: return parent.expression === node; - case 165 /* ForStatement */: + case 168 /* ForStatement */: return parent.initializer === node || parent.condition === node || parent.iterator === node; - case 166 /* ForInStatement */: + case 169 /* ForInStatement */: return parent.variable === node || parent.expression === node; - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return node === parent.operand; + case 159 /* TemplateSpan */: + return node === parent.expression; default: if (isExpression(parent)) { return true; @@ -2657,20 +2678,21 @@ var ts; switch (node.kind) { case 122 /* TypeParameter */: case 123 /* Parameter */: - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 124 /* Property */: - case 141 /* PropertyAssignment */: - case 192 /* EnumMember */: + case 143 /* PropertyAssignment */: + case 144 /* ShorthandPropertyAssignment */: + case 195 /* EnumMember */: case 125 /* Method */: - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 187 /* EnumDeclaration */: - case 188 /* ModuleDeclaration */: - case 190 /* ImportDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 190 /* EnumDeclaration */: + case 191 /* ModuleDeclaration */: + case 193 /* ImportDeclaration */: return true; } return false; @@ -2678,24 +2700,24 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 168 /* BreakStatement */: - case 167 /* ContinueStatement */: - case 180 /* DebuggerStatement */: - case 163 /* DoStatement */: - case 161 /* ExpressionStatement */: - case 160 /* EmptyStatement */: - case 166 /* ForInStatement */: - case 165 /* ForStatement */: - case 162 /* IfStatement */: - case 174 /* LabeledStatement */: - case 169 /* ReturnStatement */: - case 171 /* SwitchStatement */: + case 171 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 183 /* DebuggerStatement */: + case 166 /* DoStatement */: + case 164 /* ExpressionStatement */: + case 163 /* EmptyStatement */: + case 169 /* ForInStatement */: + case 168 /* ForStatement */: + case 165 /* IfStatement */: + case 177 /* LabeledStatement */: + case 172 /* ReturnStatement */: + case 174 /* SwitchStatement */: case 92 /* ThrowKeyword */: - case 176 /* TryStatement */: - case 159 /* VariableStatement */: - case 164 /* WhileStatement */: - case 170 /* WithStatement */: - case 191 /* ExportAssignment */: + case 179 /* TryStatement */: + case 162 /* VariableStatement */: + case 167 /* WhileStatement */: + case 173 /* WithStatement */: + case 194 /* ExportAssignment */: return true; default: return false; @@ -2707,10 +2729,10 @@ var ts; return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 149 /* FunctionExpression */) { + if (isDeclaration(parent) || parent.kind === 152 /* FunctionExpression */) { return parent.name === name; } - if (parent.kind === 178 /* CatchBlock */) { + if (parent.kind === 181 /* CatchBlock */) { return parent.variable === name; } return false; @@ -2718,16 +2740,16 @@ var ts; ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; function getAncestor(node, kind) { switch (kind) { - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: while (node) { switch (node.kind) { - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return node; - case 187 /* EnumDeclaration */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 188 /* ModuleDeclaration */: - case 190 /* ImportDeclaration */: + case 190 /* EnumDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 191 /* ModuleDeclaration */: + case 193 /* ImportDeclaration */: return undefined; default: node = node.parent; @@ -2769,6 +2791,41 @@ var ts; } } ; + function getFileReferenceFromReferencePath(comment, commentRange) { + var simpleReferenceRegEx = /^\/\/\/\s*/gim; + if (simpleReferenceRegEx.exec(comment)) { + if (isNoDefaultLibRegEx.exec(comment)) { + return { + isNoDefaultLib: true + }; + } + else { + var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + if (matchResult) { + var start = commentRange.pos; + var end = commentRange.end; + var fileRef = { + pos: start, + end: end, + filename: matchResult[3] + }; + return { + fileReference: fileRef, + isNoDefaultLib: false + }; + } + else { + return { + diagnostic: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; + } + } + } + return undefined; + } + ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { return 64 /* FirstKeyword */ <= token && token <= 119 /* LastKeyword */; } @@ -2777,6 +2834,15 @@ var ts; return 2 /* FirstTriviaToken */ <= token && token <= 5 /* LastTriviaToken */; } ts.isTrivia = isTrivia; + function isUnterminatedTemplateEnd(node) { + ts.Debug.assert(node.kind === 9 /* NoSubstitutionTemplateLiteral */ || node.kind === 12 /* TemplateTail */); + var sourceText = getSourceFileOfNode(node).text; + if (node.end !== sourceText.length) { + return false; + } + return sourceText.charCodeAt(node.end - 1) !== 96 /* backtick */ || node.text.length === 0; + } + ts.isUnterminatedTemplateEnd = isUnterminatedTemplateEnd; function isModifier(token) { switch (token) { case 106 /* PublicKeyword */: @@ -2881,17 +2947,14 @@ var ts; nodeIsNestedInLabel: nodeIsNestedInLabel }; })(); - function getLineAndCharacterlFromSourcePosition(position) { - if (!lineStarts) { - lineStarts = ts.getLineStarts(sourceText); - } - return ts.getLineAndCharacterOfPosition(lineStarts, position); + function getLineStarts() { + return lineStarts || (lineStarts = ts.computeLineStarts(sourceText)); + } + function getLineAndCharacterFromSourcePosition(position) { + return ts.getLineAndCharacterOfPosition(getLineStarts(), position); } function getPositionFromSourceLineAndCharacter(line, character) { - if (!lineStarts) { - lineStarts = ts.getLineStarts(sourceText); - } - return ts.getPositionFromLineAndCharacter(lineStarts, line, character); + return ts.getPositionFromLineAndCharacter(getLineStarts(), line, character); } function error(message, arg0, arg1, arg2) { var start = scanner.getTokenPos(); @@ -2914,7 +2977,9 @@ var ts; function errorAtPos(start, length, message, arg0, arg1, arg2) { var lastErrorPos = file.syntacticErrors.length ? file.syntacticErrors[file.syntacticErrors.length - 1].start : -1; if (start !== lastErrorPos) { - file.syntacticErrors.push(ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); + var diagnostic = ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); + diagnostic.isParseError = true; + file.syntacticErrors.push(diagnostic); } if (lookAheadMode === 1 /* NoErrorYet */) { lookAheadMode = 2 /* Error */; @@ -3028,14 +3093,14 @@ var ts; return createNode(120 /* Missing */); } function internIdentifier(text) { + text = escapeIdentifier(text); return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); } function createIdentifier(isIdentifier) { identifierCount++; if (isIdentifier) { var node = createNode(63 /* Identifier */); - var text = escapeIdentifier(scanner.getTokenValue()); - node.text = internIdentifier(text); + node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } @@ -3274,7 +3339,7 @@ var ts; return finishNode(node); } function parseTemplateExpression() { - var template = createNode(155 /* TemplateExpression */); + var template = createNode(158 /* TemplateExpression */); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 10 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; @@ -3287,7 +3352,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(156 /* TemplateSpan */); + var span = createNode(159 /* TemplateSpan */); span.expression = parseExpression(false); var literal; if (token === 14 /* CloseBraceToken */) { @@ -3335,7 +3400,7 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(133 /* TypeQuery */); + var node = createNode(135 /* TypeQuery */); parseExpected(95 /* TypeOfKeyword */); node.exprName = parseEntityName(true); return finishNode(node); @@ -3566,7 +3631,7 @@ var ts; } } function parseTypeLiteral() { - var node = createNode(134 /* TypeLiteral */); + var node = createNode(136 /* TypeLiteral */); if (parseExpected(13 /* OpenBraceToken */)) { node.members = parseList(5 /* TypeMembers */, false, parseTypeMember); parseExpected(14 /* CloseBraceToken */); @@ -3577,7 +3642,7 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(136 /* TupleType */); + var node = createNode(138 /* TupleType */); var startTokenPos = scanner.getTokenPos(); var startErrorCount = file.syntacticErrors.length; node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 17 /* OpenBracketToken */, 18 /* CloseBracketToken */); @@ -3587,22 +3652,20 @@ var ts; return finishNode(node); } function parseParenType() { - var node = createNode(138 /* ParenType */); + var node = createNode(140 /* ParenType */); parseExpected(15 /* OpenParenToken */); node.type = parseType(); parseExpected(16 /* CloseParenToken */); return finishNode(node); } - function parseFunctionType(signatureKind) { - var node = createNode(134 /* TypeLiteral */); - var member = createNode(signatureKind); - var sig = parseSignature(signatureKind, 31 /* EqualsGreaterThanToken */, true); + function parseFunctionType(typeKind) { + var member = createNode(typeKind); + var sig = parseSignature(typeKind === 133 /* FunctionType */ ? 129 /* CallSignature */ : 130 /* ConstructSignature */, 31 /* EqualsGreaterThanToken */, true); member.typeParameters = sig.typeParameters; member.parameters = sig.parameters; member.type = sig.type; finishNode(member); - node.members = createNodeArray(member); - return finishNode(node); + return member; } function parseKeywordAndNoDot() { var node = parseTokenNode(); @@ -3659,7 +3722,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(17 /* OpenBracketToken */)) { parseExpected(18 /* CloseBracketToken */); - var node = createNode(135 /* ArrayType */, type.pos); + var node = createNode(137 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -3674,7 +3737,7 @@ var ts; types.push(parsePrimaryType()); } types.end = getNodeEnd(); - var node = createNode(137 /* UnionType */, type.pos); + var node = createNode(139 /* UnionType */, type.pos); node.types = types; type = finishNode(node); } @@ -3703,10 +3766,10 @@ var ts; } function parseType() { if (isStartOfFunctionType()) { - return parseFunctionType(129 /* CallSignature */); + return parseFunctionType(133 /* FunctionType */); } if (token === 86 /* NewKeyword */) { - return parseFunctionType(130 /* ConstructSignature */); + return parseFunctionType(134 /* ConstructorType */); } return parseUnionType(); } @@ -3788,22 +3851,22 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 142 /* PropertyAccess */: - case 143 /* IndexedAccess */: - case 145 /* NewExpression */: - case 144 /* CallExpression */: - case 146 /* TaggedTemplateExpression */: - case 139 /* ArrayLiteral */: - case 148 /* ParenExpression */: - case 140 /* ObjectLiteral */: - case 149 /* FunctionExpression */: + case 145 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 148 /* NewExpression */: + case 147 /* CallExpression */: + case 149 /* TaggedTemplateExpression */: + case 141 /* ArrayLiteral */: + case 151 /* ParenExpression */: + case 142 /* ObjectLiteral */: + case 152 /* FunctionExpression */: case 63 /* Identifier */: case 120 /* Missing */: case 8 /* RegularExpressionLiteral */: case 6 /* NumericLiteral */: case 7 /* StringLiteral */: case 9 /* NoSubstitutionTemplateLiteral */: - case 155 /* TemplateExpression */: + case 158 /* TemplateExpression */: case 78 /* FalseKeyword */: case 87 /* NullKeyword */: case 91 /* ThisKeyword */: @@ -3839,7 +3902,7 @@ var ts; return parseArrowExpressionTail(pos, sig, false); } else { - return makeFunctionExpression(150 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); + return makeFunctionExpression(153 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); } } var sig = tryParseSignatureIfArrowOrBraceFollows(); @@ -3913,7 +3976,7 @@ var ts; else { body = parseAssignmentExpression(noIn); } - return makeFunctionExpression(150 /* ArrowFunction */, pos, undefined, sig, body); + return makeFunctionExpression(153 /* ArrowFunction */, pos, undefined, sig, body); } function isAssignmentOperator() { return token >= 51 /* FirstAssignment */ && token <= 62 /* LastAssignment */; @@ -3921,7 +3984,7 @@ var ts; function parseConditionalExpression(noIn) { var expr = parseBinaryExpression(noIn); while (parseOptional(49 /* QuestionToken */)) { - var node = createNode(154 /* ConditionalExpression */, expr.pos); + var node = createNode(157 /* ConditionalExpression */, expr.pos); node.condition = expr; node.whenTrue = parseAssignmentExpression(false); parseExpected(50 /* ColonToken */); @@ -3985,7 +4048,7 @@ var ts; return undefined; } function makeBinaryExpression(left, operator, right) { - var node = createNode(153 /* BinaryExpression */, left.pos); + var node = createNode(156 /* BinaryExpression */, left.pos); node.left = left; node.operator = operator; node.right = right; @@ -4014,7 +4077,7 @@ var ts; grammarErrorOnNode(operand, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); } } - return makeUnaryExpression(151 /* PrefixOperator */, pos, operator, operand); + return makeUnaryExpression(154 /* PrefixOperator */, pos, operator, operand); case 23 /* LessThanToken */: return parseTypeAssertion(); } @@ -4031,12 +4094,12 @@ var ts; } var operator = token; nextToken(); - expr = makeUnaryExpression(152 /* PostfixOperator */, expr.pos, operator, expr); + expr = makeUnaryExpression(155 /* PostfixOperator */, expr.pos, operator, expr); } return expr; } function parseTypeAssertion() { - var node = createNode(147 /* TypeAssertion */); + var node = createNode(150 /* TypeAssertion */); parseExpected(23 /* LessThanToken */); node.type = parseType(); parseExpected(24 /* GreaterThanToken */); @@ -4053,7 +4116,7 @@ var ts; while (true) { var dotOrBracketStart = scanner.getTokenPos(); if (parseOptional(19 /* DotToken */)) { - var propertyAccess = createNode(142 /* PropertyAccess */, expr.pos); + var propertyAccess = createNode(145 /* PropertyAccess */, expr.pos); if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(function () { return scanner.isReservedWord(); })) { grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, ts.Diagnostics.Identifier_expected); var id = createMissingNode(); @@ -4067,7 +4130,7 @@ var ts; continue; } if (parseOptional(17 /* OpenBracketToken */)) { - var indexedAccess = createNode(143 /* IndexedAccess */, expr.pos); + var indexedAccess = createNode(146 /* IndexedAccess */, expr.pos); indexedAccess.object = expr; if (inNewExpression && parseOptional(18 /* CloseBracketToken */)) { indexedAccess.index = createMissingNode(); @@ -4085,7 +4148,7 @@ var ts; continue; } if ((token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) && !inNewExpression) { - var callExpr = createNode(144 /* CallExpression */, expr.pos); + var callExpr = createNode(147 /* CallExpression */, expr.pos); callExpr.func = expr; if (token === 23 /* LessThanToken */) { if (!(callExpr.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) @@ -4100,7 +4163,7 @@ var ts; continue; } if (token === 9 /* NoSubstitutionTemplateLiteral */ || token === 10 /* TemplateHead */) { - var tagExpression = createNode(146 /* TaggedTemplateExpression */, expr.pos); + var tagExpression = createNode(149 /* TaggedTemplateExpression */, expr.pos); tagExpression.tag = expr; tagExpression.template = token === 9 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); expr = finishNode(tagExpression); @@ -4174,7 +4237,7 @@ var ts; return createMissingNode(); } function parseParenExpression() { - var node = createNode(148 /* ParenExpression */); + var node = createNode(151 /* ParenExpression */); parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); parseExpected(16 /* CloseParenToken */); @@ -4187,7 +4250,7 @@ var ts; var errorLength = scanner.getTextPos() - errorStart; grammarErrorAtPos(errorStart, errorLength, omittedExpressionDiagnostic); } - return createNode(157 /* OmittedExpression */); + return createNode(160 /* OmittedExpression */); } return parseAssignmentExpression(); } @@ -4198,7 +4261,7 @@ var ts; return parseAssignmentExpressionOrOmittedExpression(ts.Diagnostics.Argument_expression_expected); } function parseArrayLiteral() { - var node = createNode(139 /* ArrayLiteral */); + var node = createNode(141 /* ArrayLiteral */); parseExpected(17 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 256 /* MultiLine */; @@ -4207,14 +4270,30 @@ var ts; return finishNode(node); } function parsePropertyAssignment() { - var node = createNode(141 /* PropertyAssignment */); - node.name = parsePropertyName(); + var nodePos = scanner.getStartPos(); + var nameToken = token; + var propertyName = parsePropertyName(); + var node; if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + node = createNode(143 /* PropertyAssignment */, nodePos); + node.name = propertyName; var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); var body = parseBody(false); - node.initializer = makeFunctionExpression(149 /* FunctionExpression */, node.pos, undefined, sig, body); + node.initializer = makeFunctionExpression(152 /* FunctionExpression */, node.pos, undefined, sig, body); + return finishNode(node); + } + if (token === 49 /* QuestionToken */) { + var questionStart = scanner.getTokenPos(); + grammarErrorAtPos(questionStart, scanner.getStartPos() - questionStart, ts.Diagnostics.A_object_member_cannot_be_declared_optional); + nextToken(); + } + if (token !== 50 /* ColonToken */ && nameToken === 63 /* Identifier */) { + node = createNode(144 /* ShorthandPropertyAssignment */, nodePos); + node.name = propertyName; } else { + node = createNode(143 /* PropertyAssignment */, nodePos); + node.name = propertyName; parseExpected(50 /* ColonToken */); node.initializer = parseAssignmentExpression(false); } @@ -4230,7 +4309,7 @@ var ts; return parsePropertyAssignment(); } function parseObjectLiteral() { - var node = createNode(140 /* ObjectLiteral */); + var node = createNode(142 /* ObjectLiteral */); parseExpected(13 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 256 /* MultiLine */; @@ -4243,11 +4322,15 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; ts.forEach(node.properties, function (p) { - if (p.kind === 157 /* OmittedExpression */) { + if (p.kind === 160 /* OmittedExpression */) { return; } + var name = p.name; var currentKind; - if (p.kind === 141 /* PropertyAssignment */) { + if (p.kind === 143 /* PropertyAssignment */) { + currentKind = Property; + } + else if (p.kind === 144 /* ShorthandPropertyAssignment */) { currentKind = Property; } else if (p.kind === 127 /* GetAccessor */) { @@ -4259,26 +4342,26 @@ var ts; else { ts.Debug.fail("Unexpected syntax kind:" + p.kind); } - if (!ts.hasProperty(seen, p.name.text)) { - seen[p.name.text] = currentKind; + if (!ts.hasProperty(seen, name.text)) { + seen[name.text] = currentKind; } else { - var existingKind = seen[p.name.text]; + var existingKind = seen[name.text]; if (currentKind === Property && existingKind === Property) { if (isInStrictMode) { - grammarErrorOnNode(p.name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); } } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[p.name.text] = currentKind | existingKind; + seen[name.text] = currentKind | existingKind; } else { - grammarErrorOnNode(p.name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - grammarErrorOnNode(p.name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } }); @@ -4293,7 +4376,7 @@ var ts; if (name && isInStrictMode && isEvalOrArgumentsIdentifier(name)) { reportInvalidUseInStrictMode(name); } - return makeFunctionExpression(149 /* FunctionExpression */, pos, name, sig, body); + return makeFunctionExpression(152 /* FunctionExpression */, pos, name, sig, body); } function makeFunctionExpression(kind, pos, name, sig, body) { var node = createNode(kind, pos); @@ -4305,7 +4388,7 @@ var ts; return finishNode(node); } function parseNewExpression() { - var node = createNode(145 /* NewExpression */); + var node = createNode(148 /* NewExpression */); parseExpected(86 /* NewKeyword */); node.func = parseCallAndAccess(parsePrimaryExpression(), true); if (parseOptional(15 /* OpenParenToken */) || token === 23 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { @@ -4318,7 +4401,7 @@ var ts; return parseStatement(true); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode) { - var node = createNode(158 /* Block */); + var node = createNode(161 /* Block */); if (parseExpected(13 /* OpenBraceToken */) || ignoreMissingOpenBrace) { node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatementAllowingLetDeclaration); parseExpected(14 /* CloseBraceToken */); @@ -4341,7 +4424,7 @@ var ts; } labelledStatementInfo.pushFunctionBoundary(); var block = parseBlock(ignoreMissingOpenBrace, true); - block.kind = 183 /* FunctionBlock */; + block.kind = 186 /* FunctionBlock */; labelledStatementInfo.pop(); inFunctionBody = saveInFunctionBody; inSwitchStatement = saveInSwitchStatement; @@ -4349,12 +4432,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(160 /* EmptyStatement */); + var node = createNode(163 /* EmptyStatement */); parseExpected(21 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(162 /* IfStatement */); + var node = createNode(165 /* IfStatement */); parseExpected(82 /* IfKeyword */); parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); @@ -4364,7 +4447,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(163 /* DoStatement */); + var node = createNode(166 /* DoStatement */); parseExpected(73 /* DoKeyword */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; @@ -4378,7 +4461,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(164 /* WhileStatement */); + var node = createNode(167 /* WhileStatement */); parseExpected(98 /* WhileKeyword */); parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); @@ -4424,7 +4507,7 @@ var ts; } var forOrForInStatement; if (parseOptional(84 /* InKeyword */)) { - var forInStatement = createNode(166 /* ForInStatement */, pos); + var forInStatement = createNode(169 /* ForInStatement */, pos); if (declarations) { if (declarations.length > 1) { error(ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); @@ -4439,7 +4522,7 @@ var ts; forOrForInStatement = forInStatement; } else { - var forStatement = createNode(165 /* ForStatement */, pos); + var forStatement = createNode(168 /* ForStatement */, pos); if (declarations) forStatement.declarations = declarations; if (varOrInit) @@ -4464,7 +4547,7 @@ var ts; function parseBreakOrContinueStatement(kind) { var node = createNode(kind); var errorCountBeforeStatement = file.syntacticErrors.length; - parseExpected(kind === 168 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */); + parseExpected(kind === 171 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */); if (!canParseSemicolon()) node.label = parseIdentifier(); parseSemicolon(); @@ -4480,7 +4563,7 @@ var ts; return node; } function checkBareBreakOrContinueStatement(node) { - if (node.kind === 168 /* BreakStatement */) { + if (node.kind === 171 /* BreakStatement */) { if (inIterationStatement === 1 /* Nested */ || inSwitchStatement === 1 /* Nested */) { return; } @@ -4489,7 +4572,7 @@ var ts; return; } } - else if (node.kind === 167 /* ContinueStatement */) { + else if (node.kind === 170 /* ContinueStatement */) { if (inIterationStatement === 1 /* Nested */) { return; } @@ -4505,7 +4588,7 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } function checkBreakOrContinueStatementWithLabel(node) { - var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 167 /* ContinueStatement */, false); + var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 170 /* ContinueStatement */, false); if (nodeIsNestedInLabel === 1 /* Nested */) { return; } @@ -4513,10 +4596,10 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); return; } - if (node.kind === 167 /* ContinueStatement */) { + if (node.kind === 170 /* ContinueStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } - else if (node.kind === 168 /* BreakStatement */) { + else if (node.kind === 171 /* BreakStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement); } else { @@ -4524,7 +4607,7 @@ var ts; } } function parseReturnStatement() { - var node = createNode(169 /* ReturnStatement */); + var node = createNode(172 /* ReturnStatement */); var errorCountBeforeReturnStatement = file.syntacticErrors.length; var returnTokenStart = scanner.getTokenPos(); var returnTokenLength = scanner.getTextPos() - returnTokenStart; @@ -4538,7 +4621,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(170 /* WithStatement */); + var node = createNode(173 /* WithStatement */); var startPos = scanner.getTokenPos(); parseExpected(99 /* WithKeyword */); var endPos = scanner.getStartPos(); @@ -4553,7 +4636,7 @@ var ts; return node; } function parseCaseClause() { - var node = createNode(172 /* CaseClause */); + var node = createNode(175 /* CaseClause */); parseExpected(65 /* CaseKeyword */); node.expression = parseExpression(); parseExpected(50 /* ColonToken */); @@ -4561,7 +4644,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(173 /* DefaultClause */); + var node = createNode(176 /* DefaultClause */); parseExpected(71 /* DefaultKeyword */); parseExpected(50 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatementAllowingLetDeclaration); @@ -4571,7 +4654,7 @@ var ts; return token === 65 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(171 /* SwitchStatement */); + var node = createNode(174 /* SwitchStatement */); parseExpected(90 /* SwitchKeyword */); parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); @@ -4582,7 +4665,7 @@ var ts; node.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); inSwitchStatement = saveInSwitchStatement; parseExpected(14 /* CloseBraceToken */); - var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 173 /* DefaultClause */; }); + var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 176 /* DefaultClause */; }); for (var i = 1, n = defaultClauses.length; i < n; i++) { var clause = defaultClauses[i]; var start = ts.skipTrivia(file.text, clause.pos); @@ -4592,7 +4675,7 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(175 /* ThrowStatement */); + var node = createNode(178 /* ThrowStatement */); parseExpected(92 /* ThrowKeyword */); if (scanner.hasPrecedingLineBreak()) { error(ts.Diagnostics.Line_break_not_permitted_here); @@ -4602,13 +4685,13 @@ var ts; return finishNode(node); } function parseTryStatement() { - var node = createNode(176 /* TryStatement */); - node.tryBlock = parseTokenAndBlock(94 /* TryKeyword */, 177 /* TryBlock */); + var node = createNode(179 /* TryStatement */); + node.tryBlock = parseTokenAndBlock(94 /* TryKeyword */, 180 /* TryBlock */); if (token === 66 /* CatchKeyword */) { node.catchBlock = parseCatchBlock(); } if (token === 79 /* FinallyKeyword */) { - node.finallyBlock = parseTokenAndBlock(79 /* FinallyKeyword */, 179 /* FinallyBlock */); + node.finallyBlock = parseTokenAndBlock(79 /* FinallyKeyword */, 182 /* FinallyBlock */); } if (!(node.catchBlock || node.finallyBlock)) { error(ts.Diagnostics.catch_or_finally_expected); @@ -4633,7 +4716,7 @@ var ts; var typeAnnotation = parseTypeAnnotation(); parseExpected(16 /* CloseParenToken */); var result = parseBlock(false, false); - result.kind = 178 /* CatchBlock */; + result.kind = 181 /* CatchBlock */; result.pos = pos; result.variable = variable; if (typeAnnotation) { @@ -4645,7 +4728,7 @@ var ts; return result; } function parseDebuggerStatement() { - var node = createNode(180 /* DebuggerStatement */); + var node = createNode(183 /* DebuggerStatement */); parseExpected(70 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -4663,7 +4746,7 @@ var ts; return isIdentifier() && lookAhead(function () { return nextToken() === 50 /* ColonToken */; }); } function parseLabeledStatement(allowLetAndConstDeclarations) { - var node = createNode(174 /* LabeledStatement */); + var node = createNode(177 /* LabeledStatement */); node.label = parseIdentifier(); parseExpected(50 /* ColonToken */); if (labelledStatementInfo.nodeIsNestedInLabel(node.label, false, true)) { @@ -4674,7 +4757,7 @@ var ts; return finishNode(node); } function parseExpressionStatement() { - var node = createNode(161 /* ExpressionStatement */); + var node = createNode(164 /* ExpressionStatement */); node.expression = parseExpression(); parseSemicolon(); return finishNode(node); @@ -4745,9 +4828,9 @@ var ts; case 80 /* ForKeyword */: return parseForOrForInStatement(); case 69 /* ContinueKeyword */: - return parseBreakOrContinueStatement(167 /* ContinueStatement */); + return parseBreakOrContinueStatement(170 /* ContinueStatement */); case 64 /* BreakKeyword */: - return parseBreakOrContinueStatement(168 /* BreakStatement */); + return parseBreakOrContinueStatement(171 /* BreakStatement */); case 88 /* ReturnKeyword */: return parseReturnStatement(); case 99 /* WithKeyword */: @@ -4787,7 +4870,7 @@ var ts; error(ts.Diagnostics.Block_or_expected); } function parseVariableDeclaration(flags, noIn) { - var node = createNode(181 /* VariableDeclaration */); + var node = createNode(184 /* VariableDeclaration */); node.flags = flags; var errorCountBeforeVariableDeclaration = file.syntacticErrors.length; node.name = parseIdentifier(); @@ -4810,7 +4893,7 @@ var ts; return parseDelimitedList(9 /* VariableDeclarations */, function () { return parseVariableDeclaration(flags, noIn); }, false); } function parseVariableStatement(allowLetAndConstDeclarations, pos, flags) { - var node = createNode(159 /* VariableStatement */, pos); + var node = createNode(162 /* VariableStatement */, pos); if (flags) node.flags = flags; var errorCountBeforeVarStatement = file.syntacticErrors.length; @@ -4849,7 +4932,7 @@ var ts; return node; } function parseFunctionDeclaration(pos, flags) { - var node = createNode(182 /* FunctionDeclaration */, pos); + var node = createNode(185 /* FunctionDeclaration */, pos); if (flags) node.flags = flags; parseExpected(81 /* FunctionKeyword */); @@ -4859,7 +4942,7 @@ var ts; node.parameters = sig.parameters; node.type = sig.type; node.body = parseAndCheckFunctionBody(false); - if (isInStrictMode && isEvalOrArgumentsIdentifier(node.name)) { + if (isInStrictMode && isEvalOrArgumentsIdentifier(node.name) && node.name.kind === 63 /* Identifier */) { reportInvalidUseInStrictMode(node.name); } return finishNode(node); @@ -5160,7 +5243,7 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(pos, flags) { - var node = createNode(184 /* ClassDeclaration */, pos); + var node = createNode(187 /* ClassDeclaration */, pos); node.flags = flags; var errorCountBeforeClassDeclaration = file.syntacticErrors.length; parseExpected(67 /* ClassKeyword */); @@ -5187,7 +5270,7 @@ var ts; return finishNode(node); } function parseInterfaceDeclaration(pos, flags) { - var node = createNode(185 /* InterfaceDeclaration */, pos); + var node = createNode(188 /* InterfaceDeclaration */, pos); node.flags = flags; var errorCountBeforeInterfaceDeclaration = file.syntacticErrors.length; parseExpected(101 /* InterfaceKeyword */); @@ -5207,7 +5290,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(pos, flags) { - var node = createNode(186 /* TypeAliasDeclaration */, pos); + var node = createNode(189 /* TypeAliasDeclaration */, pos); node.flags = flags; parseExpected(119 /* TypeKeyword */); node.name = parseIdentifier(); @@ -5222,7 +5305,7 @@ var ts; function isInteger(literalExpression) { return /^[0-9]+([eE]\+?[0-9]+)?$/.test(literalExpression.text); } - if (expression.kind === 151 /* PrefixOperator */) { + if (expression.kind === 154 /* PrefixOperator */) { var unaryExpression = expression; if (unaryExpression.operator === 32 /* PlusToken */ || unaryExpression.operator === 33 /* MinusToken */) { expression = unaryExpression.operand; @@ -5235,7 +5318,7 @@ var ts; } var inConstantEnumMemberSection = true; function parseAndCheckEnumMember() { - var node = createNode(192 /* EnumMember */); + var node = createNode(195 /* EnumMember */); var errorCountBeforeEnumMember = file.syntacticErrors.length; node.name = parsePropertyName(); node.initializer = parseInitializer(false); @@ -5254,7 +5337,7 @@ var ts; } return finishNode(node); } - var node = createNode(187 /* EnumDeclaration */, pos); + var node = createNode(190 /* EnumDeclaration */, pos); node.flags = flags; if (enumIsConst) { parseExpected(68 /* ConstKeyword */); @@ -5271,7 +5354,7 @@ var ts; return finishNode(node); } function parseModuleBody() { - var node = createNode(189 /* ModuleBlock */); + var node = createNode(192 /* ModuleBlock */); if (parseExpected(13 /* OpenBraceToken */)) { node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); parseExpected(14 /* CloseBraceToken */); @@ -5282,7 +5365,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(pos, flags) { - var node = createNode(188 /* ModuleDeclaration */, pos); + var node = createNode(191 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseIdentifier(); if (parseOptional(19 /* DotToken */)) { @@ -5291,10 +5374,10 @@ var ts; else { node.body = parseModuleBody(); ts.forEach(node.body.statements, function (s) { - if (s.kind === 191 /* ExportAssignment */) { + if (s.kind === 194 /* ExportAssignment */) { grammarErrorOnNode(s, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } - else if (s.kind === 190 /* ImportDeclaration */ && s.externalModuleName) { + else if (s.kind === 193 /* ImportDeclaration */ && s.externalModuleName) { grammarErrorOnNode(s, ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); } }); @@ -5302,7 +5385,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(pos, flags) { - var node = createNode(188 /* ModuleDeclaration */, pos); + var node = createNode(191 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseStringLiteral(); if (!inAmbientContext) { @@ -5322,7 +5405,7 @@ var ts; return token === 7 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(pos, flags) : parseInternalModuleTail(pos, flags); } function parseImportDeclaration(pos, flags) { - var node = createNode(190 /* ImportDeclaration */, pos); + var node = createNode(193 /* ImportDeclaration */, pos); node.flags = flags; parseExpected(83 /* ImportKeyword */); node.name = parseIdentifier(); @@ -5339,7 +5422,7 @@ var ts; return finishNode(node); } function parseExportAssignmentTail(pos) { - var node = createNode(191 /* ExportAssignment */, pos); + var node = createNode(194 /* ExportAssignment */, pos); node.exportName = parseIdentifier(); parseSemicolon(); return finishNode(node); @@ -5464,27 +5547,16 @@ var ts; for (var i = 0; i < commentRanges.length; i++) { var range = commentRanges[i]; var comment = sourceText.substring(range.pos, range.end); - var simpleReferenceRegEx = /^\/\/\/\s*/gim; - if (isNoDefaultLibRegEx.exec(comment)) { - file.hasNoDefaultLib = true; + var referencePathMatchResult = getFileReferenceFromReferencePath(comment, range); + if (referencePathMatchResult) { + var fileReference = referencePathMatchResult.fileReference; + file.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var diagnostic = referencePathMatchResult.diagnostic; + if (fileReference) { + referencedFiles.push(fileReference); } - else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - var start = range.pos; - var end = range.end; - var length = end - start; - if (!matchResult) { - errorAtPos(start, length, ts.Diagnostics.Invalid_reference_directive_syntax); - } - else { - referencedFiles.push({ - pos: start, - end: end, - filename: matchResult[3] - }); - } + if (diagnostic) { + errorAtPos(range.pos, range.end - range.pos, diagnostic); } } else { @@ -5502,7 +5574,7 @@ var ts; }; } function getExternalModuleIndicator() { - return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 190 /* ImportDeclaration */ && node.externalModuleName || node.kind === 191 /* ExportAssignment */ ? node : undefined; }); + return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 193 /* ImportDeclaration */ && node.externalModuleName || node.kind === 194 /* ExportAssignment */ ? node : undefined; }); } scanner = ts.createScanner(languageVersion, true, sourceText, scanError, onComment); var rootNodeFlags = 0; @@ -5510,11 +5582,12 @@ var ts; rootNodeFlags = 1024 /* DeclarationFile */; inAmbientContext = true; } - file = createRootNode(193 /* SourceFile */, 0, sourceText.length, rootNodeFlags); + file = createRootNode(196 /* SourceFile */, 0, sourceText.length, rootNodeFlags); file.filename = ts.normalizePath(filename); file.text = sourceText; - file.getLineAndCharacterFromPosition = getLineAndCharacterlFromSourcePosition; + file.getLineAndCharacterFromPosition = getLineAndCharacterFromSourcePosition; file.getPositionFromLineAndCharacter = getPositionFromSourceLineAndCharacter; + file.getLineStarts = getLineStarts; file.syntacticErrors = []; file.semanticErrors = []; var referenceComments = processReferenceComments(); @@ -5643,7 +5716,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 190 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 193 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5661,9 +5734,9 @@ var ts; } } } - else if (node.kind === 188 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || isDeclarationFile(file))) { + else if (node.kind === 191 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || isDeclarationFile(file))) { forEachChild(node.body, function (node) { - if (node.kind === 190 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 193 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5736,16 +5809,16 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 185 /* InterfaceDeclaration */) { + if (node.kind === 188 /* InterfaceDeclaration */) { return 0 /* NonInstantiated */; } - else if (node.kind === 187 /* EnumDeclaration */ && ts.isConstEnumDeclaration(node)) { + else if (node.kind === 190 /* EnumDeclaration */ && ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if (node.kind === 190 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { + else if (node.kind === 193 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 189 /* ModuleBlock */) { + else if (node.kind === 192 /* ModuleBlock */) { var state = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -5761,7 +5834,7 @@ var ts; }); return state; } - else if (node.kind === 188 /* ModuleDeclaration */) { + else if (node.kind === 191 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -5801,20 +5874,26 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 188 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { + if (node.kind === 191 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { return '"' + node.name.text + '"'; } return node.name.text; } switch (node.kind) { - case 126 /* Constructor */: return "__constructor"; - case 129 /* CallSignature */: return "__call"; - case 130 /* ConstructSignature */: return "__new"; - case 131 /* IndexSignature */: return "__index"; + case 134 /* ConstructorType */: + case 126 /* Constructor */: + return "__constructor"; + case 133 /* FunctionType */: + case 129 /* CallSignature */: + return "__call"; + case 130 /* ConstructSignature */: + return "__new"; + case 131 /* IndexSignature */: + return "__index"; } } function getDisplayName(node) { - return node.name ? ts.identifierToString(node.name) : getDeclarationName(node); + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); } function declareSymbol(symbols, parent, node, includes, excludes) { var name = getDeclarationName(node); @@ -5837,7 +5916,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 184 /* ClassDeclaration */ && symbol.exports) { + if (node.kind === 187 /* ClassDeclaration */ && symbol.exports) { var prototypeSymbol = createSymbol(4 /* Property */ | 536870912 /* Prototype */, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -5869,7 +5948,7 @@ var ts; if (symbolKind & 1536 /* Namespace */) { exportKind |= 16777216 /* ExportNamespace */; } - if (node.flags & 1 /* Export */ || (node.kind !== 190 /* ImportDeclaration */ && isAmbientContext(container))) { + if (node.flags & 1 /* Export */ || (node.kind !== 193 /* ImportDeclaration */ && isAmbientContext(container))) { if (exportKind) { var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -5910,14 +5989,16 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } + case 133 /* FunctionType */: + case 134 /* ConstructorType */: case 129 /* CallSignature */: case 130 /* ConstructSignature */: case 131 /* IndexSignature */: @@ -5925,22 +6006,22 @@ var ts; case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: if (node.flags & 128 /* Static */) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 134 /* TypeLiteral */: - case 140 /* ObjectLiteral */: - case 185 /* InterfaceDeclaration */: + case 136 /* TypeLiteral */: + case 142 /* ObjectLiteral */: + case 188 /* InterfaceDeclaration */: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -5974,6 +6055,16 @@ var ts; } } } + function bindFunctionOrConstructorType(node) { + var symbolKind = node.kind === 133 /* FunctionType */ ? 131072 /* CallSignature */ : 262144 /* ConstructSignature */; + var symbol = createSymbol(symbolKind, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, symbolKind); + bindChildren(node, symbolKind, false); + var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); + typeLiteralSymbol.members = {}; + typeLiteralSymbol.members[node.kind === 133 /* FunctionType */ ? "__call" : "__new"] = symbol; + } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { var symbol = createSymbol(symbolKind, name); addDeclarationToSymbol(symbol, node, symbolKind); @@ -5991,10 +6082,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); break; - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); break; @@ -6016,7 +6107,7 @@ var ts; case 123 /* Parameter */: bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false); break; - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: if (node.flags & 6144 /* BlockScoped */) { bindBlockScopedVariableDeclaration(node); } @@ -6025,25 +6116,26 @@ var ts; } break; case 124 /* Property */: - case 141 /* PropertyAssignment */: + case 143 /* PropertyAssignment */: + case 144 /* ShorthandPropertyAssignment */: bindDeclaration(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); break; - case 192 /* EnumMember */: + case 195 /* EnumMember */: bindDeclaration(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); break; case 129 /* CallSignature */: bindDeclaration(node, 131072 /* CallSignature */, 0, false); break; - case 125 /* Method */: - bindDeclaration(node, 8192 /* Method */, 99263 /* MethodExcludes */, true); - break; case 130 /* ConstructSignature */: bindDeclaration(node, 262144 /* ConstructSignature */, 0, true); break; + case 125 /* Method */: + bindDeclaration(node, 8192 /* Method */, 99263 /* MethodExcludes */, true); + break; case 131 /* IndexSignature */: bindDeclaration(node, 524288 /* IndexSignature */, 0, false); break; - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: bindDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */, true); break; case 126 /* Constructor */: @@ -6055,29 +6147,33 @@ var ts; case 128 /* SetAccessor */: bindDeclaration(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); break; - case 134 /* TypeLiteral */: + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + bindFunctionOrConstructorType(node); + break; + case 136 /* TypeLiteral */: bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type", false); break; - case 140 /* ObjectLiteral */: + case 142 /* ObjectLiteral */: bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object", false); break; - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: bindAnonymousDeclaration(node, 16 /* Function */, "__function", true); break; - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: bindCatchVariableDeclaration(node); break; - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: bindDeclaration(node, 32 /* Class */, 3258879 /* ClassExcludes */, false); break; - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: bindDeclaration(node, 64 /* Interface */, 3152288 /* InterfaceExcludes */, false); break; - case 186 /* TypeAliasDeclaration */: + case 189 /* TypeAliasDeclaration */: bindDeclaration(node, 2097152 /* TypeAlias */, 3152352 /* TypeAliasExcludes */, false); break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: if (ts.isConstEnumDeclaration(node)) { bindDeclaration(node, 128 /* ConstEnum */, 3259263 /* ConstEnumExcludes */, false); } @@ -6085,24 +6181,24 @@ var ts; bindDeclaration(node, 256 /* RegularEnum */, 3258623 /* RegularEnumExcludes */, false); } break; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: bindModuleDeclaration(node); break; - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: bindDeclaration(node, 33554432 /* Import */, 33554432 /* ImportExcludes */, false); break; - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512 /* ValueModule */, '"' + ts.removeFileExtension(node.filename) + '"', true); break; } - case 158 /* Block */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 171 /* SwitchStatement */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 174 /* SwitchStatement */: bindChildren(node, 0, true); break; default: @@ -6219,7 +6315,7 @@ var ts; function writeLiteral(s) { if (s && s.length) { write(s); - var lineStartsOfS = ts.getLineStarts(s); + var lineStartsOfS = ts.computeLineStarts(s); if (lineStartsOfS.length > 1) { lineCount = lineCount + lineStartsOfS.length - 1; linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1]; @@ -6505,7 +6601,7 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 182 /* FunctionDeclaration */ || node.kind === 149 /* FunctionExpression */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */ || node.kind === 188 /* ModuleDeclaration */ || node.kind === 184 /* ClassDeclaration */ || node.kind === 187 /* EnumDeclaration */) { + else if (node.kind === 185 /* FunctionDeclaration */ || node.kind === 152 /* FunctionExpression */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */ || node.kind === 191 /* ModuleDeclaration */ || node.kind === 187 /* ClassDeclaration */ || node.kind === 190 /* EnumDeclaration */) { if (node.name) { scopeName = node.name.text; } @@ -6587,7 +6683,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 193 /* SourceFile */) { + if (node.kind != 196 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -6696,14 +6792,14 @@ var ts; ts.forEachChild(node, emit); return; } - ts.Debug.assert(node.parent.kind !== 146 /* TaggedTemplateExpression */); - var templateNeedsParens = ts.isExpression(node.parent) && node.parent.kind !== 148 /* ParenExpression */ && comparePrecedenceToBinaryPlus(node.parent) !== -1 /* LessThan */; + ts.Debug.assert(node.parent.kind !== 149 /* TaggedTemplateExpression */); + var templateNeedsParens = ts.isExpression(node.parent) && node.parent.kind !== 151 /* ParenExpression */ && comparePrecedenceToBinaryPlus(node.parent) !== -1 /* LessThan */; if (templateNeedsParens) { write("("); } emitLiteral(node.head); ts.forEach(node.templateSpans, function (templateSpan) { - var needsParens = templateSpan.expression.kind !== 148 /* ParenExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; + var needsParens = templateSpan.expression.kind !== 151 /* ParenExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; write(" + "); if (needsParens) { write("("); @@ -6723,7 +6819,7 @@ var ts; function comparePrecedenceToBinaryPlus(expression) { ts.Debug.assert(compilerOptions.target <= 1 /* ES5 */); switch (expression.kind) { - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: switch (expression.operator) { case 34 /* AsteriskToken */: case 35 /* SlashToken */: @@ -6734,7 +6830,7 @@ var ts; default: return -1 /* LessThan */; } - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -6745,7 +6841,7 @@ var ts; emit(span.expression); emit(span.literal); } - function emitQuotedIdentifier(node) { + function emitExpressionForPropertyName(node) { if (node.kind === 7 /* StringLiteral */) { emitLiteral(node); } @@ -6760,45 +6856,52 @@ var ts; write("\""); } } - function isNonExpressionIdentifier(node) { + function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { case 123 /* Parameter */: - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 124 /* Property */: - case 141 /* PropertyAssignment */: - case 192 /* EnumMember */: + case 143 /* PropertyAssignment */: + case 144 /* ShorthandPropertyAssignment */: + case 195 /* EnumMember */: case 125 /* Method */: - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 149 /* FunctionExpression */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 187 /* EnumDeclaration */: - case 188 /* ModuleDeclaration */: - case 190 /* ImportDeclaration */: + case 152 /* FunctionExpression */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: + case 191 /* ModuleDeclaration */: + case 193 /* ImportDeclaration */: return parent.name === node; - case 168 /* BreakStatement */: - case 167 /* ContinueStatement */: - case 191 /* ExportAssignment */: + case 171 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 194 /* ExportAssignment */: return false; - case 174 /* LabeledStatement */: + case 177 /* LabeledStatement */: return node.parent.label === node; - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: return node.parent.variable === node; } } - function emitIdentifier(node) { - if (!isNonExpressionIdentifier(node)) { - var prefix = resolver.getExpressionNamePrefix(node); - if (prefix) { - write(prefix); - write("."); - } + function emitExpressionIdentifier(node) { + var prefix = resolver.getExpressionNamePrefix(node); + if (prefix) { + write(prefix); + write("."); } write(getSourceTextOfLocalNode(node)); } + function emitIdentifier(node) { + if (!isNotExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else { + write(getSourceTextOfLocalNode(node)); + } + } function emitThis(node) { if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { write("_this"); @@ -6859,10 +6962,33 @@ var ts; emit(node.initializer); emitTrailingComments(node); } + function emitShortHandPropertyAssignment(node) { + function emitAsNormalPropertyAssignment() { + emitLeadingComments(node); + emit(node.name); + write(": "); + emitExpressionIdentifier(node.name); + emitTrailingComments(node); + } + if (compilerOptions.target < 2 /* ES6 */) { + emitAsNormalPropertyAssignment(); + } + else if (compilerOptions.target >= 2 /* ES6 */) { + var prefix = resolver.getExpressionNamePrefix(node.name); + if (prefix) { + emitAsNormalPropertyAssignment(); + } + else { + emitLeadingComments(node); + emit(node.name); + emitTrailingComments(node); + } + } + } function tryEmitConstantValue(node) { var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { - var propertyName = node.kind === 142 /* PropertyAccess */ ? ts.identifierToString(node.right) : ts.getTextOfNode(node.index); + var propertyName = node.kind === 145 /* PropertyAccess */ ? ts.declarationNameToString(node.right) : ts.getTextOfNode(node.index); write(constantValue.toString() + " /* " + propertyName + " */"); return true; } @@ -6893,7 +7019,7 @@ var ts; } else { emit(node.func); - superCall = node.func.kind === 142 /* PropertyAccess */ && node.func.left.kind === 89 /* SuperKeyword */; + superCall = node.func.kind === 145 /* PropertyAccess */ && node.func.left.kind === 89 /* SuperKeyword */; } if (superCall) { write(".call("); @@ -6926,12 +7052,12 @@ var ts; emit(node.template); } function emitParenExpression(node) { - if (node.expression.kind === 147 /* TypeAssertion */) { + if (node.expression.kind === 150 /* TypeAssertion */) { var operand = node.expression.operand; - while (operand.kind == 147 /* TypeAssertion */) { + while (operand.kind == 150 /* TypeAssertion */) { operand = operand.operand; } - if (operand.kind !== 151 /* PrefixOperator */ && operand.kind !== 152 /* PostfixOperator */ && operand.kind !== 145 /* NewExpression */ && !(operand.kind === 144 /* CallExpression */ && node.parent.kind === 145 /* NewExpression */) && !(operand.kind === 149 /* FunctionExpression */ && node.parent.kind === 144 /* CallExpression */)) { + if (operand.kind !== 154 /* PrefixOperator */ && operand.kind !== 155 /* PostfixOperator */ && operand.kind !== 148 /* NewExpression */ && !(operand.kind === 147 /* CallExpression */ && node.parent.kind === 148 /* NewExpression */) && !(operand.kind === 152 /* FunctionExpression */ && node.parent.kind === 147 /* CallExpression */)) { emit(operand); return; } @@ -6941,13 +7067,13 @@ var ts; write(")"); } function emitUnaryExpression(node) { - if (node.kind === 151 /* PrefixOperator */) { + if (node.kind === 154 /* PrefixOperator */) { write(ts.tokenToString(node.operator)); } if (node.operator >= 63 /* Identifier */) { write(" "); } - else if (node.kind === 151 /* PrefixOperator */ && node.operand.kind === 151 /* PrefixOperator */) { + else if (node.kind === 154 /* PrefixOperator */ && node.operand.kind === 154 /* PrefixOperator */) { var operand = node.operand; if (node.operator === 32 /* PlusToken */ && (operand.operator === 32 /* PlusToken */ || operand.operator === 37 /* PlusPlusToken */)) { write(" "); @@ -6957,7 +7083,7 @@ var ts; } } emit(node.operand); - if (node.kind === 152 /* PostfixOperator */) { + if (node.kind === 155 /* PostfixOperator */) { write(ts.tokenToString(node.operator)); } } @@ -6980,8 +7106,8 @@ var ts; emitToken(13 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 189 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 188 /* ModuleDeclaration */); + if (node.kind === 192 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 191 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); @@ -6991,7 +7117,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 158 /* Block */) { + if (node.kind === 161 /* Block */) { write(" "); emit(node); } @@ -7003,7 +7129,7 @@ var ts; } } function emitExpressionStatement(node) { - var isArrowExpression = node.expression.kind === 150 /* ArrowFunction */; + var isArrowExpression = node.expression.kind === 153 /* ArrowFunction */; emitLeadingComments(node); if (isArrowExpression) write("("); @@ -7024,7 +7150,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(74 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 162 /* IfStatement */) { + if (node.elseStatement.kind === 165 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -7037,7 +7163,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 158 /* Block */) { + if (node.statement.kind === 161 /* Block */) { write(" "); } else { @@ -7103,7 +7229,7 @@ var ts; emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 168 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 171 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } @@ -7138,7 +7264,7 @@ var ts; return getLineOfLocalPosition(ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 172 /* CaseClause */) { + if (node.kind === 175 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -7193,7 +7319,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 188 /* ModuleDeclaration */); + } while (node && node.kind !== 191 /* ModuleDeclaration */); return node; } function emitModuleMemberName(node) { @@ -7305,7 +7431,7 @@ var ts; emitLeadingComments(node); } write("function "); - if (node.kind === 182 /* FunctionDeclaration */ || (node.kind === 149 /* FunctionExpression */ && node.name)) { + if (node.kind === 185 /* FunctionDeclaration */ || (node.kind === 152 /* FunctionExpression */ && node.name)) { emit(node.name); } emitSignatureAndBody(node); @@ -7335,16 +7461,16 @@ var ts; write(" {"); scopeEmitStart(node); increaseIndent(); - emitDetachedComments(node.body.kind === 183 /* FunctionBlock */ ? node.body.statements : node.body); + emitDetachedComments(node.body.kind === 186 /* FunctionBlock */ ? node.body.statements : node.body); var startIndex = 0; - if (node.body.kind === 183 /* FunctionBlock */) { + if (node.body.kind === 186 /* FunctionBlock */) { startIndex = emitDirectivePrologues(node.body.statements, true); } var outPos = writer.getTextPos(); emitCaptureThisForNodeIfNecessary(node); emitDefaultValueAssignments(node); emitRestParameter(node); - if (node.body.kind !== 183 /* FunctionBlock */ && outPos === writer.getTextPos()) { + if (node.body.kind !== 186 /* FunctionBlock */ && outPos === writer.getTextPos()) { decreaseIndent(); write(" "); emitStart(node.body); @@ -7357,7 +7483,7 @@ var ts; emitEnd(node.body); } else { - if (node.body.kind === 183 /* FunctionBlock */) { + if (node.body.kind === 186 /* FunctionBlock */) { emitLinesStartingAt(node.body.statements, startIndex); } else { @@ -7369,7 +7495,7 @@ var ts; emitTrailingComments(node.body); } writeLine(); - if (node.body.kind === 183 /* FunctionBlock */) { + if (node.body.kind === 186 /* FunctionBlock */) { emitLeadingCommentsOfPosition(node.body.statements.end); decreaseIndent(); emitToken(14 /* CloseBraceToken */, node.body.statements.end); @@ -7395,9 +7521,9 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 161 /* ExpressionStatement */) { + if (statement && statement.kind === 164 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 144 /* CallExpression */) { + if (expr && expr.kind === 147 /* CallExpression */) { var func = expr.func; if (func && func.kind === 89 /* SuperKeyword */) { return statement; @@ -7492,7 +7618,7 @@ var ts; write(".prototype"); } write(", "); - emitQuotedIdentifier(member.name); + emitExpressionForPropertyName(member.name); emitEnd(member.name); write(", {"); increaseIndent(); @@ -7698,7 +7824,7 @@ var ts; write("["); write(resolver.getLocalNameOfContainer(node)); write("["); - emitQuotedIdentifier(member.name); + emitExpressionForPropertyName(member.name); write("] = "); if (member.initializer && !isConstEnum) { emit(member.initializer); @@ -7707,7 +7833,7 @@ var ts; write(resolver.getEnumMemberValue(member).toString()); } write("] = "); - emitQuotedIdentifier(member.name); + emitExpressionForPropertyName(member.name); emitEnd(member); write(";"); emitTrailingComments(member); @@ -7715,7 +7841,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 188 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 191 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -7737,7 +7863,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 189 /* ModuleBlock */) { + if (node.body.kind === 192 /* ModuleBlock */) { emit(node.body); } else { @@ -7771,7 +7897,7 @@ var ts; emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); } if (emitImportDeclaration) { - if (node.externalModuleName && node.parent.kind === 193 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { + if (node.externalModuleName && node.parent.kind === 196 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { if (node.flags & 1 /* Export */) { writeLine(); emitLeadingComments(node); @@ -7811,7 +7937,7 @@ var ts; function getExternalImportDeclarations(node) { var result = []; ts.forEach(node.statements, function (stat) { - if (stat.kind === 190 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { + if (stat.kind === 193 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { result.push(stat); } }); @@ -7819,7 +7945,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 191 /* ExportAssignment */) { + if (node.kind === 194 /* ExportAssignment */) { return node; } }); @@ -7960,102 +8086,104 @@ var ts; case 11 /* TemplateMiddle */: case 12 /* TemplateTail */: return emitLiteral(node); - case 155 /* TemplateExpression */: + case 158 /* TemplateExpression */: return emitTemplateExpression(node); - case 156 /* TemplateSpan */: + case 159 /* TemplateSpan */: return emitTemplateSpan(node); case 121 /* QualifiedName */: return emitPropertyAccess(node); - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: return emitArrayLiteral(node); - case 140 /* ObjectLiteral */: + case 142 /* ObjectLiteral */: return emitObjectLiteral(node); - case 141 /* PropertyAssignment */: + case 143 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 142 /* PropertyAccess */: + case 144 /* ShorthandPropertyAssignment */: + return emitShortHandPropertyAssignment(node); + case 145 /* PropertyAccess */: return emitPropertyAccess(node); - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: return emitIndexedAccess(node); - case 144 /* CallExpression */: + case 147 /* CallExpression */: return emitCallExpression(node); - case 145 /* NewExpression */: + case 148 /* NewExpression */: return emitNewExpression(node); - case 146 /* TaggedTemplateExpression */: + case 149 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return emit(node.operand); - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return emitParenExpression(node); - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: return emitUnaryExpression(node); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return emitBinaryExpression(node); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return emitConditionalExpression(node); - case 157 /* OmittedExpression */: + case 160 /* OmittedExpression */: return; - case 158 /* Block */: - case 177 /* TryBlock */: - case 179 /* FinallyBlock */: - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 182 /* FinallyBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: return emitBlock(node); - case 159 /* VariableStatement */: + case 162 /* VariableStatement */: return emitVariableStatement(node); - case 160 /* EmptyStatement */: + case 163 /* EmptyStatement */: return write(";"); - case 161 /* ExpressionStatement */: + case 164 /* ExpressionStatement */: return emitExpressionStatement(node); - case 162 /* IfStatement */: + case 165 /* IfStatement */: return emitIfStatement(node); - case 163 /* DoStatement */: + case 166 /* DoStatement */: return emitDoStatement(node); - case 164 /* WhileStatement */: + case 167 /* WhileStatement */: return emitWhileStatement(node); - case 165 /* ForStatement */: + case 168 /* ForStatement */: return emitForStatement(node); - case 166 /* ForInStatement */: + case 169 /* ForInStatement */: return emitForInStatement(node); - case 167 /* ContinueStatement */: - case 168 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 171 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 169 /* ReturnStatement */: + case 172 /* ReturnStatement */: return emitReturnStatement(node); - case 170 /* WithStatement */: + case 173 /* WithStatement */: return emitWithStatement(node); - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: return emitSwitchStatement(node); - case 172 /* CaseClause */: - case 173 /* DefaultClause */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 174 /* LabeledStatement */: + case 177 /* LabeledStatement */: return emitLabelledStatement(node); - case 175 /* ThrowStatement */: + case 178 /* ThrowStatement */: return emitThrowStatement(node); - case 176 /* TryStatement */: + case 179 /* TryStatement */: return emitTryStatement(node); - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: return emitCatchBlock(node); - case 180 /* DebuggerStatement */: + case 183 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return emitClassDeclaration(node); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return emitImportDeclaration(node); - case 193 /* SourceFile */: + case 196 /* SourceFile */: return emitSourceFile(node); } } @@ -8073,7 +8201,7 @@ var ts; return leadingComments; } function getLeadingCommentsToEmit(node) { - if (node.parent.kind === 193 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 196 /* SourceFile */ || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -8090,7 +8218,7 @@ var ts; emitComments(leadingComments, true, writer, writeComment); } function emitTrailingDeclarationComments(node) { - if (node.parent.kind === 193 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 196 /* SourceFile */ || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(trailingComments, false, writer, writeComment); } @@ -8282,7 +8410,7 @@ var ts; if (node.flags & 1 /* Export */) { write("export "); } - if (node.kind !== 185 /* InterfaceDeclaration */) { + if (node.kind !== 188 /* InterfaceDeclaration */) { write("declare "); } } @@ -8338,7 +8466,7 @@ var ts; emitDeclarationFlags(node); write("module "); emitSourceTextOfNode(node.name); - while (node.body.kind !== 189 /* ModuleBlock */) { + while (node.body.kind !== 192 /* ModuleBlock */) { node = node.body; write("."); emitSourceTextOfNode(node.name); @@ -8410,10 +8538,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 130 /* ConstructSignature */: @@ -8426,14 +8554,14 @@ var ts; if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 184 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 187 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8471,7 +8599,7 @@ var ts; resolver.writeTypeAtLocation(node, enclosingDeclaration, 1 /* WriteArrayAsGenericType */ | 2 /* UseTypeOfFunction */, writer); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.kind === 184 /* ClassDeclaration */) { + if (node.parent.kind === 187 /* ClassDeclaration */) { if (symbolAccesibilityResult.errorModuleName) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2; } @@ -8556,7 +8684,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 181 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 184 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { emitSourceTextOfNode(node.name); if (node.kind === 124 /* Property */ && (node.flags & 4 /* QuestionMark */)) { write("?"); @@ -8569,14 +8697,14 @@ var ts; } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 181 /* VariableDeclaration */) { + if (node.kind === 184 /* VariableDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 124 /* Property */) { if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 184 /* ClassDeclaration */) { + else if (node.parent.kind === 187 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { @@ -8655,10 +8783,10 @@ var ts; } } function emitFunctionDeclaration(node) { - if ((node.kind !== 182 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 185 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); emitDeclarationFlags(node); - if (node.kind === 182 /* FunctionDeclaration */) { + if (node.kind === 185 /* FunctionDeclaration */) { write("function "); emitSourceTextOfNode(node.name); } @@ -8720,14 +8848,14 @@ var ts; if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 184 /* ClassDeclaration */) { + else if (node.parent.kind === 187 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -8771,14 +8899,14 @@ var ts; if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 184 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 187 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8794,7 +8922,7 @@ var ts; function emitNode(node) { switch (node.kind) { case 126 /* Constructor */: - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: case 125 /* Method */: return emitFunctionDeclaration(node); case 130 /* ConstructSignature */: @@ -8805,27 +8933,27 @@ var ts; case 127 /* GetAccessor */: case 128 /* SetAccessor */: return emitAccessorDeclaration(node); - case 159 /* VariableStatement */: + case 162 /* VariableStatement */: return emitVariableStatement(node); case 124 /* Property */: return emitPropertyDeclaration(node); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return emitClassDeclaration(node); - case 186 /* TypeAliasDeclaration */: + case 189 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 192 /* EnumMember */: + case 195 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return emitImportDeclaration(node); - case 191 /* ExportAssignment */: + case 194 /* ExportAssignment */: return emitExportAssignment(node); - case 193 /* SourceFile */: + case 196 /* SourceFile */: return emitSourceFile(node); } } @@ -8887,9 +9015,9 @@ var ts; } } var hasSemanticErrors = resolver.hasSemanticErrors(); - var hasEarlyErrors = resolver.hasEarlyErrors(targetSourceFile); + var isEmitBlocked = resolver.isEmitBlocked(targetSourceFile); function emitFile(jsFilePath, sourceFile) { - if (!hasEarlyErrors) { + if (!isEmitBlocked) { emitJavaScript(jsFilePath, sourceFile); if (!hasSemanticErrors && compilerOptions.declaration) { emitDeclarations(jsFilePath, sourceFile); @@ -8920,7 +9048,7 @@ var ts; diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); var hasEmitterError = ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); var returnCode; - if (hasEarlyErrors) { + if (isEmitBlocked) { returnCode = 1 /* AllOutputGenerationSkipped */; } else if (hasEmitterError) { @@ -9005,7 +9133,7 @@ var ts; checkProgram: checkProgram, emitFiles: invokeEmitter, getParentOfSymbol: getParentOfSymbol, - getTypeOfSymbol: getTypeOfSymbol, + getNarrowedTypeOfSymbol: getNarrowedTypeOfSymbol, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, @@ -9014,6 +9142,7 @@ var ts; getReturnTypeOfSignature: getReturnTypeOfSignature, getSymbolsInScope: getSymbolsInScope, getSymbolInfo: getSymbolInfo, + getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, getTypeOfNode: getTypeOfNode, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, @@ -9030,7 +9159,8 @@ var ts; getAliasedSymbol: resolveImport, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, - hasEarlyErrors: hasEarlyErrors + hasEarlyErrors: hasEarlyErrors, + isEmitBlocked: isEmitBlocked }; var undefinedSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "undefined"); var argumentsSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "arguments"); @@ -9060,6 +9190,7 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; + var globalTemplateStringsArrayType; var tupleTypes = {}; var unionTypes = {}; var stringLiteralTypes = {}; @@ -9208,10 +9339,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 193 /* SourceFile */); + return ts.getAncestor(node, 196 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 193 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 196 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -9252,21 +9383,21 @@ var ts; } } switch (location.kind) { - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 35653619 /* ModuleMember */)) { break loop; } break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; case 124 /* Property */: - if (location.parent.kind === 184 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { + if (location.parent.kind === 187 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { @@ -9275,8 +9406,8 @@ var ts; } } break; - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 3152352 /* Type */)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -9289,14 +9420,14 @@ var ts; case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 182 /* FunctionDeclaration */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 153 /* ArrowFunction */: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 149 /* FunctionExpression */: + case 152 /* FunctionExpression */: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -9307,7 +9438,7 @@ var ts; break loop; } break; - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: var id = location.variable; if (name === id.text) { result = location.symbol; @@ -9323,21 +9454,21 @@ var ts; } if (!result) { if (nameNotFoundMessage) { - error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.identifierToString(nameArg)); + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } return undefined; } if (nameNotFoundMessage) { if (propertyWithInvalidInitializer) { var propertyName = propertyWithInvalidInitializer.name; - error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.identifierToString(propertyName), typeof nameArg === "string" ? nameArg : ts.identifierToString(nameArg)); + error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); return undefined; } if (result.flags & 2 /* BlockScopedVariable */) { var declaration = ts.forEach(result.declarations, function (d) { return d.flags & 6144 /* BlockScoped */ ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); if (!isDefinedBefore(declaration, errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.identifierToString(declaration.name)); + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } } @@ -9348,7 +9479,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = getDeclarationOfKind(symbol, 190 /* ImportDeclaration */); + var node = getDeclarationOfKind(symbol, 193 /* ImportDeclaration */); var target = node.externalModuleName ? resolveExternalModuleName(node, node.externalModuleName) : getSymbolOfPartOfRightHandSideOfImport(node.entityName, node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; @@ -9364,7 +9495,7 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 190 /* ImportDeclaration */); + importDeclaration = ts.getAncestor(entityName, 193 /* ImportDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 63 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { @@ -9374,7 +9505,7 @@ var ts; return resolveEntityName(importDeclaration, entityName, 1536 /* Namespace */); } else { - ts.Debug.assert(entityName.parent.kind === 190 /* ImportDeclaration */); + ts.Debug.assert(entityName.parent.kind === 193 /* ImportDeclaration */); return resolveEntityName(importDeclaration, entityName, 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */); } } @@ -9394,7 +9525,7 @@ var ts; return; var symbol = getSymbol(namespace.exports, name.right.text, meaning); if (!symbol) { - error(location, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.identifierToString(name.right)); + error(location, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(name.right)); return; } } @@ -9479,9 +9610,9 @@ var ts; var seenExportedMember = false; var result = []; ts.forEach(symbol.declarations, function (declaration) { - var block = (declaration.kind === 193 /* SourceFile */ ? declaration : declaration.body); + var block = (declaration.kind === 196 /* SourceFile */ ? declaration : declaration.body); ts.forEach(block.statements, function (node) { - if (node.kind === 191 /* ExportAssignment */) { + if (node.kind === 194 /* ExportAssignment */) { result.push(node); } else { @@ -9588,17 +9719,17 @@ var ts; } } switch (location.kind) { - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location).members)) { return result; } @@ -9629,7 +9760,7 @@ var ts; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 33554432 /* Import */) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return declaration.kind === 190 /* ImportDeclaration */ && declaration.externalModuleName; })) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return declaration.kind === 193 /* ImportDeclaration */ && declaration.externalModuleName; })) { var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { return [symbolFromSymbolTable]; @@ -9711,7 +9842,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 188 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 193 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 191 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 196 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9721,7 +9852,7 @@ var ts; return { aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 190 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 193 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -9742,7 +9873,7 @@ var ts; var firstIdentifier = getFirstIdentifier(entityName); var symbolOfNameSpace = resolveName(entityName.parent, firstIdentifier.text, 1536 /* Namespace */, ts.Diagnostics.Cannot_find_name_0, firstIdentifier); var hasNamespaceDeclarationsVisibile = hasVisibleDeclarations(symbolOfNameSpace); - return hasNamespaceDeclarationsVisibile ? { accessibility: 0 /* Accessible */, aliasesToMakeVisible: hasNamespaceDeclarationsVisibile.aliasesToMakeVisible } : { accessibility: 1 /* NotAccessible */, errorSymbolName: ts.identifierToString(firstIdentifier) }; + return hasNamespaceDeclarationsVisibile ? { accessibility: 0 /* Accessible */, aliasesToMakeVisible: hasNamespaceDeclarationsVisibile.aliasesToMakeVisible } : { accessibility: 1 /* NotAccessible */, errorSymbolName: ts.declarationNameToString(firstIdentifier) }; } function releaseStringWriter(writer) { writer.clear(); @@ -9781,10 +9912,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 138 /* ParenType */) { + while (node.kind === 140 /* ParenType */) { node = node.parent; } - if (node.kind === 186 /* TypeAliasDeclaration */) { + if (node.kind === 189 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -9796,7 +9927,7 @@ var ts; if (symbol.declarations && symbol.declarations.length > 0) { var declaration = symbol.declarations[0]; if (declaration.name) { - writer.writeSymbol(ts.identifierToString(declaration.name), symbol); + writer.writeSymbol(ts.declarationNameToString(declaration.name), symbol); return; } } @@ -9947,7 +10078,7 @@ var ts; function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { var isStaticMethodSymbol = !!(type.symbol.flags & 8192 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 193 /* SourceFile */ || declaration.parent.kind === 189 /* ModuleBlock */; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 196 /* SourceFile */ || declaration.parent.kind === 192 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2 /* UseTypeOfFunction */) || (typeStack && ts.contains(typeStack, type)); } @@ -10166,12 +10297,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 188 /* ModuleDeclaration */) { + if (node.kind === 191 /* ModuleDeclaration */) { if (node.name.kind === 7 /* StringLiteral */) { return node; } } - else if (node.kind === 193 /* SourceFile */) { + else if (node.kind === 196 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10213,16 +10344,16 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 181 /* VariableDeclaration */: - case 188 /* ModuleDeclaration */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 182 /* FunctionDeclaration */: - case 187 /* EnumDeclaration */: - case 190 /* ImportDeclaration */: - var parent = node.kind === 181 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (!(node.flags & 1 /* Export */) && !(node.kind !== 190 /* ImportDeclaration */ && parent.kind !== 193 /* SourceFile */ && ts.isInAmbientContext(parent))) { + case 184 /* VariableDeclaration */: + case 191 /* ModuleDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 185 /* FunctionDeclaration */: + case 190 /* EnumDeclaration */: + case 193 /* ImportDeclaration */: + var parent = node.kind === 184 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (!(node.flags & 1 /* Export */) && !(node.kind !== 193 /* ImportDeclaration */ && parent.kind !== 196 /* SourceFile */ && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); @@ -10236,9 +10367,9 @@ var ts; case 129 /* CallSignature */: case 131 /* IndexSignature */: case 123 /* Parameter */: - case 189 /* ModuleBlock */: + case 192 /* ModuleBlock */: return isDeclarationVisible(node.parent); - case 193 /* SourceFile */: + case 196 /* SourceFile */: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -10256,8 +10387,8 @@ var ts; var classType = getDeclaredTypeOfSymbol(prototype.parent); return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } - function getTypeOfVariableDeclaration(declaration) { - if (declaration.parent.kind === 166 /* ForInStatement */) { + function getTypeOfVariableOrPropertyDeclaration(declaration) { + if (declaration.parent.kind === 169 /* ForInStatement */) { return anyType; } if (declaration.type) { @@ -10278,7 +10409,7 @@ var ts; } if (declaration.initializer) { var type = checkAndMarkExpression(declaration.initializer); - if (declaration.kind !== 141 /* PropertyAssignment */) { + if (declaration.kind !== 143 /* PropertyAssignment */) { var unwidenedType = type; type = getWidenedType(type); if (type !== unwidenedType) { @@ -10287,6 +10418,10 @@ var ts; } return type; } + if (declaration.kind === 144 /* ShorthandPropertyAssignment */) { + var type = checkIdentifier(declaration.name); + return type; + } var type = declaration.flags & 8 /* Rest */ ? createArrayType(anyType) : anyType; checkImplicitAny(type); return type; @@ -10310,7 +10445,7 @@ var ts; default: var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; } - error(declaration, diagnostic, ts.identifierToString(declaration.name), typeToString(type)); + error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeToString(type)); } } function getTypeOfVariableOrParameterOrProperty(symbol) { @@ -10320,11 +10455,11 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.kind === 178 /* CatchBlock */) { + if (declaration.kind === 181 /* CatchBlock */) { return links.type = anyType; } links.type = resolvingType; - var type = getTypeOfVariableDeclaration(declaration); + var type = getTypeOfVariableOrPropertyDeclaration(declaration); if (links.type === resolvingType) { links.type = type; } @@ -10460,7 +10595,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 185 /* InterfaceDeclaration */ || node.kind === 184 /* ClassDeclaration */) { + if (node.kind === 188 /* InterfaceDeclaration */ || node.kind === 187 /* ClassDeclaration */) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10491,7 +10626,7 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = getDeclarationOfKind(symbol, 184 /* ClassDeclaration */); + var declaration = getDeclarationOfKind(symbol, 187 /* ClassDeclaration */); if (declaration.baseType) { var baseType = getTypeFromTypeReferenceNode(declaration.baseType); if (baseType !== unknownType) { @@ -10531,7 +10666,7 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 185 /* InterfaceDeclaration */ && declaration.baseTypes) { + if (declaration.kind === 188 /* InterfaceDeclaration */ && declaration.baseTypes) { ts.forEach(declaration.baseTypes, function (node) { var baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { @@ -10562,7 +10697,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = getDeclarationOfKind(symbol, 186 /* TypeAliasDeclaration */); + var declaration = getDeclarationOfKind(symbol, 189 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -10570,7 +10705,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = getDeclarationOfKind(symbol, 186 /* TypeAliasDeclaration */); + var declaration = getDeclarationOfKind(symbol, 189 /* TypeAliasDeclaration */); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -11039,7 +11174,9 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 182 /* FunctionDeclaration */: + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 185 /* FunctionDeclaration */: case 125 /* Method */: case 126 /* Constructor */: case 129 /* CallSignature */: @@ -11047,8 +11184,8 @@ var ts; case 131 /* IndexSignature */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -11081,7 +11218,7 @@ var ts; if (compilerOptions.noImplicitAny) { var declaration = signature.declaration; if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.identifierToString(declaration.name)); + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); } else { error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); @@ -11269,9 +11406,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 187 /* EnumDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: return declaration; } } @@ -11411,7 +11548,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeLiteralNode(node) { + function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { links.resolvedType = createObjectType(32768 /* Anonymous */, node.symbol); @@ -11448,18 +11585,20 @@ var ts; return getTypeFromStringLiteral(node); case 132 /* TypeReference */: return getTypeFromTypeReferenceNode(node); - case 133 /* TypeQuery */: + case 135 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 135 /* ArrayType */: + case 137 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 136 /* TupleType */: + case 138 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 137 /* UnionType */: + case 139 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 138 /* ParenType */: + case 140 /* ParenType */: return getTypeFromTypeNode(node.type); - case 134 /* TypeLiteral */: - return getTypeFromTypeLiteralNode(node); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 136 /* TypeLiteral */: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 63 /* Identifier */: case 121 /* QualifiedName */: var symbol = getSymbolInfo(node); @@ -11606,16 +11745,16 @@ var ts; } function isContextSensitiveExpression(node) { switch (node.kind) { - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: return !node.typeParameters && !ts.forEach(node.parameters, function (p) { return p.type; }); - case 140 /* ObjectLiteral */: - return ts.forEach(node.properties, function (p) { return p.kind === 141 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); - case 139 /* ArrayLiteral */: + case 142 /* ObjectLiteral */: + return ts.forEach(node.properties, function (p) { return p.kind === 143 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); + case 141 /* ArrayLiteral */: return ts.forEach(node.elements, function (e) { return isContextSensitiveExpression(e); }); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return isContextSensitiveExpression(node.whenTrue) || isContextSensitiveExpression(node.whenFalse); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return node.operator === 48 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); } return false; @@ -11664,6 +11803,7 @@ var ts; var errorInfo; var sourceStack; var targetStack; + var maybeStack; var expandingFlags; var depth = 0; var overflow = false; @@ -11808,11 +11948,11 @@ var ts; var id = source.id + "," + target.id; var related = relation[id]; if (related !== undefined) { - return related; + return related ? -1 /* True */ : 0 /* False */; } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (source === sourceStack[i] && target === targetStack[i]) { + if (maybeStack[i][id]) { return 1 /* Maybe */; } } @@ -11824,10 +11964,13 @@ var ts; else { sourceStack = []; targetStack = []; + maybeStack = []; expandingFlags = 0; } sourceStack[depth] = source; targetStack[depth] = target; + maybeStack[depth] = {}; + maybeStack[depth][id] = true; depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) @@ -11835,7 +11978,7 @@ var ts; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; if (expandingFlags === 3) { - var result = -1 /* True */; + var result = 1 /* Maybe */; } else { var result = propertiesRelatedTo(source, target, reportErrors); @@ -11854,8 +11997,15 @@ var ts; } expandingFlags = saveExpandingFlags; depth--; - if (result !== 1 /* Maybe */) { - relation[id] = result; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = result === -1 /* True */ || depth === 0 ? relation : maybeStack[depth - 1]; + for (var p in maybeCache) { + destinationCache[p] = maybeCache[p]; + } + } + else { + relation[id] = false; } return result; } @@ -12334,8 +12484,9 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var i = 0; i < typeParameters.length; i++) - inferences.push([]); + for (var i = 0; i < typeParameters.length; i++) { + inferences.push({ primary: undefined, secondary: undefined }); + } return { typeParameters: typeParameters, inferUnionTypes: inferUnionTypes, @@ -12348,6 +12499,7 @@ var ts; var sourceStack; var targetStack; var depth = 0; + var inferiority = 0; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { @@ -12374,10 +12526,10 @@ var ts; var typeParameters = context.typeParameters; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { - context.inferenceCount++; var inferences = context.inferences[i]; - if (!ts.contains(inferences, source)) - inferences.push(source); + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + if (!ts.contains(candidates, source)) + candidates.push(source); break; } } @@ -12391,7 +12543,6 @@ var ts; } else if (target.flags & 16384 /* Union */) { var targetTypes = target.types; - var startCount = context.inferenceCount; var typeParameterCount = 0; var typeParameter; for (var i = 0; i < targetTypes.length; i++) { @@ -12404,8 +12555,10 @@ var ts; inferFromTypes(source, t); } } - if (context.inferenceCount === startCount && typeParameterCount === 1) { + if (typeParameterCount === 1) { + inferiority++; inferFromTypes(source, typeParameter); + inferiority--; } } else if (source.flags & 16384 /* Union */) { @@ -12467,10 +12620,14 @@ var ts; } } } + function getInferenceCandidates(context, index) { + var inferences = context.inferences[index]; + return inferences.primary || inferences.secondary || emptyArray; + } function getInferredType(context, index) { var inferredType = context.inferredTypes[index]; if (!inferredType) { - var inferences = context.inferences[index]; + var inferences = getInferenceCandidates(context, index); if (inferences.length) { var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : inferenceFailureType; @@ -12505,7 +12662,7 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 133 /* TypeQuery */: + case 135 /* TypeQuery */: return true; case 63 /* Identifier */: case 121 /* QualifiedName */: @@ -12541,7 +12698,7 @@ var ts; function isAssignedInBinaryExpression(node) { if (node.operator >= 51 /* FirstAssignment */ && node.operator <= 62 /* LastAssignment */) { var n = node.left; - while (n.kind === 148 /* ParenExpression */) { + while (n.kind === 151 /* ParenExpression */) { n = n.expression; } if (n.kind === 63 /* Identifier */ && getResolvedSymbol(n) === symbol) { @@ -12558,40 +12715,40 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return isAssignedInVariableDeclaration(node); - case 139 /* ArrayLiteral */: - case 140 /* ObjectLiteral */: - case 142 /* PropertyAccess */: - case 143 /* IndexedAccess */: - case 144 /* CallExpression */: - case 145 /* NewExpression */: - case 147 /* TypeAssertion */: - case 148 /* ParenExpression */: - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: - case 154 /* ConditionalExpression */: - case 158 /* Block */: - case 159 /* VariableStatement */: - case 161 /* ExpressionStatement */: - case 162 /* IfStatement */: - case 163 /* DoStatement */: - case 164 /* WhileStatement */: - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 169 /* ReturnStatement */: - case 170 /* WithStatement */: - case 171 /* SwitchStatement */: - case 172 /* CaseClause */: - case 173 /* DefaultClause */: - case 174 /* LabeledStatement */: - case 175 /* ThrowStatement */: - case 176 /* TryStatement */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: + case 141 /* ArrayLiteral */: + case 142 /* ObjectLiteral */: + case 145 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: + case 150 /* TypeAssertion */: + case 151 /* ParenExpression */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: + case 157 /* ConditionalExpression */: + case 161 /* Block */: + case 162 /* VariableStatement */: + case 164 /* ExpressionStatement */: + case 165 /* IfStatement */: + case 166 /* DoStatement */: + case 167 /* WhileStatement */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 172 /* ReturnStatement */: + case 173 /* WithStatement */: + case 174 /* SwitchStatement */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12599,26 +12756,23 @@ var ts; } function getNarrowedTypeOfSymbol(symbol, node) { var type = getTypeOfSymbol(symbol); - if (symbol.flags & 3 /* Variable */ && type.flags & 65025 /* Structured */) { - while (true) { + if (node && (symbol.flags & 3 /* Variable */ && type.flags & 65025 /* Structured */)) { + loop: while (true) { var child = node; node = node.parent; - if (!node || node.kind === 183 /* FunctionBlock */ || node.kind === 189 /* ModuleBlock */) { - break; - } var narrowedType = type; switch (node.kind) { - case 162 /* IfStatement */: + case 165 /* IfStatement */: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: if (child === node.right) { if (node.operator === 47 /* AmpersandAmpersandToken */) { narrowedType = narrowType(type, node.left, true); @@ -12628,8 +12782,16 @@ var ts; } } break; + case 196 /* SourceFile */: + case 191 /* ModuleDeclaration */: + case 185 /* FunctionDeclaration */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + break loop; } - if (narrowedType !== type) { + if (narrowedType !== type && isTypeSubtypeOf(narrowedType, type)) { if (isVariableAssignedWithin(symbol, node)) { break; } @@ -12641,7 +12803,7 @@ var ts; function narrowTypeByEquality(type, expr, assumeTrue) { var left = expr.left; var right = expr.right; - if (left.kind !== 151 /* PrefixOperator */ || left.operator !== 95 /* TypeOfKeyword */ || left.operand.kind !== 63 /* Identifier */ || right.kind !== 7 /* StringLiteral */ || getResolvedSymbol(left.operand) !== symbol) { + if (left.kind !== 154 /* PrefixOperator */ || left.operator !== 95 /* TypeOfKeyword */ || left.operand.kind !== 63 /* Identifier */ || right.kind !== 7 /* StringLiteral */ || getResolvedSymbol(left.operand) !== symbol) { return type; } var t = right.text; @@ -12695,9 +12857,9 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return narrowType(type, expr.expression, assumeTrue); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: var operator = expr.operator; if (operator === 29 /* EqualsEqualsEqualsToken */ || operator === 30 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); @@ -12712,7 +12874,7 @@ var ts; return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 151 /* PrefixOperator */: + case 154 /* PrefixOperator */: if (expr.operator === 45 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -12724,7 +12886,7 @@ var ts; function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol.flags & 33554432 /* Import */) { - getSymbolLinks(symbol).referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); + getSymbolLinks(symbol).referenced = getSymbolLinks(symbol).referenced || (!isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol))); } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); @@ -12732,7 +12894,7 @@ var ts; return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 184 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 187 /* ClassDeclaration */ ? container.parent : undefined; getNodeLinks(node).flags |= 2 /* LexicalThis */; if (container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */) { getNodeLinks(classNode).flags |= 4 /* CaptureThis */; @@ -12744,15 +12906,15 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 150 /* ArrowFunction */) { + if (container.kind === 153 /* ArrowFunction */) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = true; } switch (container.kind) { - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 126 /* Constructor */: @@ -12769,7 +12931,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 184 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 187 /* ClassDeclaration */ ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -12782,9 +12944,9 @@ var ts; if (!node) return node; switch (node.kind) { - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: case 124 /* Property */: case 125 /* Method */: case 126 /* Constructor */: @@ -12803,8 +12965,8 @@ var ts; return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 144 /* CallExpression */ && node.parent.func === node; - var enclosingClass = ts.getAncestor(node, 184 /* ClassDeclaration */); + var isCallExpression = node.parent.kind === 147 /* CallExpression */ && node.parent.func === node; + var enclosingClass = ts.getAncestor(node, 187 /* ClassDeclaration */); var baseClass; if (enclosingClass && enclosingClass.baseType) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -12822,11 +12984,11 @@ var ts; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 150 /* ArrowFunction */) { + while (container && container.kind === 153 /* ArrowFunction */) { container = getSuperContainer(container); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 184 /* ClassDeclaration */) { + if (container && container.parent && container.parent.kind === 187 /* ClassDeclaration */) { if (container.flags & 128 /* Static */) { canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */; } @@ -12865,7 +13027,7 @@ var ts; } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (func.kind === 149 /* FunctionExpression */ || func.kind === 150 /* ArrowFunction */) { + if (func.kind === 152 /* FunctionExpression */ || func.kind === 153 /* ArrowFunction */) { if (isContextSensitiveExpression(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -13004,25 +13166,25 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 123 /* Parameter */: case 124 /* Property */: return getContextualTypeForInitializerExpression(node); - case 150 /* ArrowFunction */: - case 169 /* ReturnStatement */: + case 153 /* ArrowFunction */: + case 172 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 144 /* CallExpression */: - case 145 /* NewExpression */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: return getContextualTypeForArgument(node); - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return getTypeFromTypeNode(parent.type); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 141 /* PropertyAssignment */: + case 143 /* PropertyAssignment */: return getContextualTypeForPropertyExpression(node); - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: return getContextualTypeForElementExpression(node); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); } return undefined; @@ -13044,19 +13206,31 @@ var ts; if (!(type.flags & 16384 /* Union */)) { return getNonGenericSignature(type); } - var result; + var signatureList; var types = type.types; for (var i = 0; i < types.length; i++) { + if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0 /* Call */).length > 1) { + return undefined; + } var signature = getNonGenericSignature(types[i]); if (signature) { - if (!result) { - result = signature; + if (!signatureList) { + signatureList = [signature]; } - else if (!compareSignatures(result, signature, true, compareTypes)) { + else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; } + else { + signatureList.push(signature); + } } } + var result; + if (signatureList) { + result = cloneSignature(signatureList[0]); + result.resolvedReturnType = undefined; + result.unionSignatures = signatureList; + } return result; } function isInferentialContext(mapper) { @@ -13085,7 +13259,15 @@ var ts; if (ts.hasProperty(members, id)) { var member = members[id]; if (member.flags & 4 /* Property */) { - var type = checkExpression(member.declarations[0].initializer, contextualMapper); + var memberDecl = member.declarations[0]; + var type; + if (memberDecl.kind === 143 /* PropertyAssignment */) { + type = checkExpression(memberDecl.initializer, contextualMapper); + } + else { + ts.Debug.assert(memberDecl.kind === 144 /* ShorthandPropertyAssignment */); + type = checkExpression(memberDecl.name, contextualMapper); + } var prop = createSymbol(4 /* Property */ | 268435456 /* Transient */ | member.flags, member.name); prop.declarations = member.declarations; prop.parent = member.parent; @@ -13140,7 +13322,7 @@ var ts; if (!(flags & (32 /* Private */ | 64 /* Protected */))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 184 /* ClassDeclaration */); + var enclosingClassDeclaration = ts.getAncestor(node, 187 /* ClassDeclaration */); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32 /* Private */) { @@ -13175,7 +13357,7 @@ var ts; var prop = getPropertyOfType(apparentType, node.right.text); if (!prop) { if (node.right.text) { - error(node.right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.identifierToString(node.right), typeToString(type)); + error(node.right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(node.right), typeToString(type)); } return unknownType; } @@ -13245,29 +13427,64 @@ var ts; return unknownType; } function resolveUntypedCall(node) { - ts.forEach(node.arguments, function (argument) { - checkExpression(argument); - }); + if (node.kind === 149 /* TaggedTemplateExpression */) { + checkExpression(node.template); + } + else { + ts.forEach(node.arguments, function (argument) { + checkExpression(argument); + }); + } return anySignature; } function resolveErrorCall(node) { resolveUntypedCall(node); return unknownSignature; } - function signatureHasCorrectArity(node, signature) { - if (!node.arguments) { - return signature.minArgumentCount === 0; + function hasCorrectArity(node, args, signature) { + var adjustedArgCount; + var typeArguments; + var callIsIncomplete; + if (node.kind === 149 /* TaggedTemplateExpression */) { + var tagExpression = node; + adjustedArgCount = args.length; + typeArguments = undefined; + if (tagExpression.template.kind === 158 /* TemplateExpression */) { + var templateExpression = tagExpression.template; + var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); + ts.Debug.assert(lastSpan !== undefined); + callIsIncomplete = lastSpan.literal.kind === 120 /* Missing */ || ts.isUnterminatedTemplateEnd(lastSpan.literal); + } + else { + var templateLiteral = tagExpression.template; + ts.Debug.assert(templateLiteral.kind === 9 /* NoSubstitutionTemplateLiteral */); + callIsIncomplete = ts.isUnterminatedTemplateEnd(templateLiteral); + } } - var args = node.arguments; - var numberOfArgs = args.hasTrailingComma ? args.length + 1 : args.length; - var hasTooManyArguments = !signature.hasRestParameter && numberOfArgs > signature.parameters.length; - var hasRightNumberOfTypeArguments = !node.typeArguments || (signature.typeParameters && node.typeArguments.length === signature.typeParameters.length); - if (hasTooManyArguments || !hasRightNumberOfTypeArguments) { - return false; + else { + var callExpression = node; + if (!callExpression.arguments) { + ts.Debug.assert(callExpression.kind === 148 /* NewExpression */); + return signature.minArgumentCount === 0; + } + adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; + callIsIncomplete = callExpression.arguments.end === callExpression.end; + typeArguments = callExpression.typeArguments; + } + ts.Debug.assert(adjustedArgCount !== undefined, "'adjustedArgCount' undefined"); + ts.Debug.assert(callIsIncomplete !== undefined, "'callIsIncomplete' undefined"); + return checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature); + function checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature) { + if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { + return false; + } + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + if (!hasRightNumberOfTypeArgs) { + return false; + } + var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; } - var callIsIncomplete = args.end === node.end; - var hasEnoughArguments = numberOfArgs >= signature.minArgumentCount; - return callIsIncomplete || hasEnoughArguments; } function getSingleCallSignature(type) { if (type.flags & 48128 /* ObjectType */) { @@ -13290,17 +13507,21 @@ var ts; var context = createInferenceContext(typeParameters, false); var mapper = createInferenceMapper(context); for (var i = 0; i < args.length; i++) { - if (args[i].kind === 157 /* OmittedExpression */) { + if (args[i].kind === 160 /* OmittedExpression */) { continue; } if (!excludeArgument || excludeArgument[i] === undefined) { var parameterType = getTypeAtPosition(signature, i); + if (i === 0 && args[i].parent.kind === 149 /* TaggedTemplateExpression */) { + inferTypes(context, globalTemplateStringsArrayType, parameterType); + continue; + } inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); } } if (excludeArgument) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 157 /* OmittedExpression */) { + if (args[i].kind === 160 /* OmittedExpression */) { continue; } if (excludeArgument[i] === false) { @@ -13334,37 +13555,60 @@ var ts; } return typeArgumentsAreAssignable; } - function checkApplicableSignature(node, signature, relation, excludeArgument, reportErrors) { - if (node.arguments) { - for (var i = 0; i < node.arguments.length; i++) { - var arg = node.arguments[i]; - if (arg.kind === 157 /* OmittedExpression */) { - continue; - } - var paramType = getTypeAtPosition(signature, i); - var argType = arg.kind === 7 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); - var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); - if (!isValidArgument) { - return false; - } + function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + var argType; + if (arg.kind === 160 /* OmittedExpression */) { + continue; + } + var paramType = getTypeAtPosition(signature, i); + if (i === 0 && node.kind === 149 /* TaggedTemplateExpression */) { + argType = globalTemplateStringsArrayType; + } + else { + argType = arg.kind === 7 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + } + var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); + if (!isValidArgument) { + return false; } } return true; } + function getEffectiveCallArguments(node) { + var args; + if (node.kind === 149 /* TaggedTemplateExpression */) { + var template = node.template; + args = [template]; + if (template.kind === 158 /* TemplateExpression */) { + ts.forEach(template.templateSpans, function (span) { + args.push(span.expression); + }); + } + } + else { + args = node.arguments || emptyArray; + } + return args; + } function resolveCall(node, signatures, candidatesOutArray) { - ts.forEach(node.typeArguments, checkSourceElement); + var isTaggedTemplate = node.kind === 149 /* TaggedTemplateExpression */; + var typeArguments = isTaggedTemplate ? undefined : node.typeArguments; + ts.forEach(typeArguments, checkSourceElement); var candidates = candidatesOutArray || []; collectCandidates(); if (!candidates.length) { error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); return resolveErrorCall(node); } - var args = node.arguments || emptyArray; + var args = getEffectiveCallArguments(node); var excludeArgument; - for (var i = 0; i < args.length; i++) { + for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { if (isContextSensitiveExpression(args[i])) { - if (!excludeArgument) + if (!excludeArgument) { excludeArgument = new Array(args.length); + } excludeArgument[i] = true; } } @@ -13373,30 +13617,30 @@ var ts; var resultOfFailedInference; var result; if (candidates.length > 1) { - result = chooseOverload(candidates, subtypeRelation, excludeArgument); + result = chooseOverload(candidates, subtypeRelation); } if (!result) { candidateForArgumentError = undefined; candidateForTypeArgumentError = undefined; resultOfFailedInference = undefined; - result = chooseOverload(candidates, assignableRelation, excludeArgument); + result = chooseOverload(candidates, assignableRelation); } if (result) { return result; } if (candidateForArgumentError) { - checkApplicableSignature(node, candidateForArgumentError, assignableRelation, undefined, true); + checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); } else if (candidateForTypeArgumentError) { - if (node.typeArguments) { + if (!isTaggedTemplate && node.typeArguments) { checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true); } else { ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; - var inferenceCandidates = resultOfFailedInference.inferences[resultOfFailedInference.failedTypeParameterIndex]; + var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex); var diagnosticChainHead = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); - reportNoCommonSupertypeError(inferenceCandidates, node.func, diagnosticChainHead); + reportNoCommonSupertypeError(inferenceCandidates, node.func || node.tag, diagnosticChainHead); } } else { @@ -13404,15 +13648,15 @@ var ts; } if (!fullTypeCheck) { for (var i = 0, n = candidates.length; i < n; i++) { - if (signatureHasCorrectArity(node, candidates[i])) { + if (hasCorrectArity(node, args, candidates[i])) { return candidates[i]; } } } return resolveErrorCall(node); - function chooseOverload(candidates, relation, excludeArgument) { + function chooseOverload(candidates, relation) { for (var i = 0; i < candidates.length; i++) { - if (!signatureHasCorrectArity(node, candidates[i])) { + if (!hasCorrectArity(node, args, candidates[i])) { continue; } var originalCandidate = candidates[i]; @@ -13422,9 +13666,9 @@ var ts; if (candidate.typeParameters) { var typeArgumentTypes; var typeArgumentsAreValid; - if (node.typeArguments) { + if (typeArguments) { typeArgumentTypes = new Array(candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(candidate, node.typeArguments, typeArgumentTypes, false); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); } else { inferenceResult = inferTypeArguments(candidate, args, excludeArgument); @@ -13436,7 +13680,7 @@ var ts; } candidate = getSignatureInstantiation(candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; @@ -13452,7 +13696,7 @@ var ts; } else { candidateForTypeArgumentError = originalCandidate; - if (!node.typeArguments) { + if (!typeArguments) { resultOfFailedInference = inferenceResult; } } @@ -13555,11 +13799,38 @@ var ts; error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); return resolveErrorCall(node); } + function resolveTaggedTemplateExpression(node, candidatesOutArray) { + var tagType = checkExpression(node.tag); + var apparentType = getApparentType(tagType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); + if (tagType === anyType || (!callSignatures.length && !(tagType.flags & 16384 /* Union */) && isTypeAssignableTo(tagType, globalFunctionType))) { + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } function getResolvedSignature(node, candidatesOutArray) { var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - links.resolvedSignature = node.kind === 144 /* CallExpression */ ? resolveCallExpression(node, candidatesOutArray) : resolveNewExpression(node, candidatesOutArray); + if (node.kind === 147 /* CallExpression */) { + links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); + } + else if (node.kind === 148 /* NewExpression */) { + links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); + } + else if (node.kind === 149 /* TaggedTemplateExpression */) { + links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); + } + else { + ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); + } } return links.resolvedSignature; } @@ -13568,9 +13839,9 @@ var ts; if (node.func.kind === 89 /* SuperKeyword */) { return voidType; } - if (node.kind === 145 /* NewExpression */) { + if (node.kind === 148 /* NewExpression */) { var declaration = signature.declaration; - if (declaration && (declaration.kind !== 126 /* Constructor */ && declaration.kind !== 130 /* ConstructSignature */)) { + if (declaration && declaration.kind !== 126 /* Constructor */ && declaration.kind !== 130 /* ConstructSignature */ && declaration.kind !== 134 /* ConstructorType */) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13580,9 +13851,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { - checkExpression(node.tag); - checkExpression(node.template); - return anyType; + return getReturnTypeOfSignature(getResolvedSignature(node)); } function checkTypeAssertion(node) { var exprType = checkExpression(node.operand); @@ -13613,7 +13882,7 @@ var ts; } function getReturnTypeFromBody(func, contextualMapper) { var contextualSignature = getContextualSignature(func); - if (func.body.kind !== 183 /* FunctionBlock */) { + if (func.body.kind !== 186 /* FunctionBlock */) { var unwidenedType = checkAndMarkExpression(func.body, contextualMapper); var widenedType = getWidenedType(unwidenedType); if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { @@ -13632,7 +13901,7 @@ var ts; if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== commonType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { var typeName = typeToString(widenedType); if (func.name) { - error(func, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.identifierToString(func.name), typeName); + error(func, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.declarationNameToString(func.name), typeName); } else { error(func, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeName); @@ -13661,7 +13930,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 175 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 178 /* ThrowStatement */); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!fullTypeCheck) { @@ -13670,7 +13939,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (!func.body || func.body.kind !== 183 /* FunctionBlock */) { + if (!func.body || func.body.kind !== 186 /* FunctionBlock */) { return; } var bodyBlock = func.body; @@ -13714,7 +13983,7 @@ var ts; if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } - if (node.body.kind === 183 /* FunctionBlock */) { + if (node.body.kind === 186 /* FunctionBlock */) { checkSourceElement(node.body); } else { @@ -13742,12 +14011,12 @@ var ts; case 63 /* Identifier */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: return true; - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -13756,10 +14025,10 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 63 /* Identifier */: - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: var symbol = findSymbol(n); return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096 /* Const */) !== 0; - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: var index = n.index; var symbol = findSymbol(n.object); if (symbol && index.kind === 7 /* StringLiteral */) { @@ -13768,7 +14037,7 @@ var ts; return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096 /* Const */) !== 0; } return false; - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return isConstVariableReference(n.expression); default: return false; @@ -14003,7 +14272,7 @@ var ts; } } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 142 /* PropertyAccess */ && node.parent.left === node) || (node.parent.kind === 143 /* IndexedAccess */ && node.parent.object === node) || ((node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 145 /* PropertyAccess */ && node.parent.left === node) || (node.parent.kind === 146 /* IndexedAccess */ && node.parent.object === node) || ((node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -14025,7 +14294,7 @@ var ts; return booleanType; case 6 /* NumericLiteral */: return numberType; - case 155 /* TemplateExpression */: + case 158 /* TemplateExpression */: return checkTemplateExpression(node); case 7 /* StringLiteral */: case 9 /* NoSubstitutionTemplateLiteral */: @@ -14034,35 +14303,35 @@ var ts; return globalRegExpType; case 121 /* QualifiedName */: return checkPropertyAccess(node); - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: return checkArrayLiteral(node, contextualMapper); - case 140 /* ObjectLiteral */: + case 142 /* ObjectLiteral */: return checkObjectLiteral(node, contextualMapper); - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: return checkPropertyAccess(node); - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: return checkIndexedAccess(node); - case 144 /* CallExpression */: - case 145 /* NewExpression */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: return checkCallExpression(node); - case 146 /* TaggedTemplateExpression */: + case 149 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return checkTypeAssertion(node); - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return checkExpression(node.expression); - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: return checkFunctionExpression(node, contextualMapper); - case 151 /* PrefixOperator */: + case 154 /* PrefixOperator */: return checkPrefixExpression(node); - case 152 /* PostfixOperator */: + case 155 /* PostfixOperator */: return checkPostfixExpression(node); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 157 /* OmittedExpression */: + case 160 /* OmittedExpression */: return undefinedType; } return unknownType; @@ -14098,7 +14367,7 @@ var ts; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(parameterDeclaration.parent.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { if (referencedSymbol.valueDeclaration.kind === 123 /* Parameter */) { if (referencedSymbol.valueDeclaration === parameterDeclaration) { - error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.identifierToString(parameterDeclaration.name)); + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(parameterDeclaration.name)); return; } var enclosingOrReferencedParameter = ts.forEach(parameterDeclaration.parent.parameters, function (p) { return p === parameterDeclaration || p === referencedSymbol.valueDeclaration ? p : undefined; }); @@ -14106,7 +14375,7 @@ var ts; return; } } - error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.identifierToString(parameterDeclaration.name), ts.identifierToString(n)); + error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(parameterDeclaration.name), ts.declarationNameToString(n)); } } else { @@ -14142,7 +14411,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 185 /* InterfaceDeclaration */) { + if (node.kind === 188 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -14198,17 +14467,17 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 144 /* CallExpression */ && n.func.kind === 89 /* SuperKeyword */; + return n.kind === 147 /* CallExpression */ && n.func.kind === 89 /* SuperKeyword */; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 149 /* FunctionExpression */: - case 182 /* FunctionDeclaration */: - case 150 /* ArrowFunction */: - case 140 /* ObjectLiteral */: return false; + case 152 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 153 /* ArrowFunction */: + case 142 /* ObjectLiteral */: return false; default: return ts.forEachChild(n, containsSuperCall); } } @@ -14216,7 +14485,7 @@ var ts; if (n.kind === 91 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 149 /* FunctionExpression */ && n.kind !== 182 /* FunctionDeclaration */) { + else if (n.kind !== 152 /* FunctionExpression */ && n.kind !== 185 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -14228,7 +14497,7 @@ var ts; var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 161 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 164 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -14286,7 +14555,7 @@ var ts; function checkTypeLiteral(node) { ts.forEach(node.members, checkSourceElement); if (fullTypeCheck) { - var type = getTypeFromTypeLiteralNode(node); + var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); checkIndexConstraints(type); checkTypeForDuplicateIndexSignatures(node); } @@ -14315,9 +14584,8 @@ var ts; error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); return; } - var symbol = getSymbolOfNode(signatureDeclarationNode); var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 185 /* InterfaceDeclaration */) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 188 /* InterfaceDeclaration */) { ts.Debug.assert(signatureDeclarationNode.kind === 129 /* CallSignature */ || signatureDeclarationNode.kind === 130 /* ConstructSignature */); var signatureKind = signatureDeclarationNode.kind === 129 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -14337,7 +14605,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = n.flags; - if (n.parent.kind !== 185 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 188 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { flags |= 1 /* Export */; } @@ -14404,7 +14672,7 @@ var ts; return; } else if (subsequentNode.body) { - error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.identifierToString(node.name)); + error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); return; } } @@ -14423,11 +14691,11 @@ var ts; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 185 /* InterfaceDeclaration */ || node.parent.kind === 134 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 188 /* InterfaceDeclaration */ || node.parent.kind === 136 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 182 /* FunctionDeclaration */ || node.kind === 125 /* Method */ || node.kind === 126 /* Constructor */) { + if (node.kind === 185 /* FunctionDeclaration */ || node.kind === 125 /* Method */ || node.kind === 126 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -14515,20 +14783,20 @@ var ts; if (commonDeclarationSpace) { ts.forEach(symbol.declarations, function (d) { if (getDeclarationSpaces(d) & commonDeclarationSpace) { - error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.identifierToString(d.name)); + error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name)); } }); } function getDeclarationSpaces(d) { switch (d.kind) { - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return 8388608 /* ExportType */; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return d.name.kind === 7 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 16777216 /* ExportNamespace */ | 4194304 /* ExportValue */ : 16777216 /* ExportNamespace */; - case 184 /* ClassDeclaration */: - case 187 /* EnumDeclaration */: + case 187 /* ClassDeclaration */: + case 190 /* EnumDeclaration */: return 8388608 /* ExportType */ | 4194304 /* ExportValue */; - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: var result = 0; var target = resolveImport(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { @@ -14561,7 +14829,7 @@ var ts; if (!isPrivateWithinAmbient(node)) { var typeName = typeToString(anyType); if (node.name) { - error(node, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.identifierToString(node.name), typeName); + error(node, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.declarationNameToString(node.name), typeName); } else { error(node, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeName); @@ -14603,10 +14871,10 @@ var ts; return; } switch (current.kind) { - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: case 125 /* Method */: - case 150 /* ArrowFunction */: + case 153 /* ArrowFunction */: case 126 /* Constructor */: if (ts.hasRestParameters(current)) { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter); @@ -14658,7 +14926,7 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 184 /* ClassDeclaration */); + var enclosingClass = ts.getAncestor(node, 187 /* ClassDeclaration */); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } @@ -14676,12 +14944,12 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 188 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 191 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } - var parent = node.kind === 181 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (parent.kind === 193 /* SourceFile */ && ts.isExternalModule(parent)) { - error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, name.text, name.text); + var parent = node.kind === 184 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (parent.kind === 196 /* SourceFile */ && ts.isExternalModule(parent)) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkCollisionWithConstDeclarations(node) { @@ -14709,7 +14977,7 @@ var ts; type = typeOfValueDeclaration; } else { - type = getTypeOfVariableDeclaration(node); + type = getTypeOfVariableOrPropertyDeclaration(node); } if (node.initializer) { if (!(getNodeLinks(node.initializer).flags & 1 /* TypeChecked */)) { @@ -14722,7 +14990,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); if (!useTypeFromValueDeclaration) { if (typeOfValueDeclaration !== unknownType && type !== unknownType && !isTypeIdenticalTo(typeOfValueDeclaration, type)) { - error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.identifierToString(node.name), typeToString(typeOfValueDeclaration), typeToString(type)); + error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(typeOfValueDeclaration), typeToString(type)); } } } @@ -14899,7 +15167,7 @@ var ts; if (fullTypeCheck) { for (var j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { - error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.identifierToString(node.name)); + error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); } } } @@ -15068,7 +15336,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = getDeclarationOfKind(symbol, 185 /* InterfaceDeclaration */); + var firstInterfaceDecl = getDeclarationOfKind(symbol, 188 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -15139,7 +15407,7 @@ var ts; return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 151 /* PrefixOperator */: + case 154 /* PrefixOperator */: var value = evalConstant(e.operand); if (value === undefined) { return undefined; @@ -15150,7 +15418,7 @@ var ts; case 46 /* TildeToken */: return enumIsConst ? ~value : undefined; } return undefined; - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: if (!enumIsConst) { return undefined; } @@ -15178,11 +15446,11 @@ var ts; return undefined; case 6 /* NumericLiteral */: return +e.text; - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return enumIsConst ? evalConstant(e.expression) : undefined; case 63 /* Identifier */: - case 143 /* IndexedAccess */: - case 142 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 145 /* PropertyAccess */: if (!enumIsConst) { return undefined; } @@ -15195,7 +15463,7 @@ var ts; propertyName = e.text; } else { - if (e.kind === 143 /* IndexedAccess */) { + if (e.kind === 146 /* IndexedAccess */) { if (e.index.kind !== 7 /* StringLiteral */) { return undefined; } @@ -15251,7 +15519,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 187 /* EnumDeclaration */) { + if (declaration.kind !== 190 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -15274,7 +15542,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 184 /* ClassDeclaration */ || (declaration.kind === 182 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 187 /* ClassDeclaration */ || (declaration.kind === 185 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -15328,7 +15596,7 @@ var ts; checkExpression(node.entityName); } else { - error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.identifierToString(moduleName)); + error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } if (target.flags & 3152352 /* Type */) { @@ -15337,10 +15605,10 @@ var ts; } } else { - if (node.parent.kind === 193 /* SourceFile */) { + if (node.parent.kind === 196 /* SourceFile */) { target = resolveImport(symbol); } - else if (node.parent.kind === 189 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { + else if (node.parent.kind === 192 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { if (isExternalModuleNameRelative(node.externalModuleName.text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); target = unknownSymbol; @@ -15362,7 +15630,7 @@ var ts; } function checkExportAssignment(node) { var container = node.parent; - if (container.kind !== 193 /* SourceFile */) { + if (container.kind !== 196 /* SourceFile */) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -15377,6 +15645,8 @@ var ts; return checkParameter(node); case 124 /* Property */: return checkPropertyDeclaration(node); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: case 129 /* CallSignature */: case 130 /* ConstructSignature */: case 131 /* IndexSignature */: @@ -15390,76 +15660,76 @@ var ts; return checkAccessorDeclaration(node); case 132 /* TypeReference */: return checkTypeReference(node); - case 133 /* TypeQuery */: + case 135 /* TypeQuery */: return checkTypeQuery(node); - case 134 /* TypeLiteral */: + case 136 /* TypeLiteral */: return checkTypeLiteral(node); - case 135 /* ArrayType */: + case 137 /* ArrayType */: return checkArrayType(node); - case 136 /* TupleType */: + case 138 /* TupleType */: return checkTupleType(node); - case 137 /* UnionType */: + case 139 /* UnionType */: return checkUnionType(node); - case 138 /* ParenType */: + case 140 /* ParenType */: return checkSourceElement(node.type); - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 158 /* Block */: + case 161 /* Block */: return checkBlock(node); - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: return checkBody(node); - case 159 /* VariableStatement */: + case 162 /* VariableStatement */: return checkVariableStatement(node); - case 161 /* ExpressionStatement */: + case 164 /* ExpressionStatement */: return checkExpressionStatement(node); - case 162 /* IfStatement */: + case 165 /* IfStatement */: return checkIfStatement(node); - case 163 /* DoStatement */: + case 166 /* DoStatement */: return checkDoStatement(node); - case 164 /* WhileStatement */: + case 167 /* WhileStatement */: return checkWhileStatement(node); - case 165 /* ForStatement */: + case 168 /* ForStatement */: return checkForStatement(node); - case 166 /* ForInStatement */: + case 169 /* ForInStatement */: return checkForInStatement(node); - case 167 /* ContinueStatement */: - case 168 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 171 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 169 /* ReturnStatement */: + case 172 /* ReturnStatement */: return checkReturnStatement(node); - case 170 /* WithStatement */: + case 173 /* WithStatement */: return checkWithStatement(node); - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: return checkSwitchStatement(node); - case 174 /* LabeledStatement */: + case 177 /* LabeledStatement */: return checkLabeledStatement(node); - case 175 /* ThrowStatement */: + case 178 /* ThrowStatement */: return checkThrowStatement(node); - case 176 /* TryStatement */: + case 179 /* TryStatement */: return checkTryStatement(node); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return ts.Debug.fail("Checker encountered variable declaration"); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return checkClassDeclaration(node); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 186 /* TypeAliasDeclaration */: + case 189 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return checkImportDeclaration(node); - case 191 /* ExportAssignment */: + case 194 /* ExportAssignment */: return checkExportAssignment(node); } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionBody(node); break; @@ -15467,55 +15737,55 @@ var ts; case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 170 /* WithStatement */: + case 173 /* WithStatement */: checkFunctionExpressionBodies(node.expression); break; case 123 /* Parameter */: case 124 /* Property */: - case 139 /* ArrayLiteral */: - case 140 /* ObjectLiteral */: - case 141 /* PropertyAssignment */: - case 142 /* PropertyAccess */: - case 143 /* IndexedAccess */: - case 144 /* CallExpression */: - case 145 /* NewExpression */: - case 146 /* TaggedTemplateExpression */: - case 147 /* TypeAssertion */: - case 148 /* ParenExpression */: - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: - case 153 /* BinaryExpression */: - case 154 /* ConditionalExpression */: - case 158 /* Block */: - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: - case 159 /* VariableStatement */: - case 161 /* ExpressionStatement */: - case 162 /* IfStatement */: - case 163 /* DoStatement */: - case 164 /* WhileStatement */: - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 167 /* ContinueStatement */: - case 168 /* BreakStatement */: - case 169 /* ReturnStatement */: - case 171 /* SwitchStatement */: - case 172 /* CaseClause */: - case 173 /* DefaultClause */: - case 174 /* LabeledStatement */: - case 175 /* ThrowStatement */: - case 176 /* TryStatement */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: - case 181 /* VariableDeclaration */: - case 184 /* ClassDeclaration */: - case 187 /* EnumDeclaration */: - case 192 /* EnumMember */: - case 193 /* SourceFile */: + case 141 /* ArrayLiteral */: + case 142 /* ObjectLiteral */: + case 143 /* PropertyAssignment */: + case 145 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: + case 149 /* TaggedTemplateExpression */: + case 150 /* TypeAssertion */: + case 151 /* ParenExpression */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: + case 156 /* BinaryExpression */: + case 157 /* ConditionalExpression */: + case 161 /* Block */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: + case 162 /* VariableStatement */: + case 164 /* ExpressionStatement */: + case 165 /* IfStatement */: + case 166 /* DoStatement */: + case 167 /* WhileStatement */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 170 /* ContinueStatement */: + case 171 /* BreakStatement */: + case 172 /* ReturnStatement */: + case 174 /* SwitchStatement */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 184 /* VariableDeclaration */: + case 187 /* ClassDeclaration */: + case 190 /* EnumDeclaration */: + case 195 /* EnumMember */: + case 196 /* SourceFile */: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -15586,7 +15856,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 170 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 173 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -15622,27 +15892,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 35653619 /* ModuleMember */); break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 3152352 /* Type */); } break; - case 149 /* FunctionExpression */: + case 152 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: if (location.variable.text) { copySymbol(location.symbol, meaning); } @@ -15660,10 +15930,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 122 /* TypeParameter */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 187 /* EnumDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 190 /* EnumDeclaration */: return true; } } @@ -15674,7 +15944,7 @@ var ts; return node.parent && node.parent.kind === 132 /* TypeReference */; } function isTypeNode(node) { - if (132 /* FirstTypeNode */ <= node.kind && node.kind <= 138 /* LastTypeNode */) { + if (132 /* FirstTypeNode */ <= node.kind && node.kind <= 140 /* LastTypeNode */) { return true; } switch (node.kind) { @@ -15684,20 +15954,20 @@ var ts; case 110 /* BooleanKeyword */: return true; case 97 /* VoidKeyword */: - return node.parent.kind !== 151 /* PrefixOperator */; + return node.parent.kind !== 154 /* PrefixOperator */; case 7 /* StringLiteral */: return node.parent.kind === 123 /* Parameter */; case 63 /* Identifier */: - if (node.parent.kind === 121 /* QualifiedName */) { + if (node.parent.kind === 121 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } case 121 /* QualifiedName */: ts.Debug.assert(node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); var parent = node.parent; - if (parent.kind === 133 /* TypeQuery */) { + if (parent.kind === 135 /* TypeQuery */) { return false; } - if (132 /* FirstTypeNode */ <= parent.kind && parent.kind <= 138 /* LastTypeNode */) { + if (132 /* FirstTypeNode */ <= parent.kind && parent.kind <= 140 /* LastTypeNode */) { return true; } switch (parent.kind) { @@ -15705,11 +15975,11 @@ var ts; return node === parent.constraint; case 124 /* Property */: case 123 /* Parameter */: - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return node === parent.type; - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: case 126 /* Constructor */: case 125 /* Method */: case 127 /* GetAccessor */: @@ -15719,12 +15989,12 @@ var ts; case 130 /* ConstructSignature */: case 131 /* IndexSignature */: return node === parent.type; - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return node === parent.type; - case 144 /* CallExpression */: - case 145 /* NewExpression */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: return parent.typeArguments && parent.typeArguments.indexOf(node) >= 0; - case 146 /* TaggedTemplateExpression */: + case 149 /* TaggedTemplateExpression */: return false; } } @@ -15734,22 +16004,22 @@ var ts; while (node.parent.kind === 121 /* QualifiedName */) { node = node.parent; } - if (node.parent.kind === 190 /* ImportDeclaration */) { + if (node.parent.kind === 193 /* ImportDeclaration */) { return node.parent.entityName === node; } - if (node.parent.kind === 191 /* ExportAssignment */) { + if (node.parent.kind === 194 /* ExportAssignment */) { return node.parent.exportName === node; } return false; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 121 /* QualifiedName */ || node.parent.kind === 142 /* PropertyAccess */) && node.parent.right === node; + return (node.parent.kind === 121 /* QualifiedName */ || node.parent.kind === 145 /* PropertyAccess */) && node.parent.right === node; } function getSymbolOfEntityName(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 191 /* ExportAssignment */) { + if (entityName.parent.kind === 194 /* ExportAssignment */) { return resolveEntityName(entityName.parent.parent, entityName, 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */ | 33554432 /* Import */); } if (isInRightSideOfImportOrExportAssignment(entityName)) { @@ -15763,7 +16033,7 @@ var ts; var meaning = 107455 /* Value */ | 33554432 /* Import */; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 121 /* QualifiedName */ || entityName.kind === 142 /* PropertyAccess */) { + else if (entityName.kind === 121 /* QualifiedName */ || entityName.kind === 145 /* PropertyAccess */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccess(entityName); @@ -15789,11 +16059,11 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 63 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 191 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); + return node.parent.kind === 194 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { case 63 /* Identifier */: - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: case 121 /* QualifiedName */: return getSymbolOfEntityName(node); case 91 /* ThisKeyword */: @@ -15807,13 +16077,13 @@ var ts; } return undefined; case 7 /* StringLiteral */: - if (node.parent.kind === 190 /* ImportDeclaration */ && node.parent.externalModuleName === node) { + if (node.parent.kind === 193 /* ImportDeclaration */ && node.parent.externalModuleName === node) { var importSymbol = getSymbolOfNode(node.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } case 6 /* NumericLiteral */: - if (node.parent.kind == 143 /* IndexedAccess */ && node.parent.index === node) { + if (node.parent.kind == 146 /* IndexedAccess */ && node.parent.index === node) { var objectType = checkExpression(node.parent.object); if (objectType === unknownType) return undefined; @@ -15826,6 +16096,12 @@ var ts; } return undefined; } + function getShorthandAssignmentValueSymbol(location) { + if (location && location.kind === 144 /* ShorthandPropertyAssignment */) { + return resolveEntityName(location, location.name, 107455 /* Value */); + } + return undefined; + } function getTypeOfNode(node) { if (isInsideWithStatementBody(node)) { return unknownType; @@ -15895,7 +16171,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 193 /* SourceFile */; + return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 196 /* SourceFile */; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -15928,7 +16204,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 188 /* ModuleDeclaration */ || node.kind === 187 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 191 /* ModuleDeclaration */ || node.kind === 190 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -15952,15 +16228,17 @@ var ts; return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; } function isTopLevelValueImportWithEntityName(node) { - if (node.parent.kind !== 193 /* SourceFile */ || !node.entityName) { + if (node.parent.kind !== 196 /* SourceFile */ || !node.entityName) { return false; } - var symbol = getSymbolOfNode(node); return isImportResolvedToValue(getSymbolOfNode(node)); } function hasSemanticErrors() { return getDiagnostics().length > 0 || getGlobalDiagnostics().length > 0; } + function isEmitBlocked(sourceFile) { + return program.getDiagnostics(sourceFile).length !== 0 || hasEarlyErrors(sourceFile) || (compilerOptions.noEmitOnError && getDiagnostics(sourceFile).length !== 0); + } function hasEarlyErrors(sourceFile) { return ts.forEach(getDiagnostics(sourceFile), function (d) { return d.isEarly; }); } @@ -16001,7 +16279,7 @@ var ts; if (symbol && (symbol.flags & 8 /* EnumMember */)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 192 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { + if (declaration.kind === 195 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { return constantValue; } } @@ -16009,7 +16287,7 @@ var ts; } function writeTypeAtLocation(location, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(location); - var type = symbol && !(symbol.flags & 2048 /* TypeLiteral */) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); + var type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* CallSignature */ | 262144 /* ConstructSignature */)) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -16027,7 +16305,7 @@ var ts; getEnumMemberValue: getEnumMemberValue, isTopLevelValueImportWithEntityName: isTopLevelValueImportWithEntityName, hasSemanticErrors: hasSemanticErrors, - hasEarlyErrors: hasEarlyErrors, + isEmitBlocked: isEmitBlocked, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, writeTypeAtLocation: writeTypeAtLocation, @@ -16061,6 +16339,7 @@ var ts; globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); + globalTemplateStringsArrayType = compilerOptions.target >= 2 /* ES6 */ ? getGlobalType("TemplateStringsArray") : unknownType; } initializeTypeChecker(); return checker; @@ -16119,6 +16398,11 @@ var ts; paramType: ts.Diagnostics.KIND, error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd }, + { + name: "noEmitOnError", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + }, { name: "noImplicitAny", type: "boolean", @@ -16559,7 +16843,10 @@ var ts; var checker = program.getTypeChecker(true); var checkStart = new Date().getTime(); errors = checker.getDiagnostics(); - if (!checker.hasEarlyErrors()) { + if (checker.isEmitBlocked()) { + exitStatus = 1 /* AllOutputGenerationSkipped */; + } + else { var emitStart = new Date().getTime(); var emitOutput = checker.emitFiles(); var emitErrors = emitOutput.errors; @@ -16567,9 +16854,6 @@ var ts; var reportStart = new Date().getTime(); errors = ts.concatenate(errors, emitErrors); } - else { - exitStatus = 1 /* AllOutputGenerationSkipped */; - } } reportDiagnostics(errors); if (commandLine.options.diagnostics) { diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index ea97ea9ea7..174150b6a4 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -13,1421 +13,6 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var ts; -(function (ts) { - ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: 1 /* Error */, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: 1 /* Error */, key: "Identifier expected." }, - _0_expected: { code: 1005, category: 1 /* Error */, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1 /* Error */, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: 1 /* Error */, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: 1 /* Error */, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: 1 /* Error */, key: "Unexpected token." }, - Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1 /* Error */, key: "Catch clause parameter cannot have a type annotation." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1 /* Error */, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1 /* Error */, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1 /* Error */, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1 /* Error */, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1 /* Error */, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1 /* Error */, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1 /* Error */, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1 /* Error */, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1 /* Error */, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1 /* Error */, key: "An index signature parameter type must be 'string' or 'number'." }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1 /* Error */, key: "A class or interface declaration can only have one 'extends' clause." }, - An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1 /* Error */, key: "An 'extends' clause must precede an 'implements' clause." }, - A_class_can_only_extend_a_single_class: { code: 1026, category: 1 /* Error */, key: "A class can only extend a single class." }, - A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1 /* Error */, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: 1 /* Error */, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: 1 /* Error */, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: 1 /* Error */, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a class element." }, - An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1 /* Error */, key: "An interface declaration cannot have an 'implements' clause." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1 /* Error */, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1 /* Error */, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1 /* Error */, key: "Statements are not allowed in ambient contexts." }, - A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: 1 /* Error */, key: "A function implementation cannot be declared in an ambient context." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1 /* Error */, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1 /* Error */, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a module element." }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1 /* Error */, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: 1 /* Error */, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1 /* Error */, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1 /* Error */, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1 /* Error */, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1 /* Error */, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1 /* Error */, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: 1 /* Error */, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1 /* Error */, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: 1 /* Error */, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1 /* Error */, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1 /* Error */, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1 /* Error */, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: 1 /* Error */, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1 /* Error */, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1 /* Error */, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1 /* Error */, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1 /* Error */, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1 /* Error */, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: 1 /* Error */, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1 /* Error */, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1 /* Error */, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: 1 /* Error */, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: 1 /* Error */, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: 1 /* Error */, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1 /* Error */, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1 /* Error */, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1 /* Error */, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1 /* Error */, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1 /* Error */, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1 /* Error */, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1 /* Error */, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: 1 /* Error */, key: "Expression expected." }, - Type_expected: { code: 1110, category: 1 /* Error */, key: "Type expected." }, - A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: 1 /* Error */, key: "A constructor implementation cannot be declared in an ambient context." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: 1 /* Error */, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1 /* Error */, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: 1 /* Error */, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1 /* Error */, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1 /* Error */, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1 /* Error */, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1 /* Error */, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1 /* Error */, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1 /* Error */, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1 /* Error */, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1 /* Error */, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1 /* Error */, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: 1 /* Error */, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: 1 /* Error */, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: 1 /* Error */, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: 1 /* Error */, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: 1 /* Error */, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: 1 /* Error */, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: 1 /* Error */, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: 1 /* Error */, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: 1 /* Error */, key: "Enum member expected." }, - Type_reference_expected: { code: 1133, category: 1 /* Error */, key: "Type reference expected." }, - Variable_declaration_expected: { code: 1134, category: 1 /* Error */, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: 1 /* Error */, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: 1 /* Error */, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: 1 /* Error */, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: 1 /* Error */, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: 1 /* Error */, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: 1 /* Error */, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: 1 /* Error */, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: 1 /* Error */, key: "Line break not permitted here." }, - catch_or_finally_expected: { code: 1143, category: 1 /* Error */, key: "'catch' or 'finally' expected." }, - Block_or_expected: { code: 1144, category: 1 /* Error */, key: "Block or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1 /* Error */, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: 1 /* Error */, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1 /* Error */, key: "Import declarations in an internal module cannot reference an external module." }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1 /* Error */, key: "Cannot compile external modules unless the '--module' flag is provided." }, - Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: 1 /* Error */, key: "Filename '{0}' differs from already included filename '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - var_let_or_const_expected: { code: 1152, category: 1 /* Error */, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1 /* Error */, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1 /* Error */, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: 1 /* Error */, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1 /* Error */, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1 /* Error */, key: "'let' declarations can only be declared inside a block." }, - Invalid_template_literal_expected: { code: 1158, category: 1 /* Error */, key: "Invalid template literal; expected '}'" }, - Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1 /* Error */, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, - Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* Error */, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1 /* Error */, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: 1 /* Error */, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: 1 /* Error */, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: 1 /* Error */, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: 1 /* Error */, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: 1 /* Error */, key: "Cannot find external module '{0}'." }, - A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1 /* Error */, key: "A module cannot have more than one export assignment." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1 /* Error */, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1 /* Error */, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: 1 /* Error */, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1 /* Error */, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1 /* Error */, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1 /* Error */, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: 1 /* Error */, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1 /* Error */, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1 /* Error */, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: 1 /* Error */, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1 /* Error */, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1 /* Error */, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1 /* Error */, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2323, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: 1 /* Error */, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1 /* Error */, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: 1 /* Error */, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1 /* Error */, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1 /* Error */, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: 1 /* Error */, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: 1 /* Error */, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1 /* Error */, key: "'this' cannot be referenced in a module body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: 1 /* Error */, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1 /* Error */, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1 /* Error */, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1 /* Error */, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1 /* Error */, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1 /* Error */, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1 /* Error */, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: 1 /* Error */, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1 /* Error */, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1 /* Error */, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1 /* Error */, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1 /* Error */, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1 /* Error */, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1 /* Error */, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1 /* Error */, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1 /* Error */, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1 /* Error */, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1 /* Error */, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1 /* Error */, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1 /* Error */, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1 /* Error */, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1 /* Error */, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1 /* Error */, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1 /* Error */, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1 /* Error */, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1 /* Error */, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1 /* Error */, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1 /* Error */, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1 /* Error */, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: 1 /* Error */, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1 /* Error */, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1 /* Error */, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1 /* Error */, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1 /* Error */, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1 /* Error */, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: 1 /* Error */, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: 1 /* Error */, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1 /* Error */, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1 /* Error */, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1 /* Error */, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1 /* Error */, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1 /* Error */, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1 /* Error */, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1 /* Error */, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1 /* Error */, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1 /* Error */, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1 /* Error */, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: 1 /* Error */, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: 1 /* Error */, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: 1 /* Error */, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: 1 /* Error */, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1 /* Error */, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1 /* Error */, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: 1 /* Error */, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1 /* Error */, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1 /* Error */, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1 /* Error */, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: { code: 2397, category: 1 /* Error */, key: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter." }, - Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2398, category: 1 /* Error */, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1 /* Error */, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1 /* Error */, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1 /* Error */, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1 /* Error */, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1 /* Error */, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1 /* Error */, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1 /* Error */, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: 1 /* Error */, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1 /* Error */, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1 /* Error */, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1 /* Error */, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: 1 /* Error */, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1 /* Error */, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1 /* Error */, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1 /* Error */, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1 /* Error */, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1 /* Error */, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1 /* Error */, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1 /* Error */, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: 1 /* Error */, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1 /* Error */, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1 /* Error */, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: 1 /* Error */, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1 /* Error */, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1 /* Error */, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1 /* Error */, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1 /* Error */, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1 /* Error */, key: "Ambient external module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1 /* Error */, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: 1 /* Error */, key: "Import name cannot be '{0}'" }, - Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1 /* Error */, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1 /* Error */, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1 /* Error */, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1 /* Error */, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1 /* Error */, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1 /* Error */, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1 /* Error */, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1 /* Error */, key: "Block-scoped variable '{0}' used before its declaration.", isEarly: true }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1 /* Error */, key: "The operand of an increment or decrement operator cannot be a constant.", isEarly: true }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1 /* Error */, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1 /* Error */, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1 /* Error */, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1 /* Error */, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1 /* Error */, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: 1 /* Error */, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: 1 /* Error */, key: "Type alias name cannot be '{0}'" }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* Error */, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4003, category: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4005, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4007, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4009, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4011, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4013, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4015, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4017, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4018, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2: { code: 4021, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using name '{1}' from private module '{2}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1 /* Error */, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1 /* Error */, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1 /* Error */, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1 /* Error */, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1 /* Error */, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4079, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_type_alias_0_has_or_is_using_name_1_from_private_module_2: { code: 4080, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1 /* Error */, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1 /* Error */, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1 /* Error */, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - Index_expression_arguments_in_const_enums_must_be_of_type_string: { code: 4085, category: 1 /* Error */, key: "Index expression arguments in 'const' enums must be of type 'string'." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: 1 /* Error */, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1 /* Error */, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: 1 /* Error */, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: 1 /* Error */, key: "Unsupported file encoding." }, - Unknown_compiler_option_0: { code: 5023, category: 1 /* Error */, key: "Unknown compiler option '{0}'." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: 1 /* Error */, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1 /* Error */, key: "Option mapRoot cannot be specified without specifying sourcemap option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1 /* Error */, key: "Option sourceRoot cannot be specified without specifying sourcemap option." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2 /* Message */, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: 2 /* Message */, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2 /* 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: 2 /* Message */, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: 2 /* Message */, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: 2 /* Message */, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2 /* Message */, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_comments_to_output: { code: 6009, category: 2 /* Message */, key: "Do not emit comments to output." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2 /* Message */, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2 /* Message */, key: "Specify module code generation: 'commonjs' or 'amd'" }, - Print_this_message: { code: 6017, category: 2 /* Message */, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: 2 /* Message */, key: "Print the compiler's version." }, - Syntax_Colon_0: { code: 6023, category: 2 /* Message */, key: "Syntax: {0}" }, - options: { code: 6024, category: 2 /* Message */, key: "options" }, - file: { code: 6025, category: 2 /* Message */, key: "file" }, - Examples_Colon_0: { code: 6026, category: 2 /* Message */, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: 2 /* Message */, key: "Options:" }, - Version_0: { code: 6029, category: 2 /* Message */, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2 /* Message */, key: "Insert command line options and files from a file." }, - File_change_detected_Compiling: { code: 6032, category: 2 /* Message */, key: "File change detected. Compiling..." }, - KIND: { code: 6034, category: 2 /* Message */, key: "KIND" }, - FILE: { code: 6035, category: 2 /* Message */, key: "FILE" }, - VERSION: { code: 6036, category: 2 /* Message */, key: "VERSION" }, - LOCATION: { code: 6037, category: 2 /* Message */, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: 2 /* Message */, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2 /* Message */, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: 2 /* Message */, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: 1 /* Error */, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1 /* Error */, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1 /* Error */, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1 /* Error */, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1 /* Error */, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: 1 /* Error */, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: 1 /* Error */, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: 1 /* Error */, key: "Corrupted locale file {0}." }, - Warn_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2 /* Message */, key: "Warn on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: 1 /* Error */, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1 /* Error */, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1 /* Error */, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1 /* Error */, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: 1 /* Error */, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1 /* Error */, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1 /* Error */, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1 /* Error */, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1 /* Error */, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1 /* Error */, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1 /* Error */, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1 /* Error */, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1 /* Error */, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." } - }; -})(ts || (ts = {})); -var ts; -(function (ts) { - var textToToken = { - "any": 109 /* AnyKeyword */, - "boolean": 110 /* BooleanKeyword */, - "break": 64 /* BreakKeyword */, - "case": 65 /* CaseKeyword */, - "catch": 66 /* CatchKeyword */, - "class": 67 /* ClassKeyword */, - "continue": 69 /* ContinueKeyword */, - "const": 68 /* ConstKeyword */, - "constructor": 111 /* ConstructorKeyword */, - "debugger": 70 /* DebuggerKeyword */, - "declare": 112 /* DeclareKeyword */, - "default": 71 /* DefaultKeyword */, - "delete": 72 /* DeleteKeyword */, - "do": 73 /* DoKeyword */, - "else": 74 /* ElseKeyword */, - "enum": 75 /* EnumKeyword */, - "export": 76 /* ExportKeyword */, - "extends": 77 /* ExtendsKeyword */, - "false": 78 /* FalseKeyword */, - "finally": 79 /* FinallyKeyword */, - "for": 80 /* ForKeyword */, - "function": 81 /* FunctionKeyword */, - "get": 113 /* GetKeyword */, - "if": 82 /* IfKeyword */, - "implements": 100 /* ImplementsKeyword */, - "import": 83 /* ImportKeyword */, - "in": 84 /* InKeyword */, - "instanceof": 85 /* InstanceOfKeyword */, - "interface": 101 /* InterfaceKeyword */, - "let": 102 /* LetKeyword */, - "module": 114 /* ModuleKeyword */, - "new": 86 /* NewKeyword */, - "null": 87 /* NullKeyword */, - "number": 116 /* NumberKeyword */, - "package": 103 /* PackageKeyword */, - "private": 104 /* PrivateKeyword */, - "protected": 105 /* ProtectedKeyword */, - "public": 106 /* PublicKeyword */, - "require": 115 /* RequireKeyword */, - "return": 88 /* ReturnKeyword */, - "set": 117 /* SetKeyword */, - "static": 107 /* StaticKeyword */, - "string": 118 /* StringKeyword */, - "super": 89 /* SuperKeyword */, - "switch": 90 /* SwitchKeyword */, - "this": 91 /* ThisKeyword */, - "throw": 92 /* ThrowKeyword */, - "true": 93 /* TrueKeyword */, - "try": 94 /* TryKeyword */, - "type": 119 /* TypeKeyword */, - "typeof": 95 /* TypeOfKeyword */, - "var": 96 /* VarKeyword */, - "void": 97 /* VoidKeyword */, - "while": 98 /* WhileKeyword */, - "with": 99 /* WithKeyword */, - "yield": 108 /* YieldKeyword */, - "{": 13 /* OpenBraceToken */, - "}": 14 /* CloseBraceToken */, - "(": 15 /* OpenParenToken */, - ")": 16 /* CloseParenToken */, - "[": 17 /* OpenBracketToken */, - "]": 18 /* CloseBracketToken */, - ".": 19 /* DotToken */, - "...": 20 /* DotDotDotToken */, - ";": 21 /* SemicolonToken */, - ",": 22 /* CommaToken */, - "<": 23 /* LessThanToken */, - ">": 24 /* GreaterThanToken */, - "<=": 25 /* LessThanEqualsToken */, - ">=": 26 /* GreaterThanEqualsToken */, - "==": 27 /* EqualsEqualsToken */, - "!=": 28 /* ExclamationEqualsToken */, - "===": 29 /* EqualsEqualsEqualsToken */, - "!==": 30 /* ExclamationEqualsEqualsToken */, - "=>": 31 /* EqualsGreaterThanToken */, - "+": 32 /* PlusToken */, - "-": 33 /* MinusToken */, - "*": 34 /* AsteriskToken */, - "/": 35 /* SlashToken */, - "%": 36 /* PercentToken */, - "++": 37 /* PlusPlusToken */, - "--": 38 /* MinusMinusToken */, - "<<": 39 /* LessThanLessThanToken */, - ">>": 40 /* GreaterThanGreaterThanToken */, - ">>>": 41 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 42 /* AmpersandToken */, - "|": 43 /* BarToken */, - "^": 44 /* CaretToken */, - "!": 45 /* ExclamationToken */, - "~": 46 /* TildeToken */, - "&&": 47 /* AmpersandAmpersandToken */, - "||": 48 /* BarBarToken */, - "?": 49 /* QuestionToken */, - ":": 50 /* ColonToken */, - "=": 51 /* EqualsToken */, - "+=": 52 /* PlusEqualsToken */, - "-=": 53 /* MinusEqualsToken */, - "*=": 54 /* AsteriskEqualsToken */, - "/=": 55 /* SlashEqualsToken */, - "%=": 56 /* PercentEqualsToken */, - "<<=": 57 /* LessThanLessThanEqualsToken */, - ">>=": 58 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 60 /* AmpersandEqualsToken */, - "|=": 61 /* BarEqualsToken */, - "^=": 62 /* CaretEqualsToken */ - }; - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - function lookupInUnicodeMap(code, map) { - if (code < map[0]) { - return false; - } - var lo = 0; - var hi = map.length; - var mid; - while (lo + 1 < hi) { - mid = lo + (hi - lo) / 2; - mid -= mid % 2; - if (map[mid] <= code && code <= map[mid + 1]) { - return true; - } - if (code < map[mid]) { - hi = mid; - } - else { - lo = mid + 2; - } - } - return false; - } - function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierStart) : lookupInUnicodeMap(code, unicodeES5IdentifierStart); - } - function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierPart) : lookupInUnicodeMap(code, unicodeES5IdentifierPart); - } - function makeReverseMap(source) { - var result = []; - for (var name in source) { - if (source.hasOwnProperty(name)) { - result[source[name]] = name; - } - } - return result; - } - var tokenStrings = makeReverseMap(textToToken); - function tokenToString(t) { - return tokenStrings[t]; - } - ts.tokenToString = tokenToString; - function getLineStarts(text) { - var result = new Array(); - var pos = 0; - var lineStart = 0; - while (pos < text.length) { - var ch = text.charCodeAt(pos++); - switch (ch) { - case 13 /* carriageReturn */: - if (text.charCodeAt(pos) === 10 /* lineFeed */) { - pos++; - } - case 10 /* lineFeed */: - result.push(lineStart); - lineStart = pos; - break; - default: - if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) { - result.push(lineStart); - lineStart = pos; - } - break; - } - } - result.push(lineStart); - return result; - } - ts.getLineStarts = getLineStarts; - function getPositionFromLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line > 0); - return lineStarts[line - 1] + character - 1; - } - ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; - function getLineAndCharacterOfPosition(lineStarts, position) { - var lineNumber = ts.binarySearch(lineStarts, position); - if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; - } - return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 - }; - } - ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - function positionToLineAndCharacter(text, pos) { - var lineStarts = getLineStarts(text); - return getLineAndCharacterOfPosition(lineStarts, pos); - } - ts.positionToLineAndCharacter = positionToLineAndCharacter; - var hasOwnProperty = Object.prototype.hasOwnProperty; - function isWhiteSpace(ch) { - return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; - } - ts.isWhiteSpace = isWhiteSpace; - function isLineBreak(ch) { - return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */ || ch === 133 /* nextLine */; - } - ts.isLineBreak = isLineBreak; - function isDigit(ch) { - return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; - } - function isOctalDigit(ch) { - return ch >= 48 /* _0 */ && ch <= 55 /* _7 */; - } - ts.isOctalDigit = isOctalDigit; - function skipTrivia(text, pos, stopAfterLineBreak) { - while (true) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13 /* carriageReturn */: - if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) - pos++; - case 10 /* lineFeed */: - pos++; - if (stopAfterLineBreak) - return pos; - continue; - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 32 /* space */: - pos++; - continue; - case 47 /* slash */: - if (text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - while (pos < text.length) { - if (isLineBreak(text.charCodeAt(pos))) { - break; - } - pos++; - } - continue; - } - if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { - pos += 2; - while (pos < text.length) { - if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - break; - } - pos++; - } - continue; - } - break; - default: - if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { - pos++; - continue; - } - break; - } - return pos; - } - } - ts.skipTrivia = skipTrivia; - function getCommentRanges(text, pos, trailing) { - var result; - var collecting = trailing || pos === 0; - while (true) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13 /* carriageReturn */: - if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) - pos++; - case 10 /* lineFeed */: - pos++; - if (trailing) { - return result; - } - collecting = true; - if (result && result.length) { - result[result.length - 1].hasTrailingNewLine = true; - } - continue; - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 32 /* space */: - pos++; - continue; - case 47 /* slash */: - var nextChar = text.charCodeAt(pos + 1); - var hasTrailingNewLine = false; - if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) { - var startPos = pos; - pos += 2; - if (nextChar === 47 /* slash */) { - while (pos < text.length) { - if (isLineBreak(text.charCodeAt(pos))) { - hasTrailingNewLine = true; - break; - } - pos++; - } - } - else { - while (pos < text.length) { - if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - break; - } - pos++; - } - } - if (collecting) { - if (!result) - result = []; - result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); - } - continue; - } - break; - default: - if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { - if (result && result.length && isLineBreak(ch)) { - result[result.length - 1].hasTrailingNewLine = true; - } - pos++; - continue; - } - break; - } - return result; - } - } - function getLeadingCommentRanges(text, pos) { - return getCommentRanges(text, pos, false); - } - ts.getLeadingCommentRanges = getLeadingCommentRanges; - function getTrailingCommentRanges(text, pos) { - return getCommentRanges(text, pos, true); - } - ts.getTrailingCommentRanges = getTrailingCommentRanges; - function isIdentifierStart(ch, languageVersion) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); - } - ts.isIdentifierStart = isIdentifierStart; - function isIdentifierPart(ch, languageVersion) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); - } - ts.isIdentifierPart = isIdentifierPart; - function createScanner(languageVersion, skipTrivia, text, onError, onComment) { - var pos; - var len; - var startPos; - var tokenPos; - var token; - var tokenValue; - var precedingLineBreak; - function error(message) { - if (onError) { - onError(message); - } - } - function isIdentifierStart(ch) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); - } - function isIdentifierPart(ch) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); - } - function scanNumber() { - var start = pos; - while (isDigit(text.charCodeAt(pos))) - pos++; - if (text.charCodeAt(pos) === 46 /* dot */) { - pos++; - while (isDigit(text.charCodeAt(pos))) - pos++; - } - var end = pos; - if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) { - pos++; - if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) - pos++; - if (isDigit(text.charCodeAt(pos))) { - pos++; - while (isDigit(text.charCodeAt(pos))) - pos++; - end = pos; - } - else { - error(ts.Diagnostics.Digit_expected); - } - } - return +(text.substring(start, end)); - } - function scanOctalDigits() { - var start = pos; - while (isOctalDigit(text.charCodeAt(pos))) { - pos++; - } - return +(text.substring(start, pos)); - } - function scanHexDigits(count, mustMatchCount) { - var digits = 0; - var value = 0; - while (digits < count || !mustMatchCount) { - var ch = text.charCodeAt(pos); - if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { - value = value * 16 + ch - 48 /* _0 */; - } - else if (ch >= 65 /* A */ && ch <= 70 /* F */) { - value = value * 16 + ch - 65 /* A */ + 10; - } - else if (ch >= 97 /* a */ && ch <= 102 /* f */) { - value = value * 16 + ch - 97 /* a */ + 10; - } - else { - break; - } - pos++; - digits++; - } - if (digits < count) { - value = -1; - } - return value; - } - function scanString() { - var quote = text.charCodeAt(pos++); - var result = ""; - var start = pos; - while (true) { - if (pos >= len) { - result += text.substring(start, pos); - error(ts.Diagnostics.Unexpected_end_of_text); - break; - } - var ch = text.charCodeAt(pos); - if (ch === quote) { - result += text.substring(start, pos); - pos++; - break; - } - if (ch === 92 /* backslash */) { - result += text.substring(start, pos); - result += scanEscapeSequence(); - start = pos; - continue; - } - if (isLineBreak(ch)) { - result += text.substring(start, pos); - error(ts.Diagnostics.Unterminated_string_literal); - break; - } - pos++; - } - return result; - } - function scanTemplateAndSetTokenValue() { - var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; - pos++; - var start = pos; - var contents = ""; - var resultingToken; - while (true) { - if (pos >= len) { - contents += text.substring(start, pos); - error(ts.Diagnostics.Unexpected_end_of_text); - resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; - break; - } - var currChar = text.charCodeAt(pos); - if (currChar === 96 /* backtick */) { - contents += text.substring(start, pos); - pos++; - resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; - break; - } - if (currChar === 36 /* $ */ && pos + 1 < len && text.charCodeAt(pos + 1) === 123 /* openBrace */) { - contents += text.substring(start, pos); - pos += 2; - resultingToken = startedWithBacktick ? 10 /* TemplateHead */ : 11 /* TemplateMiddle */; - break; - } - if (currChar === 92 /* backslash */) { - contents += text.substring(start, pos); - contents += scanEscapeSequence(); - start = pos; - continue; - } - if (currChar === 13 /* carriageReturn */) { - contents += text.substring(start, pos); - if (pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { - pos++; - } - pos++; - contents += "\n"; - start = pos; - continue; - } - pos++; - } - ts.Debug.assert(resultingToken !== undefined); - tokenValue = contents; - return resultingToken; - } - function scanEscapeSequence() { - pos++; - if (pos >= len) { - error(ts.Diagnostics.Unexpected_end_of_text); - return ""; - } - var ch = text.charCodeAt(pos++); - switch (ch) { - case 48 /* _0 */: - return "\0"; - case 98 /* b */: - return "\b"; - case 116 /* t */: - return "\t"; - case 110 /* n */: - return "\n"; - case 118 /* v */: - return "\v"; - case 102 /* f */: - return "\f"; - case 114 /* r */: - return "\r"; - case 39 /* singleQuote */: - return "\'"; - case 34 /* doubleQuote */: - return "\""; - case 120 /* x */: - case 117 /* u */: - var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); - if (ch >= 0) { - return String.fromCharCode(ch); - } - else { - error(ts.Diagnostics.Hexadecimal_digit_expected); - return ""; - } - case 13 /* carriageReturn */: - if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { - pos++; - } - case 10 /* lineFeed */: - case 8232 /* lineSeparator */: - case 8233 /* paragraphSeparator */: - return ""; - default: - return String.fromCharCode(ch); - } - } - function peekUnicodeEscape() { - if (pos + 5 < len && text.charCodeAt(pos + 1) === 117 /* u */) { - var start = pos; - pos += 2; - var value = scanHexDigits(4, true); - pos = start; - return value; - } - return -1; - } - function scanIdentifierParts() { - var result = ""; - var start = pos; - while (pos < len) { - var ch = text.charCodeAt(pos); - if (isIdentifierPart(ch)) { - pos++; - } - else if (ch === 92 /* backslash */) { - ch = peekUnicodeEscape(); - if (!(ch >= 0 && isIdentifierPart(ch))) { - break; - } - result += text.substring(start, pos); - result += String.fromCharCode(ch); - pos += 6; - start = pos; - } - else { - break; - } - } - result += text.substring(start, pos); - return result; - } - function getIdentifierToken() { - var len = tokenValue.length; - if (len >= 2 && len <= 11) { - var ch = tokenValue.charCodeAt(0); - if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; - } - } - return token = 63 /* Identifier */; - } - function scan() { - startPos = pos; - precedingLineBreak = false; - while (true) { - tokenPos = pos; - if (pos >= len) { - return token = 1 /* EndOfFileToken */; - } - var ch = text.charCodeAt(pos); - switch (ch) { - case 10 /* lineFeed */: - case 13 /* carriageReturn */: - precedingLineBreak = true; - if (skipTrivia) { - pos++; - continue; - } - else { - if (ch === 13 /* carriageReturn */ && pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { - pos += 2; - } - else { - pos++; - } - return token = 4 /* NewLineTrivia */; - } - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 32 /* space */: - if (skipTrivia) { - pos++; - continue; - } - else { - while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { - pos++; - } - return token = 5 /* WhitespaceTrivia */; - } - case 33 /* exclamation */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 30 /* ExclamationEqualsEqualsToken */; - } - return pos += 2, token = 28 /* ExclamationEqualsToken */; - } - return pos++, token = 45 /* ExclamationToken */; - case 34 /* doubleQuote */: - case 39 /* singleQuote */: - tokenValue = scanString(); - return token = 7 /* StringLiteral */; - case 96 /* backtick */: - return token = scanTemplateAndSetTokenValue(); - case 37 /* percent */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 56 /* PercentEqualsToken */; - } - return pos++, token = 36 /* PercentToken */; - case 38 /* ampersand */: - if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 47 /* AmpersandAmpersandToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 60 /* AmpersandEqualsToken */; - } - return pos++, token = 42 /* AmpersandToken */; - case 40 /* openParen */: - return pos++, token = 15 /* OpenParenToken */; - case 41 /* closeParen */: - return pos++, token = 16 /* CloseParenToken */; - case 42 /* asterisk */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 54 /* AsteriskEqualsToken */; - } - return pos++, token = 34 /* AsteriskToken */; - case 43 /* plus */: - if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 37 /* PlusPlusToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 52 /* PlusEqualsToken */; - } - return pos++, token = 32 /* PlusToken */; - case 44 /* comma */: - return pos++, token = 22 /* CommaToken */; - case 45 /* minus */: - if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 38 /* MinusMinusToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 53 /* MinusEqualsToken */; - } - return pos++, token = 33 /* MinusToken */; - case 46 /* dot */: - if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanNumber(); - return token = 6 /* NumericLiteral */; - } - if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 20 /* DotDotDotToken */; - } - return pos++, token = 19 /* DotToken */; - case 47 /* slash */: - if (text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - while (pos < len) { - if (isLineBreak(text.charCodeAt(pos))) { - break; - } - pos++; - } - if (onComment) { - onComment(tokenPos, pos); - } - if (skipTrivia) { - continue; - } - else { - return token = 2 /* SingleLineCommentTrivia */; - } - } - if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { - pos += 2; - var commentClosed = false; - while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { - pos += 2; - commentClosed = true; - break; - } - if (isLineBreak(ch)) { - precedingLineBreak = true; - } - pos++; - } - if (!commentClosed) { - error(ts.Diagnostics.Asterisk_Slash_expected); - } - if (onComment) { - onComment(tokenPos, pos); - } - if (skipTrivia) { - continue; - } - else { - return token = 3 /* MultiLineCommentTrivia */; - } - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 55 /* SlashEqualsToken */; - } - return pos++, token = 35 /* SlashToken */; - case 48 /* _0 */: - if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { - pos += 2; - var value = scanHexDigits(1, false); - if (value < 0) { - error(ts.Diagnostics.Hexadecimal_digit_expected); - value = 0; - } - tokenValue = "" + value; - return 6 /* NumericLiteral */; - } - if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanOctalDigits(); - return 6 /* NumericLiteral */; - } - case 49 /* _1 */: - case 50 /* _2 */: - case 51 /* _3 */: - case 52 /* _4 */: - case 53 /* _5 */: - case 54 /* _6 */: - case 55 /* _7 */: - case 56 /* _8 */: - case 57 /* _9 */: - tokenValue = "" + scanNumber(); - return token = 6 /* NumericLiteral */; - case 58 /* colon */: - return pos++, token = 50 /* ColonToken */; - case 59 /* semicolon */: - return pos++, token = 21 /* SemicolonToken */; - case 60 /* lessThan */: - if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 57 /* LessThanLessThanEqualsToken */; - } - return pos += 2, token = 39 /* LessThanLessThanToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 25 /* LessThanEqualsToken */; - } - return pos++, token = 23 /* LessThanToken */; - case 61 /* equals */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 29 /* EqualsEqualsEqualsToken */; - } - return pos += 2, token = 27 /* EqualsEqualsToken */; - } - if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 31 /* EqualsGreaterThanToken */; - } - return pos++, token = 51 /* EqualsToken */; - case 62 /* greaterThan */: - return pos++, token = 24 /* GreaterThanToken */; - case 63 /* question */: - return pos++, token = 49 /* QuestionToken */; - case 91 /* openBracket */: - return pos++, token = 17 /* OpenBracketToken */; - case 93 /* closeBracket */: - return pos++, token = 18 /* CloseBracketToken */; - case 94 /* caret */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 62 /* CaretEqualsToken */; - } - return pos++, token = 44 /* CaretToken */; - case 123 /* openBrace */: - return pos++, token = 13 /* OpenBraceToken */; - case 124 /* bar */: - if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 48 /* BarBarToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 61 /* BarEqualsToken */; - } - return pos++, token = 43 /* BarToken */; - case 125 /* closeBrace */: - return pos++, token = 14 /* CloseBraceToken */; - case 126 /* tilde */: - return pos++, token = 46 /* TildeToken */; - case 92 /* backslash */: - var ch = peekUnicodeEscape(); - if (ch >= 0 && isIdentifierStart(ch)) { - pos += 6; - tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); - return token = getIdentifierToken(); - } - error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; - default: - if (isIdentifierStart(ch)) { - pos++; - while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) - pos++; - tokenValue = text.substring(tokenPos, pos); - if (ch === 92 /* backslash */) { - tokenValue += scanIdentifierParts(); - } - return token = getIdentifierToken(); - } - else if (isWhiteSpace(ch)) { - pos++; - continue; - } - else if (isLineBreak(ch)) { - precedingLineBreak = true; - pos++; - continue; - } - error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; - } - } - } - function reScanGreaterToken() { - if (token === 24 /* GreaterThanToken */) { - if (text.charCodeAt(pos) === 62 /* greaterThan */) { - if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */; - } - return pos += 2, token = 41 /* GreaterThanGreaterThanGreaterThanToken */; - } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 58 /* GreaterThanGreaterThanEqualsToken */; - } - return pos++, token = 40 /* GreaterThanGreaterThanToken */; - } - if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 26 /* GreaterThanEqualsToken */; - } - } - return token; - } - function reScanSlashToken() { - if (token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) { - var p = tokenPos + 1; - var inEscape = false; - var inCharacterClass = false; - while (true) { - if (p >= len) { - return token; - } - var ch = text.charCodeAt(p); - if (isLineBreak(ch)) { - return token; - } - if (inEscape) { - inEscape = false; - } - else if (ch === 47 /* slash */ && !inCharacterClass) { - break; - } - else if (ch === 91 /* openBracket */) { - inCharacterClass = true; - } - else if (ch === 92 /* backslash */) { - inEscape = true; - } - else if (ch === 93 /* closeBracket */) { - inCharacterClass = false; - } - p++; - } - p++; - while (isIdentifierPart(text.charCodeAt(p))) { - p++; - } - pos = p; - tokenValue = text.substring(tokenPos, pos); - token = 8 /* RegularExpressionLiteral */; - } - return token; - } - function reScanTemplateToken() { - ts.Debug.assert(token === 14 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); - pos = tokenPos; - return token = scanTemplateAndSetTokenValue(); - } - function tryScan(callback) { - var savePos = pos; - var saveStartPos = startPos; - var saveTokenPos = tokenPos; - var saveToken = token; - var saveTokenValue = tokenValue; - var savePrecedingLineBreak = precedingLineBreak; - var result = callback(); - if (!result) { - pos = savePos; - startPos = saveStartPos; - tokenPos = saveTokenPos; - token = saveToken; - tokenValue = saveTokenValue; - precedingLineBreak = savePrecedingLineBreak; - } - return result; - } - function setText(newText) { - text = newText || ""; - len = text.length; - setTextPos(0); - } - function setTextPos(textPos) { - pos = textPos; - startPos = textPos; - tokenPos = textPos; - token = 0 /* Unknown */; - precedingLineBreak = false; - } - setText(text); - return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 63 /* Identifier */ || token > 99 /* LastReservedWord */; }, - isReservedWord: function () { return token >= 64 /* FirstReservedWord */ && token <= 99 /* LastReservedWord */; }, - reScanGreaterToken: reScanGreaterToken, - reScanSlashToken: reScanSlashToken, - reScanTemplateToken: reScanTemplateToken, - scan: scan, - setText: setText, - setTextPos: setTextPos, - tryScan: tryScan - }; - } - ts.createScanner = createScanner; -})(ts || (ts = {})); var ts; (function (ts) { (function (EmitReturnStatus) { @@ -1545,6 +130,13 @@ var ts; return result; } ts.sum = sum; + function lastOrUndefined(array) { + if (array.length === 0) { + return undefined; + } + return array[array.length - 1]; + } + ts.lastOrUndefined = lastOrUndefined; function binarySearch(array, value) { var low = 0; var high = array.length - 1; @@ -1997,7 +589,1428 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(196 /* Count */); + ts.Diagnostics = { + Unterminated_string_literal: { code: 1002, category: 1 /* Error */, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1 /* Error */, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1 /* Error */, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1 /* Error */, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1 /* Error */, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1 /* Error */, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1 /* Error */, key: "Unexpected token." }, + Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1 /* Error */, key: "Catch clause parameter cannot have a type annotation." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1 /* Error */, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1 /* Error */, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1 /* Error */, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1 /* Error */, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1 /* Error */, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1 /* Error */, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1 /* Error */, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1 /* Error */, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1 /* Error */, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1 /* Error */, key: "An index signature parameter type must be 'string' or 'number'." }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1 /* Error */, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1 /* Error */, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1 /* Error */, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1 /* Error */, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1 /* Error */, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1 /* Error */, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1 /* Error */, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1 /* Error */, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1 /* Error */, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1 /* Error */, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1 /* Error */, key: "Statements are not allowed in ambient contexts." }, + A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: 1 /* Error */, key: "A function implementation cannot be declared in an ambient context." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1 /* Error */, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1 /* Error */, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1 /* Error */, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: 1 /* Error */, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1 /* Error */, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1 /* Error */, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1 /* Error */, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1 /* Error */, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1 /* Error */, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1 /* Error */, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1 /* Error */, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1 /* Error */, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1 /* Error */, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1 /* Error */, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1 /* Error */, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1 /* Error */, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1 /* Error */, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1 /* Error */, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1 /* Error */, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1 /* Error */, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1 /* Error */, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1 /* Error */, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1 /* Error */, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1 /* Error */, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1 /* Error */, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1 /* Error */, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1 /* Error */, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1 /* Error */, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1 /* Error */, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1 /* Error */, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1 /* Error */, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1 /* Error */, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1 /* Error */, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1 /* Error */, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1 /* Error */, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1 /* Error */, key: "Type expected." }, + A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: 1 /* Error */, key: "A constructor implementation cannot be declared in an ambient context." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1 /* Error */, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1 /* Error */, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1 /* Error */, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1 /* Error */, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1 /* Error */, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1 /* Error */, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1 /* Error */, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1 /* Error */, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1 /* Error */, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1 /* Error */, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1 /* Error */, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1 /* Error */, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1 /* Error */, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1 /* Error */, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1 /* Error */, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1 /* Error */, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1 /* Error */, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1 /* Error */, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1 /* Error */, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1 /* Error */, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1 /* Error */, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1 /* Error */, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1 /* Error */, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1 /* Error */, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1 /* Error */, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1 /* Error */, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1 /* Error */, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1 /* Error */, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1 /* Error */, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1 /* Error */, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1 /* Error */, key: "Line break not permitted here." }, + catch_or_finally_expected: { code: 1143, category: 1 /* Error */, key: "'catch' or 'finally' expected." }, + Block_or_expected: { code: 1144, category: 1 /* Error */, key: "Block or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1 /* Error */, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1 /* Error */, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1 /* Error */, key: "Import declarations in an internal module cannot reference an external module." }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1 /* Error */, key: "Cannot compile external modules unless the '--module' flag is provided." }, + Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: 1 /* Error */, key: "Filename '{0}' differs from already included filename '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1 /* Error */, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1 /* Error */, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1 /* Error */, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1 /* Error */, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1 /* Error */, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1 /* Error */, key: "'let' declarations can only be declared inside a block." }, + Invalid_template_literal_expected: { code: 1158, category: 1 /* Error */, key: "Invalid template literal; expected '}'" }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1 /* Error */, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, + Unterminated_template_literal: { code: 1160, category: 1 /* Error */, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1 /* Error */, key: "Unterminated regular expression literal." }, + A_object_member_cannot_be_declared_optional: { code: 1160, category: 1 /* Error */, key: "A object member cannot be declared optional." }, + Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* Error */, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, + Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1 /* Error */, key: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1 /* Error */, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1 /* Error */, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1 /* Error */, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1 /* Error */, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1 /* Error */, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1 /* Error */, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1 /* Error */, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1 /* Error */, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1 /* Error */, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1 /* Error */, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1 /* Error */, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1 /* Error */, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1 /* Error */, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1 /* Error */, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1 /* Error */, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1 /* Error */, key: "Cannot find global type '{0}'." }, + Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1 /* Error */, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1 /* Error */, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1 /* Error */, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1 /* Error */, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1 /* Error */, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1 /* Error */, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1 /* Error */, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1 /* Error */, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1 /* Error */, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1 /* Error */, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1 /* Error */, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1 /* Error */, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1 /* Error */, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1 /* Error */, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1 /* Error */, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1 /* Error */, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1 /* Error */, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1 /* Error */, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1 /* Error */, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1 /* Error */, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1 /* Error */, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1 /* Error */, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1 /* Error */, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1 /* Error */, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1 /* Error */, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1 /* Error */, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1 /* Error */, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1 /* Error */, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1 /* Error */, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1 /* Error */, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1 /* Error */, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1 /* Error */, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1 /* Error */, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1 /* Error */, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1 /* Error */, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1 /* Error */, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1 /* Error */, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1 /* Error */, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1 /* Error */, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1 /* Error */, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1 /* Error */, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1 /* Error */, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1 /* Error */, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1 /* Error */, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1 /* Error */, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1 /* Error */, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1 /* Error */, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1 /* Error */, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1 /* Error */, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1 /* Error */, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1 /* Error */, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1 /* Error */, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1 /* Error */, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1 /* Error */, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1 /* Error */, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1 /* Error */, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1 /* Error */, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1 /* Error */, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1 /* Error */, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1 /* Error */, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1 /* Error */, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1 /* Error */, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1 /* Error */, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1 /* Error */, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1 /* Error */, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1 /* Error */, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1 /* Error */, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1 /* Error */, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: { code: 2397, category: 1 /* Error */, key: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter." }, + Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2398, category: 1 /* Error */, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1 /* Error */, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1 /* Error */, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1 /* Error */, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1 /* Error */, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1 /* Error */, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1 /* Error */, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1 /* Error */, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1 /* Error */, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1 /* Error */, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1 /* Error */, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1 /* Error */, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1 /* Error */, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1 /* Error */, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1 /* Error */, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1 /* Error */, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1 /* Error */, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1 /* Error */, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1 /* Error */, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1 /* Error */, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1 /* Error */, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1 /* Error */, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1 /* Error */, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1 /* Error */, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1 /* Error */, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1 /* Error */, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1 /* Error */, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1 /* Error */, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1 /* Error */, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1 /* Error */, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1 /* Error */, key: "Import name cannot be '{0}'" }, + Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1 /* Error */, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1 /* Error */, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1 /* Error */, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1 /* Error */, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1 /* Error */, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1 /* Error */, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1 /* Error */, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1 /* Error */, key: "Block-scoped variable '{0}' used before its declaration.", isEarly: true }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1 /* Error */, key: "The operand of an increment or decrement operator cannot be a constant.", isEarly: true }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1 /* Error */, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1 /* Error */, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1 /* Error */, key: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1 /* Error */, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1 /* Error */, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1 /* Error */, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1 /* Error */, key: "Type alias name cannot be '{0}'" }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* Error */, key: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4003, category: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4005, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4007, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4009, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4011, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4013, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4015, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4017, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4018, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2: { code: 4021, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using name '{1}' from private module '{2}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1 /* Error */, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1 /* Error */, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1 /* Error */, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1 /* Error */, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1 /* Error */, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4079, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_type_alias_0_has_or_is_using_name_1_from_private_module_2: { code: 4080, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1 /* Error */, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1 /* Error */, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1 /* Error */, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + Index_expression_arguments_in_const_enums_must_be_of_type_string: { code: 4085, category: 1 /* Error */, key: "Index expression arguments in 'const' enums must be of type 'string'." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: 1 /* Error */, key: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1 /* Error */, key: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: 1 /* Error */, key: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: 1 /* Error */, key: "Unsupported file encoding." }, + Unknown_compiler_option_0: { code: 5023, category: 1 /* Error */, key: "Unknown compiler option '{0}'." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: 1 /* Error */, key: "Could not write file '{0}': {1}" }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1 /* Error */, key: "Option mapRoot cannot be specified without specifying sourcemap option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1 /* Error */, key: "Option sourceRoot cannot be specified without specifying sourcemap option." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2 /* Message */, key: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: 2 /* Message */, key: "Generates corresponding '.d.ts' file." }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2 /* 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: 2 /* Message */, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2 /* Message */, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2 /* Message */, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2 /* Message */, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2 /* Message */, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2 /* Message */, key: "Do not emit comments to output." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2 /* Message */, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2 /* Message */, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Print_this_message: { code: 6017, category: 2 /* Message */, key: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: 2 /* Message */, key: "Print the compiler's version." }, + Syntax_Colon_0: { code: 6023, category: 2 /* Message */, key: "Syntax: {0}" }, + options: { code: 6024, category: 2 /* Message */, key: "options" }, + file: { code: 6025, category: 2 /* Message */, key: "file" }, + Examples_Colon_0: { code: 6026, category: 2 /* Message */, key: "Examples: {0}" }, + Options_Colon: { code: 6027, category: 2 /* Message */, key: "Options:" }, + Version_0: { code: 6029, category: 2 /* Message */, key: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2 /* Message */, key: "Insert command line options and files from a file." }, + File_change_detected_Compiling: { code: 6032, category: 2 /* Message */, key: "File change detected. Compiling..." }, + KIND: { code: 6034, category: 2 /* Message */, key: "KIND" }, + FILE: { code: 6035, category: 2 /* Message */, key: "FILE" }, + VERSION: { code: 6036, category: 2 /* Message */, key: "VERSION" }, + LOCATION: { code: 6037, category: 2 /* Message */, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2 /* Message */, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2 /* Message */, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2 /* Message */, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1 /* Error */, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1 /* Error */, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1 /* Error */, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1 /* Error */, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1 /* Error */, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: 1 /* Error */, key: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: 1 /* Error */, key: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: 1 /* Error */, key: "Corrupted locale file {0}." }, + Warn_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2 /* Message */, key: "Warn on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: 1 /* Error */, key: "File '{0}' not found." }, + File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1 /* Error */, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1 /* Error */, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1 /* Error */, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1 /* Error */, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1 /* Error */, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1 /* Error */, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1 /* Error */, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1 /* Error */, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1 /* Error */, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1 /* Error */, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1 /* Error */, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1 /* Error */, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." } + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + var textToToken = { + "any": 109 /* AnyKeyword */, + "boolean": 110 /* BooleanKeyword */, + "break": 64 /* BreakKeyword */, + "case": 65 /* CaseKeyword */, + "catch": 66 /* CatchKeyword */, + "class": 67 /* ClassKeyword */, + "continue": 69 /* ContinueKeyword */, + "const": 68 /* ConstKeyword */, + "constructor": 111 /* ConstructorKeyword */, + "debugger": 70 /* DebuggerKeyword */, + "declare": 112 /* DeclareKeyword */, + "default": 71 /* DefaultKeyword */, + "delete": 72 /* DeleteKeyword */, + "do": 73 /* DoKeyword */, + "else": 74 /* ElseKeyword */, + "enum": 75 /* EnumKeyword */, + "export": 76 /* ExportKeyword */, + "extends": 77 /* ExtendsKeyword */, + "false": 78 /* FalseKeyword */, + "finally": 79 /* FinallyKeyword */, + "for": 80 /* ForKeyword */, + "function": 81 /* FunctionKeyword */, + "get": 113 /* GetKeyword */, + "if": 82 /* IfKeyword */, + "implements": 100 /* ImplementsKeyword */, + "import": 83 /* ImportKeyword */, + "in": 84 /* InKeyword */, + "instanceof": 85 /* InstanceOfKeyword */, + "interface": 101 /* InterfaceKeyword */, + "let": 102 /* LetKeyword */, + "module": 114 /* ModuleKeyword */, + "new": 86 /* NewKeyword */, + "null": 87 /* NullKeyword */, + "number": 116 /* NumberKeyword */, + "package": 103 /* PackageKeyword */, + "private": 104 /* PrivateKeyword */, + "protected": 105 /* ProtectedKeyword */, + "public": 106 /* PublicKeyword */, + "require": 115 /* RequireKeyword */, + "return": 88 /* ReturnKeyword */, + "set": 117 /* SetKeyword */, + "static": 107 /* StaticKeyword */, + "string": 118 /* StringKeyword */, + "super": 89 /* SuperKeyword */, + "switch": 90 /* SwitchKeyword */, + "this": 91 /* ThisKeyword */, + "throw": 92 /* ThrowKeyword */, + "true": 93 /* TrueKeyword */, + "try": 94 /* TryKeyword */, + "type": 119 /* TypeKeyword */, + "typeof": 95 /* TypeOfKeyword */, + "var": 96 /* VarKeyword */, + "void": 97 /* VoidKeyword */, + "while": 98 /* WhileKeyword */, + "with": 99 /* WithKeyword */, + "yield": 108 /* YieldKeyword */, + "{": 13 /* OpenBraceToken */, + "}": 14 /* CloseBraceToken */, + "(": 15 /* OpenParenToken */, + ")": 16 /* CloseParenToken */, + "[": 17 /* OpenBracketToken */, + "]": 18 /* CloseBracketToken */, + ".": 19 /* DotToken */, + "...": 20 /* DotDotDotToken */, + ";": 21 /* SemicolonToken */, + ",": 22 /* CommaToken */, + "<": 23 /* LessThanToken */, + ">": 24 /* GreaterThanToken */, + "<=": 25 /* LessThanEqualsToken */, + ">=": 26 /* GreaterThanEqualsToken */, + "==": 27 /* EqualsEqualsToken */, + "!=": 28 /* ExclamationEqualsToken */, + "===": 29 /* EqualsEqualsEqualsToken */, + "!==": 30 /* ExclamationEqualsEqualsToken */, + "=>": 31 /* EqualsGreaterThanToken */, + "+": 32 /* PlusToken */, + "-": 33 /* MinusToken */, + "*": 34 /* AsteriskToken */, + "/": 35 /* SlashToken */, + "%": 36 /* PercentToken */, + "++": 37 /* PlusPlusToken */, + "--": 38 /* MinusMinusToken */, + "<<": 39 /* LessThanLessThanToken */, + ">>": 40 /* GreaterThanGreaterThanToken */, + ">>>": 41 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 42 /* AmpersandToken */, + "|": 43 /* BarToken */, + "^": 44 /* CaretToken */, + "!": 45 /* ExclamationToken */, + "~": 46 /* TildeToken */, + "&&": 47 /* AmpersandAmpersandToken */, + "||": 48 /* BarBarToken */, + "?": 49 /* QuestionToken */, + ":": 50 /* ColonToken */, + "=": 51 /* EqualsToken */, + "+=": 52 /* PlusEqualsToken */, + "-=": 53 /* MinusEqualsToken */, + "*=": 54 /* AsteriskEqualsToken */, + "/=": 55 /* SlashEqualsToken */, + "%=": 56 /* PercentEqualsToken */, + "<<=": 57 /* LessThanLessThanEqualsToken */, + ">>=": 58 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 60 /* AmpersandEqualsToken */, + "|=": 61 /* BarEqualsToken */, + "^=": 62 /* CaretEqualsToken */ + }; + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + function lookupInUnicodeMap(code, map) { + if (code < map[0]) { + return false; + } + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { + return true; + } + if (code < map[mid]) { + hi = mid; + } + else { + lo = mid + 2; + } + } + return false; + } + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierStart) : lookupInUnicodeMap(code, unicodeES5IdentifierStart); + } + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierPart) : lookupInUnicodeMap(code, unicodeES5IdentifierPart); + } + function makeReverseMap(source) { + var result = []; + for (var name in source) { + if (source.hasOwnProperty(name)) { + result[source[name]] = name; + } + } + return result; + } + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; + } + ts.tokenToString = tokenToString; + function computeLineStarts(text) { + var result = new Array(); + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos++); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; + } + } + result.push(lineStart); + return result; + } + ts.computeLineStarts = computeLineStarts; + function getPositionFromLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line > 0); + return lineStarts[line - 1] + character - 1; + } + ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; + function getLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = ts.binarySearch(lineStarts, position); + if (lineNumber < 0) { + lineNumber = (~lineNumber) - 1; + } + return { + line: lineNumber + 1, + character: position - lineStarts[lineNumber] + 1 + }; + } + ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; + function positionToLineAndCharacter(text, pos) { + var lineStarts = computeLineStarts(text); + return getLineAndCharacterOfPosition(lineStarts, pos); + } + ts.positionToLineAndCharacter = positionToLineAndCharacter; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function isWhiteSpace(ch) { + return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; + } + ts.isWhiteSpace = isWhiteSpace; + function isLineBreak(ch) { + return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */ || ch === 133 /* nextLine */; + } + ts.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; + } + function isOctalDigit(ch) { + return ch >= 48 /* _0 */ && ch <= 55 /* _7 */; + } + ts.isOctalDigit = isOctalDigit; + function skipTrivia(text, pos, stopAfterLineBreak) { + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) + pos++; + case 10 /* lineFeed */: + pos++; + if (stopAfterLineBreak) + return pos; + continue; + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + pos++; + continue; + case 47 /* slash */: + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + continue; + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + break; + } + pos++; + } + continue; + } + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + pos++; + continue; + } + break; + } + return pos; + } + } + ts.skipTrivia = skipTrivia; + function getCommentRanges(text, pos, trailing) { + var result; + var collecting = trailing || pos === 0; + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13 /* carriageReturn */: + if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) + pos++; + case 10 /* lineFeed */: + pos++; + if (trailing) { + return result; + } + collecting = true; + if (result && result.length) { + result[result.length - 1].hasTrailingNewLine = true; + } + continue; + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + pos++; + continue; + case 47 /* slash */: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) { + var startPos = pos; + pos += 2; + if (nextChar === 47 /* slash */) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } + else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (!result) + result = []; + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + } + continue; + } + break; + default: + if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + if (result && result.length && isLineBreak(ch)) { + result[result.length - 1].hasTrailingNewLine = true; + } + pos++; + continue; + } + break; + } + return result; + } + } + function getLeadingCommentRanges(text, pos) { + return getCommentRanges(text, pos, false); + } + ts.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return getCommentRanges(text, pos, true); + } + ts.getTrailingCommentRanges = getTrailingCommentRanges; + function isIdentifierStart(ch, languageVersion) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); + } + ts.isIdentifierStart = isIdentifierStart; + function isIdentifierPart(ch, languageVersion) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); + } + ts.isIdentifierPart = isIdentifierPart; + function createScanner(languageVersion, skipTrivia, text, onError, onComment) { + var pos; + var len; + var startPos; + var tokenPos; + var token; + var tokenValue; + var precedingLineBreak; + function error(message) { + if (onError) { + onError(message); + } + } + function isIdentifierStart(ch) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); + } + function isIdentifierPart(ch) { + return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); + } + function scanNumber() { + var start = pos; + while (isDigit(text.charCodeAt(pos))) + pos++; + if (text.charCodeAt(pos) === 46 /* dot */) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + } + var end = pos; + if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) { + pos++; + if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) + pos++; + if (isDigit(text.charCodeAt(pos))) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + end = pos; + } + else { + error(ts.Diagnostics.Digit_expected); + } + } + return +(text.substring(start, end)); + } + function scanOctalDigits() { + var start = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + return +(text.substring(start, pos)); + } + function scanHexDigits(count, mustMatchCount) { + var digits = 0; + var value = 0; + while (digits < count || !mustMatchCount) { + var ch = text.charCodeAt(pos); + if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { + value = value * 16 + ch - 48 /* _0 */; + } + else if (ch >= 65 /* A */ && ch <= 70 /* F */) { + value = value * 16 + ch - 65 /* A */ + 10; + } + else if (ch >= 97 /* a */ && ch <= 102 /* f */) { + value = value * 16 + ch - 97 /* a */ + 10; + } + else { + break; + } + pos++; + digits++; + } + if (digits < count) { + value = -1; + } + return value; + } + function scanString() { + var quote = text.charCodeAt(pos++); + var result = ""; + var start = pos; + while (true) { + if (pos >= len) { + result += text.substring(start, pos); + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92 /* backslash */) { + result += text.substring(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; + } + if (isLineBreak(ch)) { + result += text.substring(start, pos); + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + pos++; + } + return result; + } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= len) { + contents += text.substring(start, pos); + error(ts.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96 /* backtick */) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + if (currChar === 36 /* $ */ && pos + 1 < len && text.charCodeAt(pos + 1) === 123 /* openBrace */) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 10 /* TemplateHead */ : 11 /* TemplateMiddle */; + break; + } + if (currChar === 92 /* backslash */) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13 /* carriageReturn */) { + contents += text.substring(start, pos); + if (pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos++; + } + pos++; + contents += "\n"; + start = pos; + continue; + } + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence() { + pos++; + if (pos >= len) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos++); + switch (ch) { + case 48 /* _0 */: + return "\0"; + case 98 /* b */: + return "\b"; + case 116 /* t */: + return "\t"; + case 110 /* n */: + return "\n"; + case 118 /* v */: + return "\v"; + case 102 /* f */: + return "\f"; + case 114 /* r */: + return "\r"; + case 39 /* singleQuote */: + return "\'"; + case 34 /* doubleQuote */: + return "\""; + case 120 /* x */: + case 117 /* u */: + var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); + if (ch >= 0) { + return String.fromCharCode(ch); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + case 13 /* carriageReturn */: + if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + case 8232 /* lineSeparator */: + case 8233 /* paragraphSeparator */: + return ""; + default: + return String.fromCharCode(ch); + } + } + function peekUnicodeEscape() { + if (pos + 5 < len && text.charCodeAt(pos + 1) === 117 /* u */) { + var start = pos; + pos += 2; + var value = scanHexDigits(4, true); + pos = start; + return value; + } + return -1; + } + function scanIdentifierParts() { + var result = ""; + var start = pos; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (isIdentifierPart(ch)) { + pos++; + } + else if (ch === 92 /* backslash */) { + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch))) { + break; + } + result += text.substring(start, pos); + result += String.fromCharCode(ch); + pos += 6; + start = pos; + } + else { + break; + } + } + result += text.substring(start, pos); + return result; + } + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { + return token = textToToken[tokenValue]; + } + } + return token = 63 /* Identifier */; + } + function scan() { + startPos = pos; + precedingLineBreak = false; + while (true) { + tokenPos = pos; + if (pos >= len) { + return token = 1 /* EndOfFileToken */; + } + var ch = text.charCodeAt(pos); + switch (ch) { + case 10 /* lineFeed */: + case 13 /* carriageReturn */: + precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === 13 /* carriageReturn */ && pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos += 2; + } + else { + pos++; + } + return token = 4 /* NewLineTrivia */; + } + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { + pos++; + } + return token = 5 /* WhitespaceTrivia */; + } + case 33 /* exclamation */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 30 /* ExclamationEqualsEqualsToken */; + } + return pos += 2, token = 28 /* ExclamationEqualsToken */; + } + return pos++, token = 45 /* ExclamationToken */; + case 34 /* doubleQuote */: + case 39 /* singleQuote */: + tokenValue = scanString(); + return token = 7 /* StringLiteral */; + case 96 /* backtick */: + return token = scanTemplateAndSetTokenValue(); + case 37 /* percent */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 56 /* PercentEqualsToken */; + } + return pos++, token = 36 /* PercentToken */; + case 38 /* ampersand */: + if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { + return pos += 2, token = 47 /* AmpersandAmpersandToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 60 /* AmpersandEqualsToken */; + } + return pos++, token = 42 /* AmpersandToken */; + case 40 /* openParen */: + return pos++, token = 15 /* OpenParenToken */; + case 41 /* closeParen */: + return pos++, token = 16 /* CloseParenToken */; + case 42 /* asterisk */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 54 /* AsteriskEqualsToken */; + } + return pos++, token = 34 /* AsteriskToken */; + case 43 /* plus */: + if (text.charCodeAt(pos + 1) === 43 /* plus */) { + return pos += 2, token = 37 /* PlusPlusToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 52 /* PlusEqualsToken */; + } + return pos++, token = 32 /* PlusToken */; + case 44 /* comma */: + return pos++, token = 22 /* CommaToken */; + case 45 /* minus */: + if (text.charCodeAt(pos + 1) === 45 /* minus */) { + return pos += 2, token = 38 /* MinusMinusToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 53 /* MinusEqualsToken */; + } + return pos++, token = 33 /* MinusToken */; + case 46 /* dot */: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanNumber(); + return token = 6 /* NumericLiteral */; + } + if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { + return pos += 3, token = 20 /* DotDotDotToken */; + } + return pos++, token = 19 /* DotToken */; + case 47 /* slash */: + if (text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + while (pos < len) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + if (onComment) { + onComment(tokenPos, pos); + } + if (skipTrivia) { + continue; + } + else { + return token = 2 /* SingleLineCommentTrivia */; + } + } + if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + pos += 2; + var commentClosed = false; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + pos += 2; + commentClosed = true; + break; + } + if (isLineBreak(ch)) { + precedingLineBreak = true; + } + pos++; + } + if (!commentClosed) { + error(ts.Diagnostics.Asterisk_Slash_expected); + } + if (onComment) { + onComment(tokenPos, pos); + } + if (skipTrivia) { + continue; + } + else { + return token = 3 /* MultiLineCommentTrivia */; + } + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 55 /* SlashEqualsToken */; + } + return pos++, token = 35 /* SlashToken */; + case 48 /* _0 */: + if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { + pos += 2; + var value = scanHexDigits(1, false); + if (value < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return 6 /* NumericLiteral */; + } + if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + return 6 /* NumericLiteral */; + } + case 49 /* _1 */: + case 50 /* _2 */: + case 51 /* _3 */: + case 52 /* _4 */: + case 53 /* _5 */: + case 54 /* _6 */: + case 55 /* _7 */: + case 56 /* _8 */: + case 57 /* _9 */: + tokenValue = "" + scanNumber(); + return token = 6 /* NumericLiteral */; + case 58 /* colon */: + return pos++, token = 50 /* ColonToken */; + case 59 /* semicolon */: + return pos++, token = 21 /* SemicolonToken */; + case 60 /* lessThan */: + if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 57 /* LessThanLessThanEqualsToken */; + } + return pos += 2, token = 39 /* LessThanLessThanToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 25 /* LessThanEqualsToken */; + } + return pos++, token = 23 /* LessThanToken */; + case 61 /* equals */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 29 /* EqualsEqualsEqualsToken */; + } + return pos += 2, token = 27 /* EqualsEqualsToken */; + } + if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { + return pos += 2, token = 31 /* EqualsGreaterThanToken */; + } + return pos++, token = 51 /* EqualsToken */; + case 62 /* greaterThan */: + return pos++, token = 24 /* GreaterThanToken */; + case 63 /* question */: + return pos++, token = 49 /* QuestionToken */; + case 91 /* openBracket */: + return pos++, token = 17 /* OpenBracketToken */; + case 93 /* closeBracket */: + return pos++, token = 18 /* CloseBracketToken */; + case 94 /* caret */: + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 62 /* CaretEqualsToken */; + } + return pos++, token = 44 /* CaretToken */; + case 123 /* openBrace */: + return pos++, token = 13 /* OpenBraceToken */; + case 124 /* bar */: + if (text.charCodeAt(pos + 1) === 124 /* bar */) { + return pos += 2, token = 48 /* BarBarToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 61 /* BarEqualsToken */; + } + return pos++, token = 43 /* BarToken */; + case 125 /* closeBrace */: + return pos++, token = 14 /* CloseBraceToken */; + case 126 /* tilde */: + return pos++, token = 46 /* TildeToken */; + case 92 /* backslash */: + var ch = peekUnicodeEscape(); + if (ch >= 0 && isIdentifierStart(ch)) { + pos += 6; + tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0 /* Unknown */; + default: + if (isIdentifierStart(ch)) { + pos++; + while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) + pos++; + tokenValue = text.substring(tokenPos, pos); + if (ch === 92 /* backslash */) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } + else if (isWhiteSpace(ch)) { + pos++; + continue; + } + else if (isLineBreak(ch)) { + precedingLineBreak = true; + pos++; + continue; + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0 /* Unknown */; + } + } + } + function reScanGreaterToken() { + if (token === 24 /* GreaterThanToken */) { + if (text.charCodeAt(pos) === 62 /* greaterThan */) { + if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { + if (text.charCodeAt(pos + 2) === 61 /* equals */) { + return pos += 3, token = 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + } + return pos += 2, token = 41 /* GreaterThanGreaterThanGreaterThanToken */; + } + if (text.charCodeAt(pos + 1) === 61 /* equals */) { + return pos += 2, token = 58 /* GreaterThanGreaterThanEqualsToken */; + } + return pos++, token = 40 /* GreaterThanGreaterThanToken */; + } + if (text.charCodeAt(pos) === 61 /* equals */) { + return pos++, token = 26 /* GreaterThanEqualsToken */; + } + } + return token; + } + function reScanSlashToken() { + if (token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= len) { + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + if (inEscape) { + inEscape = false; + } + else if (ch === 47 /* slash */ && !inCharacterClass) { + p++; + break; + } + else if (ch === 91 /* openBracket */) { + inCharacterClass = true; + } + else if (ch === 92 /* backslash */) { + inEscape = true; + } + else if (ch === 93 /* closeBracket */) { + inCharacterClass = false; + } + p++; + } + while (p < len && isIdentifierPart(text.charCodeAt(p))) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 8 /* RegularExpressionLiteral */; + } + return token; + } + function reScanTemplateToken() { + ts.Debug.assert(token === 14 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } + function tryScan(callback) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var savePrecedingLineBreak = precedingLineBreak; + var result = callback(); + if (!result) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + precedingLineBreak = savePrecedingLineBreak; + } + return result; + } + function setText(newText) { + text = newText || ""; + len = text.length; + setTextPos(0); + } + function setTextPos(textPos) { + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0 /* Unknown */; + precedingLineBreak = false; + } + setText(text); + return { + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 63 /* Identifier */ || token > 99 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 64 /* FirstReservedWord */ && token <= 99 /* LastReservedWord */; }, + reScanGreaterToken: reScanGreaterToken, + reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, + scan: scan, + setText: setText, + setTextPos: setTextPos, + tryScan: tryScan + }; + } + ts.createScanner = createScanner; +})(ts || (ts = {})); +var ts; +(function (ts) { + var nodeConstructors = new Array(199 /* Count */); function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); } @@ -2010,7 +2023,7 @@ var ts; return node; } function getSourceFileOfNode(node) { - while (node && node.kind !== 193 /* SourceFile */) + while (node && node.kind !== 196 /* SourceFile */) node = node.parent; return node; } @@ -2026,6 +2039,9 @@ var ts; } ts.getStartPosOfNode = getStartPosOfNode; function getTokenPosOfNode(node, sourceFile) { + if (node.pos === node.end) { + return node.pos; + } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; @@ -2046,10 +2062,10 @@ var ts; return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier; } ts.unescapeIdentifier = unescapeIdentifier; - function identifierToString(identifier) { - return identifier.kind === 120 /* Missing */ ? "(Missing)" : getTextOfNode(identifier); + function declarationNameToString(name) { + return name.kind === 120 /* Missing */ ? "(Missing)" : getTextOfNode(name); } - ts.identifierToString = identifierToString; + ts.declarationNameToString = declarationNameToString; function createDiagnosticForNode(node, message, arg0, arg1, arg2) { node = getErrorSpanForNode(node); var file = getSourceFileOfNode(node); @@ -2069,12 +2085,12 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 181 /* VariableDeclaration */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 188 /* ModuleDeclaration */: - case 187 /* EnumDeclaration */: - case 192 /* EnumMember */: + case 184 /* VariableDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 191 /* ModuleDeclaration */: + case 190 /* EnumDeclaration */: + case 195 /* EnumMember */: errorSpan = node.name; break; } @@ -2094,7 +2110,7 @@ var ts; } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isPrologueDirective(node) { - return node.kind === 161 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; + return node.kind === 164 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function isEvalOrArgumentsIdentifier(node) { @@ -2149,8 +2165,11 @@ var ts; case 123 /* Parameter */: return child(node.name) || child(node.type) || child(node.initializer); case 124 /* Property */: - case 141 /* PropertyAssignment */: + case 143 /* PropertyAssignment */: + case 144 /* ShorthandPropertyAssignment */: return child(node.name) || child(node.type) || child(node.initializer); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: case 129 /* CallSignature */: case 130 /* ConstructSignature */: case 131 /* IndexSignature */: @@ -2159,110 +2178,110 @@ var ts; case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 149 /* FunctionExpression */: - case 182 /* FunctionDeclaration */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 153 /* ArrowFunction */: return child(node.name) || children(node.typeParameters) || children(node.parameters) || child(node.type) || child(node.body); case 132 /* TypeReference */: return child(node.typeName) || children(node.typeArguments); - case 133 /* TypeQuery */: + case 135 /* TypeQuery */: return child(node.exprName); - case 134 /* TypeLiteral */: + case 136 /* TypeLiteral */: return children(node.members); - case 135 /* ArrayType */: + case 137 /* ArrayType */: return child(node.elementType); - case 136 /* TupleType */: + case 138 /* TupleType */: return children(node.elementTypes); - case 137 /* UnionType */: + case 139 /* UnionType */: return children(node.types); - case 138 /* ParenType */: + case 140 /* ParenType */: return child(node.type); - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: return children(node.elements); - case 140 /* ObjectLiteral */: + case 142 /* ObjectLiteral */: return children(node.properties); - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: return child(node.left) || child(node.right); - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: return child(node.object) || child(node.index); - case 144 /* CallExpression */: - case 145 /* NewExpression */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: return child(node.func) || children(node.typeArguments) || children(node.arguments); - case 146 /* TaggedTemplateExpression */: + case 149 /* TaggedTemplateExpression */: return child(node.tag) || child(node.template); - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return child(node.type) || child(node.operand); - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return child(node.expression); - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: return child(node.operand); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return child(node.left) || child(node.right); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return child(node.condition) || child(node.whenTrue) || child(node.whenFalse); - case 158 /* Block */: - case 177 /* TryBlock */: - case 179 /* FinallyBlock */: - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: - case 193 /* SourceFile */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 182 /* FinallyBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: + case 196 /* SourceFile */: return children(node.statements); - case 159 /* VariableStatement */: + case 162 /* VariableStatement */: return children(node.declarations); - case 161 /* ExpressionStatement */: + case 164 /* ExpressionStatement */: return child(node.expression); - case 162 /* IfStatement */: + case 165 /* IfStatement */: return child(node.expression) || child(node.thenStatement) || child(node.elseStatement); - case 163 /* DoStatement */: + case 166 /* DoStatement */: return child(node.statement) || child(node.expression); - case 164 /* WhileStatement */: + case 167 /* WhileStatement */: return child(node.expression) || child(node.statement); - case 165 /* ForStatement */: + case 168 /* ForStatement */: return children(node.declarations) || child(node.initializer) || child(node.condition) || child(node.iterator) || child(node.statement); - case 166 /* ForInStatement */: + case 169 /* ForInStatement */: return child(node.declaration) || child(node.variable) || child(node.expression) || child(node.statement); - case 167 /* ContinueStatement */: - case 168 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 171 /* BreakStatement */: return child(node.label); - case 169 /* ReturnStatement */: + case 172 /* ReturnStatement */: return child(node.expression); - case 170 /* WithStatement */: + case 173 /* WithStatement */: return child(node.expression) || child(node.statement); - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: return child(node.expression) || children(node.clauses); - case 172 /* CaseClause */: - case 173 /* DefaultClause */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: return child(node.expression) || children(node.statements); - case 174 /* LabeledStatement */: + case 177 /* LabeledStatement */: return child(node.label) || child(node.statement); - case 175 /* ThrowStatement */: + case 178 /* ThrowStatement */: return child(node.expression); - case 176 /* TryStatement */: + case 179 /* TryStatement */: return child(node.tryBlock) || child(node.catchBlock) || child(node.finallyBlock); - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: return child(node.variable) || children(node.statements); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return child(node.name) || child(node.type) || child(node.initializer); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return child(node.name) || children(node.typeParameters) || child(node.baseType) || children(node.implementedTypes) || children(node.members); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return child(node.name) || children(node.typeParameters) || children(node.baseTypes) || children(node.members); - case 186 /* TypeAliasDeclaration */: + case 189 /* TypeAliasDeclaration */: return child(node.name) || child(node.type); - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: return child(node.name) || children(node.members); - case 192 /* EnumMember */: + case 195 /* EnumMember */: return child(node.name) || child(node.initializer); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return child(node.name) || child(node.body); - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return child(node.name) || child(node.entityName) || child(node.externalModuleName); - case 191 /* ExportAssignment */: + case 194 /* ExportAssignment */: return child(node.exportName); - case 155 /* TemplateExpression */: + case 158 /* TemplateExpression */: return child(node.head) || children(node.templateSpans); - case 156 /* TemplateSpan */: + case 159 /* TemplateSpan */: return child(node.expression) || child(node.literal); } } @@ -2271,24 +2290,24 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 169 /* ReturnStatement */: + case 172 /* ReturnStatement */: return visitor(node); - case 158 /* Block */: - case 183 /* FunctionBlock */: - case 162 /* IfStatement */: - case 163 /* DoStatement */: - case 164 /* WhileStatement */: - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 170 /* WithStatement */: - case 171 /* SwitchStatement */: - case 172 /* CaseClause */: - case 173 /* DefaultClause */: - case 174 /* LabeledStatement */: - case 176 /* TryStatement */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: + case 161 /* Block */: + case 186 /* FunctionBlock */: + case 165 /* IfStatement */: + case 166 /* DoStatement */: + case 167 /* WhileStatement */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 173 /* WithStatement */: + case 174 /* SwitchStatement */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: return forEachChild(node, traverse); } } @@ -2297,9 +2316,9 @@ var ts; function isAnyFunction(node) { if (node) { switch (node.kind) { - case 149 /* FunctionExpression */: - case 182 /* FunctionDeclaration */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 153 /* ArrowFunction */: case 125 /* Method */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: @@ -2326,20 +2345,20 @@ var ts; return undefined; } switch (node.kind) { - case 150 /* ArrowFunction */: + case 153 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 188 /* ModuleDeclaration */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 191 /* ModuleDeclaration */: case 124 /* Property */: case 125 /* Method */: case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 187 /* EnumDeclaration */: - case 193 /* SourceFile */: + case 190 /* EnumDeclaration */: + case 196 /* SourceFile */: return node; } } @@ -2370,60 +2389,62 @@ var ts; case 93 /* TrueKeyword */: case 78 /* FalseKeyword */: case 8 /* RegularExpressionLiteral */: - case 139 /* ArrayLiteral */: - case 140 /* ObjectLiteral */: - case 142 /* PropertyAccess */: - case 143 /* IndexedAccess */: - case 144 /* CallExpression */: - case 145 /* NewExpression */: - case 146 /* TaggedTemplateExpression */: - case 147 /* TypeAssertion */: - case 148 /* ParenExpression */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: - case 153 /* BinaryExpression */: - case 154 /* ConditionalExpression */: - case 155 /* TemplateExpression */: - case 157 /* OmittedExpression */: + case 141 /* ArrayLiteral */: + case 142 /* ObjectLiteral */: + case 145 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: + case 149 /* TaggedTemplateExpression */: + case 150 /* TypeAssertion */: + case 151 /* ParenExpression */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: + case 156 /* BinaryExpression */: + case 157 /* ConditionalExpression */: + case 158 /* TemplateExpression */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 160 /* OmittedExpression */: return true; case 121 /* QualifiedName */: while (node.parent.kind === 121 /* QualifiedName */) node = node.parent; - return node.parent.kind === 133 /* TypeQuery */; + return node.parent.kind === 135 /* TypeQuery */; case 63 /* Identifier */: - if (node.parent.kind === 133 /* TypeQuery */) { + if (node.parent.kind === 135 /* TypeQuery */) { return true; } case 6 /* NumericLiteral */: case 7 /* StringLiteral */: - case 9 /* NoSubstitutionTemplateLiteral */: var parent = node.parent; switch (parent.kind) { - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 123 /* Parameter */: case 124 /* Property */: - case 192 /* EnumMember */: - case 141 /* PropertyAssignment */: + case 195 /* EnumMember */: + case 143 /* PropertyAssignment */: return parent.initializer === node; - case 161 /* ExpressionStatement */: - case 162 /* IfStatement */: - case 163 /* DoStatement */: - case 164 /* WhileStatement */: - case 169 /* ReturnStatement */: - case 170 /* WithStatement */: - case 171 /* SwitchStatement */: - case 172 /* CaseClause */: - case 175 /* ThrowStatement */: - case 171 /* SwitchStatement */: + case 164 /* ExpressionStatement */: + case 165 /* IfStatement */: + case 166 /* DoStatement */: + case 167 /* WhileStatement */: + case 172 /* ReturnStatement */: + case 173 /* WithStatement */: + case 174 /* SwitchStatement */: + case 175 /* CaseClause */: + case 178 /* ThrowStatement */: + case 174 /* SwitchStatement */: return parent.expression === node; - case 165 /* ForStatement */: + case 168 /* ForStatement */: return parent.initializer === node || parent.condition === node || parent.iterator === node; - case 166 /* ForInStatement */: + case 169 /* ForInStatement */: return parent.variable === node || parent.expression === node; - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return node === parent.operand; + case 159 /* TemplateSpan */: + return node === parent.expression; default: if (isExpression(parent)) { return true; @@ -2462,20 +2483,21 @@ var ts; switch (node.kind) { case 122 /* TypeParameter */: case 123 /* Parameter */: - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 124 /* Property */: - case 141 /* PropertyAssignment */: - case 192 /* EnumMember */: + case 143 /* PropertyAssignment */: + case 144 /* ShorthandPropertyAssignment */: + case 195 /* EnumMember */: case 125 /* Method */: - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 187 /* EnumDeclaration */: - case 188 /* ModuleDeclaration */: - case 190 /* ImportDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 190 /* EnumDeclaration */: + case 191 /* ModuleDeclaration */: + case 193 /* ImportDeclaration */: return true; } return false; @@ -2483,24 +2505,24 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 168 /* BreakStatement */: - case 167 /* ContinueStatement */: - case 180 /* DebuggerStatement */: - case 163 /* DoStatement */: - case 161 /* ExpressionStatement */: - case 160 /* EmptyStatement */: - case 166 /* ForInStatement */: - case 165 /* ForStatement */: - case 162 /* IfStatement */: - case 174 /* LabeledStatement */: - case 169 /* ReturnStatement */: - case 171 /* SwitchStatement */: + case 171 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 183 /* DebuggerStatement */: + case 166 /* DoStatement */: + case 164 /* ExpressionStatement */: + case 163 /* EmptyStatement */: + case 169 /* ForInStatement */: + case 168 /* ForStatement */: + case 165 /* IfStatement */: + case 177 /* LabeledStatement */: + case 172 /* ReturnStatement */: + case 174 /* SwitchStatement */: case 92 /* ThrowKeyword */: - case 176 /* TryStatement */: - case 159 /* VariableStatement */: - case 164 /* WhileStatement */: - case 170 /* WithStatement */: - case 191 /* ExportAssignment */: + case 179 /* TryStatement */: + case 162 /* VariableStatement */: + case 167 /* WhileStatement */: + case 173 /* WithStatement */: + case 194 /* ExportAssignment */: return true; default: return false; @@ -2512,10 +2534,10 @@ var ts; return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 149 /* FunctionExpression */) { + if (isDeclaration(parent) || parent.kind === 152 /* FunctionExpression */) { return parent.name === name; } - if (parent.kind === 178 /* CatchBlock */) { + if (parent.kind === 181 /* CatchBlock */) { return parent.variable === name; } return false; @@ -2523,16 +2545,16 @@ var ts; ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; function getAncestor(node, kind) { switch (kind) { - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: while (node) { switch (node.kind) { - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return node; - case 187 /* EnumDeclaration */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 188 /* ModuleDeclaration */: - case 190 /* ImportDeclaration */: + case 190 /* EnumDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 191 /* ModuleDeclaration */: + case 193 /* ImportDeclaration */: return undefined; default: node = node.parent; @@ -2574,6 +2596,41 @@ var ts; } } ; + function getFileReferenceFromReferencePath(comment, commentRange) { + var simpleReferenceRegEx = /^\/\/\/\s*/gim; + if (simpleReferenceRegEx.exec(comment)) { + if (isNoDefaultLibRegEx.exec(comment)) { + return { + isNoDefaultLib: true + }; + } + else { + var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + if (matchResult) { + var start = commentRange.pos; + var end = commentRange.end; + var fileRef = { + pos: start, + end: end, + filename: matchResult[3] + }; + return { + fileReference: fileRef, + isNoDefaultLib: false + }; + } + else { + return { + diagnostic: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; + } + } + } + return undefined; + } + ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { return 64 /* FirstKeyword */ <= token && token <= 119 /* LastKeyword */; } @@ -2582,6 +2639,15 @@ var ts; return 2 /* FirstTriviaToken */ <= token && token <= 5 /* LastTriviaToken */; } ts.isTrivia = isTrivia; + function isUnterminatedTemplateEnd(node) { + ts.Debug.assert(node.kind === 9 /* NoSubstitutionTemplateLiteral */ || node.kind === 12 /* TemplateTail */); + var sourceText = getSourceFileOfNode(node).text; + if (node.end !== sourceText.length) { + return false; + } + return sourceText.charCodeAt(node.end - 1) !== 96 /* backtick */ || node.text.length === 0; + } + ts.isUnterminatedTemplateEnd = isUnterminatedTemplateEnd; function isModifier(token) { switch (token) { case 106 /* PublicKeyword */: @@ -2686,17 +2752,14 @@ var ts; nodeIsNestedInLabel: nodeIsNestedInLabel }; })(); - function getLineAndCharacterlFromSourcePosition(position) { - if (!lineStarts) { - lineStarts = ts.getLineStarts(sourceText); - } - return ts.getLineAndCharacterOfPosition(lineStarts, position); + function getLineStarts() { + return lineStarts || (lineStarts = ts.computeLineStarts(sourceText)); + } + function getLineAndCharacterFromSourcePosition(position) { + return ts.getLineAndCharacterOfPosition(getLineStarts(), position); } function getPositionFromSourceLineAndCharacter(line, character) { - if (!lineStarts) { - lineStarts = ts.getLineStarts(sourceText); - } - return ts.getPositionFromLineAndCharacter(lineStarts, line, character); + return ts.getPositionFromLineAndCharacter(getLineStarts(), line, character); } function error(message, arg0, arg1, arg2) { var start = scanner.getTokenPos(); @@ -2719,7 +2782,9 @@ var ts; function errorAtPos(start, length, message, arg0, arg1, arg2) { var lastErrorPos = file.syntacticErrors.length ? file.syntacticErrors[file.syntacticErrors.length - 1].start : -1; if (start !== lastErrorPos) { - file.syntacticErrors.push(ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); + var diagnostic = ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); + diagnostic.isParseError = true; + file.syntacticErrors.push(diagnostic); } if (lookAheadMode === 1 /* NoErrorYet */) { lookAheadMode = 2 /* Error */; @@ -2833,14 +2898,14 @@ var ts; return createNode(120 /* Missing */); } function internIdentifier(text) { + text = escapeIdentifier(text); return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); } function createIdentifier(isIdentifier) { identifierCount++; if (isIdentifier) { var node = createNode(63 /* Identifier */); - var text = escapeIdentifier(scanner.getTokenValue()); - node.text = internIdentifier(text); + node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } @@ -3079,7 +3144,7 @@ var ts; return finishNode(node); } function parseTemplateExpression() { - var template = createNode(155 /* TemplateExpression */); + var template = createNode(158 /* TemplateExpression */); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 10 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; @@ -3092,7 +3157,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(156 /* TemplateSpan */); + var span = createNode(159 /* TemplateSpan */); span.expression = parseExpression(false); var literal; if (token === 14 /* CloseBraceToken */) { @@ -3140,7 +3205,7 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(133 /* TypeQuery */); + var node = createNode(135 /* TypeQuery */); parseExpected(95 /* TypeOfKeyword */); node.exprName = parseEntityName(true); return finishNode(node); @@ -3371,7 +3436,7 @@ var ts; } } function parseTypeLiteral() { - var node = createNode(134 /* TypeLiteral */); + var node = createNode(136 /* TypeLiteral */); if (parseExpected(13 /* OpenBraceToken */)) { node.members = parseList(5 /* TypeMembers */, false, parseTypeMember); parseExpected(14 /* CloseBraceToken */); @@ -3382,7 +3447,7 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(136 /* TupleType */); + var node = createNode(138 /* TupleType */); var startTokenPos = scanner.getTokenPos(); var startErrorCount = file.syntacticErrors.length; node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 17 /* OpenBracketToken */, 18 /* CloseBracketToken */); @@ -3392,22 +3457,20 @@ var ts; return finishNode(node); } function parseParenType() { - var node = createNode(138 /* ParenType */); + var node = createNode(140 /* ParenType */); parseExpected(15 /* OpenParenToken */); node.type = parseType(); parseExpected(16 /* CloseParenToken */); return finishNode(node); } - function parseFunctionType(signatureKind) { - var node = createNode(134 /* TypeLiteral */); - var member = createNode(signatureKind); - var sig = parseSignature(signatureKind, 31 /* EqualsGreaterThanToken */, true); + function parseFunctionType(typeKind) { + var member = createNode(typeKind); + var sig = parseSignature(typeKind === 133 /* FunctionType */ ? 129 /* CallSignature */ : 130 /* ConstructSignature */, 31 /* EqualsGreaterThanToken */, true); member.typeParameters = sig.typeParameters; member.parameters = sig.parameters; member.type = sig.type; finishNode(member); - node.members = createNodeArray(member); - return finishNode(node); + return member; } function parseKeywordAndNoDot() { var node = parseTokenNode(); @@ -3464,7 +3527,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(17 /* OpenBracketToken */)) { parseExpected(18 /* CloseBracketToken */); - var node = createNode(135 /* ArrayType */, type.pos); + var node = createNode(137 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -3479,7 +3542,7 @@ var ts; types.push(parsePrimaryType()); } types.end = getNodeEnd(); - var node = createNode(137 /* UnionType */, type.pos); + var node = createNode(139 /* UnionType */, type.pos); node.types = types; type = finishNode(node); } @@ -3508,10 +3571,10 @@ var ts; } function parseType() { if (isStartOfFunctionType()) { - return parseFunctionType(129 /* CallSignature */); + return parseFunctionType(133 /* FunctionType */); } if (token === 86 /* NewKeyword */) { - return parseFunctionType(130 /* ConstructSignature */); + return parseFunctionType(134 /* ConstructorType */); } return parseUnionType(); } @@ -3593,22 +3656,22 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 142 /* PropertyAccess */: - case 143 /* IndexedAccess */: - case 145 /* NewExpression */: - case 144 /* CallExpression */: - case 146 /* TaggedTemplateExpression */: - case 139 /* ArrayLiteral */: - case 148 /* ParenExpression */: - case 140 /* ObjectLiteral */: - case 149 /* FunctionExpression */: + case 145 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 148 /* NewExpression */: + case 147 /* CallExpression */: + case 149 /* TaggedTemplateExpression */: + case 141 /* ArrayLiteral */: + case 151 /* ParenExpression */: + case 142 /* ObjectLiteral */: + case 152 /* FunctionExpression */: case 63 /* Identifier */: case 120 /* Missing */: case 8 /* RegularExpressionLiteral */: case 6 /* NumericLiteral */: case 7 /* StringLiteral */: case 9 /* NoSubstitutionTemplateLiteral */: - case 155 /* TemplateExpression */: + case 158 /* TemplateExpression */: case 78 /* FalseKeyword */: case 87 /* NullKeyword */: case 91 /* ThisKeyword */: @@ -3644,7 +3707,7 @@ var ts; return parseArrowExpressionTail(pos, sig, false); } else { - return makeFunctionExpression(150 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); + return makeFunctionExpression(153 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); } } var sig = tryParseSignatureIfArrowOrBraceFollows(); @@ -3718,7 +3781,7 @@ var ts; else { body = parseAssignmentExpression(noIn); } - return makeFunctionExpression(150 /* ArrowFunction */, pos, undefined, sig, body); + return makeFunctionExpression(153 /* ArrowFunction */, pos, undefined, sig, body); } function isAssignmentOperator() { return token >= 51 /* FirstAssignment */ && token <= 62 /* LastAssignment */; @@ -3726,7 +3789,7 @@ var ts; function parseConditionalExpression(noIn) { var expr = parseBinaryExpression(noIn); while (parseOptional(49 /* QuestionToken */)) { - var node = createNode(154 /* ConditionalExpression */, expr.pos); + var node = createNode(157 /* ConditionalExpression */, expr.pos); node.condition = expr; node.whenTrue = parseAssignmentExpression(false); parseExpected(50 /* ColonToken */); @@ -3790,7 +3853,7 @@ var ts; return undefined; } function makeBinaryExpression(left, operator, right) { - var node = createNode(153 /* BinaryExpression */, left.pos); + var node = createNode(156 /* BinaryExpression */, left.pos); node.left = left; node.operator = operator; node.right = right; @@ -3819,7 +3882,7 @@ var ts; grammarErrorOnNode(operand, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); } } - return makeUnaryExpression(151 /* PrefixOperator */, pos, operator, operand); + return makeUnaryExpression(154 /* PrefixOperator */, pos, operator, operand); case 23 /* LessThanToken */: return parseTypeAssertion(); } @@ -3836,12 +3899,12 @@ var ts; } var operator = token; nextToken(); - expr = makeUnaryExpression(152 /* PostfixOperator */, expr.pos, operator, expr); + expr = makeUnaryExpression(155 /* PostfixOperator */, expr.pos, operator, expr); } return expr; } function parseTypeAssertion() { - var node = createNode(147 /* TypeAssertion */); + var node = createNode(150 /* TypeAssertion */); parseExpected(23 /* LessThanToken */); node.type = parseType(); parseExpected(24 /* GreaterThanToken */); @@ -3858,7 +3921,7 @@ var ts; while (true) { var dotOrBracketStart = scanner.getTokenPos(); if (parseOptional(19 /* DotToken */)) { - var propertyAccess = createNode(142 /* PropertyAccess */, expr.pos); + var propertyAccess = createNode(145 /* PropertyAccess */, expr.pos); if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(function () { return scanner.isReservedWord(); })) { grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, ts.Diagnostics.Identifier_expected); var id = createMissingNode(); @@ -3872,7 +3935,7 @@ var ts; continue; } if (parseOptional(17 /* OpenBracketToken */)) { - var indexedAccess = createNode(143 /* IndexedAccess */, expr.pos); + var indexedAccess = createNode(146 /* IndexedAccess */, expr.pos); indexedAccess.object = expr; if (inNewExpression && parseOptional(18 /* CloseBracketToken */)) { indexedAccess.index = createMissingNode(); @@ -3890,7 +3953,7 @@ var ts; continue; } if ((token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) && !inNewExpression) { - var callExpr = createNode(144 /* CallExpression */, expr.pos); + var callExpr = createNode(147 /* CallExpression */, expr.pos); callExpr.func = expr; if (token === 23 /* LessThanToken */) { if (!(callExpr.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) @@ -3905,7 +3968,7 @@ var ts; continue; } if (token === 9 /* NoSubstitutionTemplateLiteral */ || token === 10 /* TemplateHead */) { - var tagExpression = createNode(146 /* TaggedTemplateExpression */, expr.pos); + var tagExpression = createNode(149 /* TaggedTemplateExpression */, expr.pos); tagExpression.tag = expr; tagExpression.template = token === 9 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); expr = finishNode(tagExpression); @@ -3979,7 +4042,7 @@ var ts; return createMissingNode(); } function parseParenExpression() { - var node = createNode(148 /* ParenExpression */); + var node = createNode(151 /* ParenExpression */); parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); parseExpected(16 /* CloseParenToken */); @@ -3992,7 +4055,7 @@ var ts; var errorLength = scanner.getTextPos() - errorStart; grammarErrorAtPos(errorStart, errorLength, omittedExpressionDiagnostic); } - return createNode(157 /* OmittedExpression */); + return createNode(160 /* OmittedExpression */); } return parseAssignmentExpression(); } @@ -4003,7 +4066,7 @@ var ts; return parseAssignmentExpressionOrOmittedExpression(ts.Diagnostics.Argument_expression_expected); } function parseArrayLiteral() { - var node = createNode(139 /* ArrayLiteral */); + var node = createNode(141 /* ArrayLiteral */); parseExpected(17 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 256 /* MultiLine */; @@ -4012,14 +4075,30 @@ var ts; return finishNode(node); } function parsePropertyAssignment() { - var node = createNode(141 /* PropertyAssignment */); - node.name = parsePropertyName(); + var nodePos = scanner.getStartPos(); + var nameToken = token; + var propertyName = parsePropertyName(); + var node; if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + node = createNode(143 /* PropertyAssignment */, nodePos); + node.name = propertyName; var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); var body = parseBody(false); - node.initializer = makeFunctionExpression(149 /* FunctionExpression */, node.pos, undefined, sig, body); + node.initializer = makeFunctionExpression(152 /* FunctionExpression */, node.pos, undefined, sig, body); + return finishNode(node); + } + if (token === 49 /* QuestionToken */) { + var questionStart = scanner.getTokenPos(); + grammarErrorAtPos(questionStart, scanner.getStartPos() - questionStart, ts.Diagnostics.A_object_member_cannot_be_declared_optional); + nextToken(); + } + if (token !== 50 /* ColonToken */ && nameToken === 63 /* Identifier */) { + node = createNode(144 /* ShorthandPropertyAssignment */, nodePos); + node.name = propertyName; } else { + node = createNode(143 /* PropertyAssignment */, nodePos); + node.name = propertyName; parseExpected(50 /* ColonToken */); node.initializer = parseAssignmentExpression(false); } @@ -4035,7 +4114,7 @@ var ts; return parsePropertyAssignment(); } function parseObjectLiteral() { - var node = createNode(140 /* ObjectLiteral */); + var node = createNode(142 /* ObjectLiteral */); parseExpected(13 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 256 /* MultiLine */; @@ -4048,11 +4127,15 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; ts.forEach(node.properties, function (p) { - if (p.kind === 157 /* OmittedExpression */) { + if (p.kind === 160 /* OmittedExpression */) { return; } + var name = p.name; var currentKind; - if (p.kind === 141 /* PropertyAssignment */) { + if (p.kind === 143 /* PropertyAssignment */) { + currentKind = Property; + } + else if (p.kind === 144 /* ShorthandPropertyAssignment */) { currentKind = Property; } else if (p.kind === 127 /* GetAccessor */) { @@ -4064,26 +4147,26 @@ var ts; else { ts.Debug.fail("Unexpected syntax kind:" + p.kind); } - if (!ts.hasProperty(seen, p.name.text)) { - seen[p.name.text] = currentKind; + if (!ts.hasProperty(seen, name.text)) { + seen[name.text] = currentKind; } else { - var existingKind = seen[p.name.text]; + var existingKind = seen[name.text]; if (currentKind === Property && existingKind === Property) { if (isInStrictMode) { - grammarErrorOnNode(p.name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); } } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[p.name.text] = currentKind | existingKind; + seen[name.text] = currentKind | existingKind; } else { - grammarErrorOnNode(p.name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - grammarErrorOnNode(p.name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } }); @@ -4098,7 +4181,7 @@ var ts; if (name && isInStrictMode && isEvalOrArgumentsIdentifier(name)) { reportInvalidUseInStrictMode(name); } - return makeFunctionExpression(149 /* FunctionExpression */, pos, name, sig, body); + return makeFunctionExpression(152 /* FunctionExpression */, pos, name, sig, body); } function makeFunctionExpression(kind, pos, name, sig, body) { var node = createNode(kind, pos); @@ -4110,7 +4193,7 @@ var ts; return finishNode(node); } function parseNewExpression() { - var node = createNode(145 /* NewExpression */); + var node = createNode(148 /* NewExpression */); parseExpected(86 /* NewKeyword */); node.func = parseCallAndAccess(parsePrimaryExpression(), true); if (parseOptional(15 /* OpenParenToken */) || token === 23 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { @@ -4123,7 +4206,7 @@ var ts; return parseStatement(true); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode) { - var node = createNode(158 /* Block */); + var node = createNode(161 /* Block */); if (parseExpected(13 /* OpenBraceToken */) || ignoreMissingOpenBrace) { node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatementAllowingLetDeclaration); parseExpected(14 /* CloseBraceToken */); @@ -4146,7 +4229,7 @@ var ts; } labelledStatementInfo.pushFunctionBoundary(); var block = parseBlock(ignoreMissingOpenBrace, true); - block.kind = 183 /* FunctionBlock */; + block.kind = 186 /* FunctionBlock */; labelledStatementInfo.pop(); inFunctionBody = saveInFunctionBody; inSwitchStatement = saveInSwitchStatement; @@ -4154,12 +4237,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(160 /* EmptyStatement */); + var node = createNode(163 /* EmptyStatement */); parseExpected(21 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(162 /* IfStatement */); + var node = createNode(165 /* IfStatement */); parseExpected(82 /* IfKeyword */); parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); @@ -4169,7 +4252,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(163 /* DoStatement */); + var node = createNode(166 /* DoStatement */); parseExpected(73 /* DoKeyword */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; @@ -4183,7 +4266,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(164 /* WhileStatement */); + var node = createNode(167 /* WhileStatement */); parseExpected(98 /* WhileKeyword */); parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); @@ -4229,7 +4312,7 @@ var ts; } var forOrForInStatement; if (parseOptional(84 /* InKeyword */)) { - var forInStatement = createNode(166 /* ForInStatement */, pos); + var forInStatement = createNode(169 /* ForInStatement */, pos); if (declarations) { if (declarations.length > 1) { error(ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); @@ -4244,7 +4327,7 @@ var ts; forOrForInStatement = forInStatement; } else { - var forStatement = createNode(165 /* ForStatement */, pos); + var forStatement = createNode(168 /* ForStatement */, pos); if (declarations) forStatement.declarations = declarations; if (varOrInit) @@ -4269,7 +4352,7 @@ var ts; function parseBreakOrContinueStatement(kind) { var node = createNode(kind); var errorCountBeforeStatement = file.syntacticErrors.length; - parseExpected(kind === 168 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */); + parseExpected(kind === 171 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */); if (!canParseSemicolon()) node.label = parseIdentifier(); parseSemicolon(); @@ -4285,7 +4368,7 @@ var ts; return node; } function checkBareBreakOrContinueStatement(node) { - if (node.kind === 168 /* BreakStatement */) { + if (node.kind === 171 /* BreakStatement */) { if (inIterationStatement === 1 /* Nested */ || inSwitchStatement === 1 /* Nested */) { return; } @@ -4294,7 +4377,7 @@ var ts; return; } } - else if (node.kind === 167 /* ContinueStatement */) { + else if (node.kind === 170 /* ContinueStatement */) { if (inIterationStatement === 1 /* Nested */) { return; } @@ -4310,7 +4393,7 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } function checkBreakOrContinueStatementWithLabel(node) { - var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 167 /* ContinueStatement */, false); + var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 170 /* ContinueStatement */, false); if (nodeIsNestedInLabel === 1 /* Nested */) { return; } @@ -4318,10 +4401,10 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); return; } - if (node.kind === 167 /* ContinueStatement */) { + if (node.kind === 170 /* ContinueStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } - else if (node.kind === 168 /* BreakStatement */) { + else if (node.kind === 171 /* BreakStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement); } else { @@ -4329,7 +4412,7 @@ var ts; } } function parseReturnStatement() { - var node = createNode(169 /* ReturnStatement */); + var node = createNode(172 /* ReturnStatement */); var errorCountBeforeReturnStatement = file.syntacticErrors.length; var returnTokenStart = scanner.getTokenPos(); var returnTokenLength = scanner.getTextPos() - returnTokenStart; @@ -4343,7 +4426,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(170 /* WithStatement */); + var node = createNode(173 /* WithStatement */); var startPos = scanner.getTokenPos(); parseExpected(99 /* WithKeyword */); var endPos = scanner.getStartPos(); @@ -4358,7 +4441,7 @@ var ts; return node; } function parseCaseClause() { - var node = createNode(172 /* CaseClause */); + var node = createNode(175 /* CaseClause */); parseExpected(65 /* CaseKeyword */); node.expression = parseExpression(); parseExpected(50 /* ColonToken */); @@ -4366,7 +4449,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(173 /* DefaultClause */); + var node = createNode(176 /* DefaultClause */); parseExpected(71 /* DefaultKeyword */); parseExpected(50 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatementAllowingLetDeclaration); @@ -4376,7 +4459,7 @@ var ts; return token === 65 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(171 /* SwitchStatement */); + var node = createNode(174 /* SwitchStatement */); parseExpected(90 /* SwitchKeyword */); parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); @@ -4387,7 +4470,7 @@ var ts; node.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); inSwitchStatement = saveInSwitchStatement; parseExpected(14 /* CloseBraceToken */); - var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 173 /* DefaultClause */; }); + var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 176 /* DefaultClause */; }); for (var i = 1, n = defaultClauses.length; i < n; i++) { var clause = defaultClauses[i]; var start = ts.skipTrivia(file.text, clause.pos); @@ -4397,7 +4480,7 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(175 /* ThrowStatement */); + var node = createNode(178 /* ThrowStatement */); parseExpected(92 /* ThrowKeyword */); if (scanner.hasPrecedingLineBreak()) { error(ts.Diagnostics.Line_break_not_permitted_here); @@ -4407,13 +4490,13 @@ var ts; return finishNode(node); } function parseTryStatement() { - var node = createNode(176 /* TryStatement */); - node.tryBlock = parseTokenAndBlock(94 /* TryKeyword */, 177 /* TryBlock */); + var node = createNode(179 /* TryStatement */); + node.tryBlock = parseTokenAndBlock(94 /* TryKeyword */, 180 /* TryBlock */); if (token === 66 /* CatchKeyword */) { node.catchBlock = parseCatchBlock(); } if (token === 79 /* FinallyKeyword */) { - node.finallyBlock = parseTokenAndBlock(79 /* FinallyKeyword */, 179 /* FinallyBlock */); + node.finallyBlock = parseTokenAndBlock(79 /* FinallyKeyword */, 182 /* FinallyBlock */); } if (!(node.catchBlock || node.finallyBlock)) { error(ts.Diagnostics.catch_or_finally_expected); @@ -4438,7 +4521,7 @@ var ts; var typeAnnotation = parseTypeAnnotation(); parseExpected(16 /* CloseParenToken */); var result = parseBlock(false, false); - result.kind = 178 /* CatchBlock */; + result.kind = 181 /* CatchBlock */; result.pos = pos; result.variable = variable; if (typeAnnotation) { @@ -4450,7 +4533,7 @@ var ts; return result; } function parseDebuggerStatement() { - var node = createNode(180 /* DebuggerStatement */); + var node = createNode(183 /* DebuggerStatement */); parseExpected(70 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -4468,7 +4551,7 @@ var ts; return isIdentifier() && lookAhead(function () { return nextToken() === 50 /* ColonToken */; }); } function parseLabeledStatement(allowLetAndConstDeclarations) { - var node = createNode(174 /* LabeledStatement */); + var node = createNode(177 /* LabeledStatement */); node.label = parseIdentifier(); parseExpected(50 /* ColonToken */); if (labelledStatementInfo.nodeIsNestedInLabel(node.label, false, true)) { @@ -4479,7 +4562,7 @@ var ts; return finishNode(node); } function parseExpressionStatement() { - var node = createNode(161 /* ExpressionStatement */); + var node = createNode(164 /* ExpressionStatement */); node.expression = parseExpression(); parseSemicolon(); return finishNode(node); @@ -4550,9 +4633,9 @@ var ts; case 80 /* ForKeyword */: return parseForOrForInStatement(); case 69 /* ContinueKeyword */: - return parseBreakOrContinueStatement(167 /* ContinueStatement */); + return parseBreakOrContinueStatement(170 /* ContinueStatement */); case 64 /* BreakKeyword */: - return parseBreakOrContinueStatement(168 /* BreakStatement */); + return parseBreakOrContinueStatement(171 /* BreakStatement */); case 88 /* ReturnKeyword */: return parseReturnStatement(); case 99 /* WithKeyword */: @@ -4592,7 +4675,7 @@ var ts; error(ts.Diagnostics.Block_or_expected); } function parseVariableDeclaration(flags, noIn) { - var node = createNode(181 /* VariableDeclaration */); + var node = createNode(184 /* VariableDeclaration */); node.flags = flags; var errorCountBeforeVariableDeclaration = file.syntacticErrors.length; node.name = parseIdentifier(); @@ -4615,7 +4698,7 @@ var ts; return parseDelimitedList(9 /* VariableDeclarations */, function () { return parseVariableDeclaration(flags, noIn); }, false); } function parseVariableStatement(allowLetAndConstDeclarations, pos, flags) { - var node = createNode(159 /* VariableStatement */, pos); + var node = createNode(162 /* VariableStatement */, pos); if (flags) node.flags = flags; var errorCountBeforeVarStatement = file.syntacticErrors.length; @@ -4654,7 +4737,7 @@ var ts; return node; } function parseFunctionDeclaration(pos, flags) { - var node = createNode(182 /* FunctionDeclaration */, pos); + var node = createNode(185 /* FunctionDeclaration */, pos); if (flags) node.flags = flags; parseExpected(81 /* FunctionKeyword */); @@ -4664,7 +4747,7 @@ var ts; node.parameters = sig.parameters; node.type = sig.type; node.body = parseAndCheckFunctionBody(false); - if (isInStrictMode && isEvalOrArgumentsIdentifier(node.name)) { + if (isInStrictMode && isEvalOrArgumentsIdentifier(node.name) && node.name.kind === 63 /* Identifier */) { reportInvalidUseInStrictMode(node.name); } return finishNode(node); @@ -4965,7 +5048,7 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(pos, flags) { - var node = createNode(184 /* ClassDeclaration */, pos); + var node = createNode(187 /* ClassDeclaration */, pos); node.flags = flags; var errorCountBeforeClassDeclaration = file.syntacticErrors.length; parseExpected(67 /* ClassKeyword */); @@ -4992,7 +5075,7 @@ var ts; return finishNode(node); } function parseInterfaceDeclaration(pos, flags) { - var node = createNode(185 /* InterfaceDeclaration */, pos); + var node = createNode(188 /* InterfaceDeclaration */, pos); node.flags = flags; var errorCountBeforeInterfaceDeclaration = file.syntacticErrors.length; parseExpected(101 /* InterfaceKeyword */); @@ -5012,7 +5095,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(pos, flags) { - var node = createNode(186 /* TypeAliasDeclaration */, pos); + var node = createNode(189 /* TypeAliasDeclaration */, pos); node.flags = flags; parseExpected(119 /* TypeKeyword */); node.name = parseIdentifier(); @@ -5027,7 +5110,7 @@ var ts; function isInteger(literalExpression) { return /^[0-9]+([eE]\+?[0-9]+)?$/.test(literalExpression.text); } - if (expression.kind === 151 /* PrefixOperator */) { + if (expression.kind === 154 /* PrefixOperator */) { var unaryExpression = expression; if (unaryExpression.operator === 32 /* PlusToken */ || unaryExpression.operator === 33 /* MinusToken */) { expression = unaryExpression.operand; @@ -5040,7 +5123,7 @@ var ts; } var inConstantEnumMemberSection = true; function parseAndCheckEnumMember() { - var node = createNode(192 /* EnumMember */); + var node = createNode(195 /* EnumMember */); var errorCountBeforeEnumMember = file.syntacticErrors.length; node.name = parsePropertyName(); node.initializer = parseInitializer(false); @@ -5059,7 +5142,7 @@ var ts; } return finishNode(node); } - var node = createNode(187 /* EnumDeclaration */, pos); + var node = createNode(190 /* EnumDeclaration */, pos); node.flags = flags; if (enumIsConst) { parseExpected(68 /* ConstKeyword */); @@ -5076,7 +5159,7 @@ var ts; return finishNode(node); } function parseModuleBody() { - var node = createNode(189 /* ModuleBlock */); + var node = createNode(192 /* ModuleBlock */); if (parseExpected(13 /* OpenBraceToken */)) { node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); parseExpected(14 /* CloseBraceToken */); @@ -5087,7 +5170,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(pos, flags) { - var node = createNode(188 /* ModuleDeclaration */, pos); + var node = createNode(191 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseIdentifier(); if (parseOptional(19 /* DotToken */)) { @@ -5096,10 +5179,10 @@ var ts; else { node.body = parseModuleBody(); ts.forEach(node.body.statements, function (s) { - if (s.kind === 191 /* ExportAssignment */) { + if (s.kind === 194 /* ExportAssignment */) { grammarErrorOnNode(s, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } - else if (s.kind === 190 /* ImportDeclaration */ && s.externalModuleName) { + else if (s.kind === 193 /* ImportDeclaration */ && s.externalModuleName) { grammarErrorOnNode(s, ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); } }); @@ -5107,7 +5190,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(pos, flags) { - var node = createNode(188 /* ModuleDeclaration */, pos); + var node = createNode(191 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseStringLiteral(); if (!inAmbientContext) { @@ -5127,7 +5210,7 @@ var ts; return token === 7 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(pos, flags) : parseInternalModuleTail(pos, flags); } function parseImportDeclaration(pos, flags) { - var node = createNode(190 /* ImportDeclaration */, pos); + var node = createNode(193 /* ImportDeclaration */, pos); node.flags = flags; parseExpected(83 /* ImportKeyword */); node.name = parseIdentifier(); @@ -5144,7 +5227,7 @@ var ts; return finishNode(node); } function parseExportAssignmentTail(pos) { - var node = createNode(191 /* ExportAssignment */, pos); + var node = createNode(194 /* ExportAssignment */, pos); node.exportName = parseIdentifier(); parseSemicolon(); return finishNode(node); @@ -5269,27 +5352,16 @@ var ts; for (var i = 0; i < commentRanges.length; i++) { var range = commentRanges[i]; var comment = sourceText.substring(range.pos, range.end); - var simpleReferenceRegEx = /^\/\/\/\s*/gim; - if (isNoDefaultLibRegEx.exec(comment)) { - file.hasNoDefaultLib = true; + var referencePathMatchResult = getFileReferenceFromReferencePath(comment, range); + if (referencePathMatchResult) { + var fileReference = referencePathMatchResult.fileReference; + file.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var diagnostic = referencePathMatchResult.diagnostic; + if (fileReference) { + referencedFiles.push(fileReference); } - else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - var start = range.pos; - var end = range.end; - var length = end - start; - if (!matchResult) { - errorAtPos(start, length, ts.Diagnostics.Invalid_reference_directive_syntax); - } - else { - referencedFiles.push({ - pos: start, - end: end, - filename: matchResult[3] - }); - } + if (diagnostic) { + errorAtPos(range.pos, range.end - range.pos, diagnostic); } } else { @@ -5307,7 +5379,7 @@ var ts; }; } function getExternalModuleIndicator() { - return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 190 /* ImportDeclaration */ && node.externalModuleName || node.kind === 191 /* ExportAssignment */ ? node : undefined; }); + return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 193 /* ImportDeclaration */ && node.externalModuleName || node.kind === 194 /* ExportAssignment */ ? node : undefined; }); } scanner = ts.createScanner(languageVersion, true, sourceText, scanError, onComment); var rootNodeFlags = 0; @@ -5315,11 +5387,12 @@ var ts; rootNodeFlags = 1024 /* DeclarationFile */; inAmbientContext = true; } - file = createRootNode(193 /* SourceFile */, 0, sourceText.length, rootNodeFlags); + file = createRootNode(196 /* SourceFile */, 0, sourceText.length, rootNodeFlags); file.filename = ts.normalizePath(filename); file.text = sourceText; - file.getLineAndCharacterFromPosition = getLineAndCharacterlFromSourcePosition; + file.getLineAndCharacterFromPosition = getLineAndCharacterFromSourcePosition; file.getPositionFromLineAndCharacter = getPositionFromSourceLineAndCharacter; + file.getLineStarts = getLineStarts; file.syntacticErrors = []; file.semanticErrors = []; var referenceComments = processReferenceComments(); @@ -5448,7 +5521,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 190 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 193 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5466,9 +5539,9 @@ var ts; } } } - else if (node.kind === 188 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || isDeclarationFile(file))) { + else if (node.kind === 191 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || isDeclarationFile(file))) { forEachChild(node.body, function (node) { - if (node.kind === 190 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 193 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5541,16 +5614,16 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 185 /* InterfaceDeclaration */) { + if (node.kind === 188 /* InterfaceDeclaration */) { return 0 /* NonInstantiated */; } - else if (node.kind === 187 /* EnumDeclaration */ && ts.isConstEnumDeclaration(node)) { + else if (node.kind === 190 /* EnumDeclaration */ && ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if (node.kind === 190 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { + else if (node.kind === 193 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 189 /* ModuleBlock */) { + else if (node.kind === 192 /* ModuleBlock */) { var state = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -5566,7 +5639,7 @@ var ts; }); return state; } - else if (node.kind === 188 /* ModuleDeclaration */) { + else if (node.kind === 191 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -5606,20 +5679,26 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 188 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { + if (node.kind === 191 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { return '"' + node.name.text + '"'; } return node.name.text; } switch (node.kind) { - case 126 /* Constructor */: return "__constructor"; - case 129 /* CallSignature */: return "__call"; - case 130 /* ConstructSignature */: return "__new"; - case 131 /* IndexSignature */: return "__index"; + case 134 /* ConstructorType */: + case 126 /* Constructor */: + return "__constructor"; + case 133 /* FunctionType */: + case 129 /* CallSignature */: + return "__call"; + case 130 /* ConstructSignature */: + return "__new"; + case 131 /* IndexSignature */: + return "__index"; } } function getDisplayName(node) { - return node.name ? ts.identifierToString(node.name) : getDeclarationName(node); + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); } function declareSymbol(symbols, parent, node, includes, excludes) { var name = getDeclarationName(node); @@ -5642,7 +5721,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 184 /* ClassDeclaration */ && symbol.exports) { + if (node.kind === 187 /* ClassDeclaration */ && symbol.exports) { var prototypeSymbol = createSymbol(4 /* Property */ | 536870912 /* Prototype */, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -5674,7 +5753,7 @@ var ts; if (symbolKind & 1536 /* Namespace */) { exportKind |= 16777216 /* ExportNamespace */; } - if (node.flags & 1 /* Export */ || (node.kind !== 190 /* ImportDeclaration */ && isAmbientContext(container))) { + if (node.flags & 1 /* Export */ || (node.kind !== 193 /* ImportDeclaration */ && isAmbientContext(container))) { if (exportKind) { var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -5715,14 +5794,16 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } + case 133 /* FunctionType */: + case 134 /* ConstructorType */: case 129 /* CallSignature */: case 130 /* ConstructSignature */: case 131 /* IndexSignature */: @@ -5730,22 +5811,22 @@ var ts; case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: if (node.flags & 128 /* Static */) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 134 /* TypeLiteral */: - case 140 /* ObjectLiteral */: - case 185 /* InterfaceDeclaration */: + case 136 /* TypeLiteral */: + case 142 /* ObjectLiteral */: + case 188 /* InterfaceDeclaration */: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -5779,6 +5860,16 @@ var ts; } } } + function bindFunctionOrConstructorType(node) { + var symbolKind = node.kind === 133 /* FunctionType */ ? 131072 /* CallSignature */ : 262144 /* ConstructSignature */; + var symbol = createSymbol(symbolKind, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, symbolKind); + bindChildren(node, symbolKind, false); + var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); + typeLiteralSymbol.members = {}; + typeLiteralSymbol.members[node.kind === 133 /* FunctionType */ ? "__call" : "__new"] = symbol; + } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { var symbol = createSymbol(symbolKind, name); addDeclarationToSymbol(symbol, node, symbolKind); @@ -5796,10 +5887,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); break; - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); break; @@ -5821,7 +5912,7 @@ var ts; case 123 /* Parameter */: bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false); break; - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: if (node.flags & 6144 /* BlockScoped */) { bindBlockScopedVariableDeclaration(node); } @@ -5830,25 +5921,26 @@ var ts; } break; case 124 /* Property */: - case 141 /* PropertyAssignment */: + case 143 /* PropertyAssignment */: + case 144 /* ShorthandPropertyAssignment */: bindDeclaration(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); break; - case 192 /* EnumMember */: + case 195 /* EnumMember */: bindDeclaration(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); break; case 129 /* CallSignature */: bindDeclaration(node, 131072 /* CallSignature */, 0, false); break; - case 125 /* Method */: - bindDeclaration(node, 8192 /* Method */, 99263 /* MethodExcludes */, true); - break; case 130 /* ConstructSignature */: bindDeclaration(node, 262144 /* ConstructSignature */, 0, true); break; + case 125 /* Method */: + bindDeclaration(node, 8192 /* Method */, 99263 /* MethodExcludes */, true); + break; case 131 /* IndexSignature */: bindDeclaration(node, 524288 /* IndexSignature */, 0, false); break; - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: bindDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */, true); break; case 126 /* Constructor */: @@ -5860,29 +5952,33 @@ var ts; case 128 /* SetAccessor */: bindDeclaration(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); break; - case 134 /* TypeLiteral */: + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + bindFunctionOrConstructorType(node); + break; + case 136 /* TypeLiteral */: bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type", false); break; - case 140 /* ObjectLiteral */: + case 142 /* ObjectLiteral */: bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object", false); break; - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: bindAnonymousDeclaration(node, 16 /* Function */, "__function", true); break; - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: bindCatchVariableDeclaration(node); break; - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: bindDeclaration(node, 32 /* Class */, 3258879 /* ClassExcludes */, false); break; - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: bindDeclaration(node, 64 /* Interface */, 3152288 /* InterfaceExcludes */, false); break; - case 186 /* TypeAliasDeclaration */: + case 189 /* TypeAliasDeclaration */: bindDeclaration(node, 2097152 /* TypeAlias */, 3152352 /* TypeAliasExcludes */, false); break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: if (ts.isConstEnumDeclaration(node)) { bindDeclaration(node, 128 /* ConstEnum */, 3259263 /* ConstEnumExcludes */, false); } @@ -5890,24 +5986,24 @@ var ts; bindDeclaration(node, 256 /* RegularEnum */, 3258623 /* RegularEnumExcludes */, false); } break; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: bindModuleDeclaration(node); break; - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: bindDeclaration(node, 33554432 /* Import */, 33554432 /* ImportExcludes */, false); break; - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512 /* ValueModule */, '"' + ts.removeFileExtension(node.filename) + '"', true); break; } - case 158 /* Block */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 171 /* SwitchStatement */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 174 /* SwitchStatement */: bindChildren(node, 0, true); break; default: @@ -6024,7 +6120,7 @@ var ts; function writeLiteral(s) { if (s && s.length) { write(s); - var lineStartsOfS = ts.getLineStarts(s); + var lineStartsOfS = ts.computeLineStarts(s); if (lineStartsOfS.length > 1) { lineCount = lineCount + lineStartsOfS.length - 1; linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1]; @@ -6310,7 +6406,7 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 182 /* FunctionDeclaration */ || node.kind === 149 /* FunctionExpression */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */ || node.kind === 188 /* ModuleDeclaration */ || node.kind === 184 /* ClassDeclaration */ || node.kind === 187 /* EnumDeclaration */) { + else if (node.kind === 185 /* FunctionDeclaration */ || node.kind === 152 /* FunctionExpression */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */ || node.kind === 191 /* ModuleDeclaration */ || node.kind === 187 /* ClassDeclaration */ || node.kind === 190 /* EnumDeclaration */) { if (node.name) { scopeName = node.name.text; } @@ -6392,7 +6488,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 193 /* SourceFile */) { + if (node.kind != 196 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -6501,14 +6597,14 @@ var ts; ts.forEachChild(node, emit); return; } - ts.Debug.assert(node.parent.kind !== 146 /* TaggedTemplateExpression */); - var templateNeedsParens = ts.isExpression(node.parent) && node.parent.kind !== 148 /* ParenExpression */ && comparePrecedenceToBinaryPlus(node.parent) !== -1 /* LessThan */; + ts.Debug.assert(node.parent.kind !== 149 /* TaggedTemplateExpression */); + var templateNeedsParens = ts.isExpression(node.parent) && node.parent.kind !== 151 /* ParenExpression */ && comparePrecedenceToBinaryPlus(node.parent) !== -1 /* LessThan */; if (templateNeedsParens) { write("("); } emitLiteral(node.head); ts.forEach(node.templateSpans, function (templateSpan) { - var needsParens = templateSpan.expression.kind !== 148 /* ParenExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; + var needsParens = templateSpan.expression.kind !== 151 /* ParenExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; write(" + "); if (needsParens) { write("("); @@ -6528,7 +6624,7 @@ var ts; function comparePrecedenceToBinaryPlus(expression) { ts.Debug.assert(compilerOptions.target <= 1 /* ES5 */); switch (expression.kind) { - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: switch (expression.operator) { case 34 /* AsteriskToken */: case 35 /* SlashToken */: @@ -6539,7 +6635,7 @@ var ts; default: return -1 /* LessThan */; } - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -6550,7 +6646,7 @@ var ts; emit(span.expression); emit(span.literal); } - function emitQuotedIdentifier(node) { + function emitExpressionForPropertyName(node) { if (node.kind === 7 /* StringLiteral */) { emitLiteral(node); } @@ -6565,45 +6661,52 @@ var ts; write("\""); } } - function isNonExpressionIdentifier(node) { + function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { case 123 /* Parameter */: - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 124 /* Property */: - case 141 /* PropertyAssignment */: - case 192 /* EnumMember */: + case 143 /* PropertyAssignment */: + case 144 /* ShorthandPropertyAssignment */: + case 195 /* EnumMember */: case 125 /* Method */: - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 149 /* FunctionExpression */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 187 /* EnumDeclaration */: - case 188 /* ModuleDeclaration */: - case 190 /* ImportDeclaration */: + case 152 /* FunctionExpression */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: + case 191 /* ModuleDeclaration */: + case 193 /* ImportDeclaration */: return parent.name === node; - case 168 /* BreakStatement */: - case 167 /* ContinueStatement */: - case 191 /* ExportAssignment */: + case 171 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 194 /* ExportAssignment */: return false; - case 174 /* LabeledStatement */: + case 177 /* LabeledStatement */: return node.parent.label === node; - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: return node.parent.variable === node; } } - function emitIdentifier(node) { - if (!isNonExpressionIdentifier(node)) { - var prefix = resolver.getExpressionNamePrefix(node); - if (prefix) { - write(prefix); - write("."); - } + function emitExpressionIdentifier(node) { + var prefix = resolver.getExpressionNamePrefix(node); + if (prefix) { + write(prefix); + write("."); } write(getSourceTextOfLocalNode(node)); } + function emitIdentifier(node) { + if (!isNotExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else { + write(getSourceTextOfLocalNode(node)); + } + } function emitThis(node) { if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { write("_this"); @@ -6664,10 +6767,33 @@ var ts; emit(node.initializer); emitTrailingComments(node); } + function emitShortHandPropertyAssignment(node) { + function emitAsNormalPropertyAssignment() { + emitLeadingComments(node); + emit(node.name); + write(": "); + emitExpressionIdentifier(node.name); + emitTrailingComments(node); + } + if (compilerOptions.target < 2 /* ES6 */) { + emitAsNormalPropertyAssignment(); + } + else if (compilerOptions.target >= 2 /* ES6 */) { + var prefix = resolver.getExpressionNamePrefix(node.name); + if (prefix) { + emitAsNormalPropertyAssignment(); + } + else { + emitLeadingComments(node); + emit(node.name); + emitTrailingComments(node); + } + } + } function tryEmitConstantValue(node) { var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { - var propertyName = node.kind === 142 /* PropertyAccess */ ? ts.identifierToString(node.right) : ts.getTextOfNode(node.index); + var propertyName = node.kind === 145 /* PropertyAccess */ ? ts.declarationNameToString(node.right) : ts.getTextOfNode(node.index); write(constantValue.toString() + " /* " + propertyName + " */"); return true; } @@ -6698,7 +6824,7 @@ var ts; } else { emit(node.func); - superCall = node.func.kind === 142 /* PropertyAccess */ && node.func.left.kind === 89 /* SuperKeyword */; + superCall = node.func.kind === 145 /* PropertyAccess */ && node.func.left.kind === 89 /* SuperKeyword */; } if (superCall) { write(".call("); @@ -6731,12 +6857,12 @@ var ts; emit(node.template); } function emitParenExpression(node) { - if (node.expression.kind === 147 /* TypeAssertion */) { + if (node.expression.kind === 150 /* TypeAssertion */) { var operand = node.expression.operand; - while (operand.kind == 147 /* TypeAssertion */) { + while (operand.kind == 150 /* TypeAssertion */) { operand = operand.operand; } - if (operand.kind !== 151 /* PrefixOperator */ && operand.kind !== 152 /* PostfixOperator */ && operand.kind !== 145 /* NewExpression */ && !(operand.kind === 144 /* CallExpression */ && node.parent.kind === 145 /* NewExpression */) && !(operand.kind === 149 /* FunctionExpression */ && node.parent.kind === 144 /* CallExpression */)) { + if (operand.kind !== 154 /* PrefixOperator */ && operand.kind !== 155 /* PostfixOperator */ && operand.kind !== 148 /* NewExpression */ && !(operand.kind === 147 /* CallExpression */ && node.parent.kind === 148 /* NewExpression */) && !(operand.kind === 152 /* FunctionExpression */ && node.parent.kind === 147 /* CallExpression */)) { emit(operand); return; } @@ -6746,13 +6872,13 @@ var ts; write(")"); } function emitUnaryExpression(node) { - if (node.kind === 151 /* PrefixOperator */) { + if (node.kind === 154 /* PrefixOperator */) { write(ts.tokenToString(node.operator)); } if (node.operator >= 63 /* Identifier */) { write(" "); } - else if (node.kind === 151 /* PrefixOperator */ && node.operand.kind === 151 /* PrefixOperator */) { + else if (node.kind === 154 /* PrefixOperator */ && node.operand.kind === 154 /* PrefixOperator */) { var operand = node.operand; if (node.operator === 32 /* PlusToken */ && (operand.operator === 32 /* PlusToken */ || operand.operator === 37 /* PlusPlusToken */)) { write(" "); @@ -6762,7 +6888,7 @@ var ts; } } emit(node.operand); - if (node.kind === 152 /* PostfixOperator */) { + if (node.kind === 155 /* PostfixOperator */) { write(ts.tokenToString(node.operator)); } } @@ -6785,8 +6911,8 @@ var ts; emitToken(13 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 189 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 188 /* ModuleDeclaration */); + if (node.kind === 192 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 191 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); @@ -6796,7 +6922,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 158 /* Block */) { + if (node.kind === 161 /* Block */) { write(" "); emit(node); } @@ -6808,7 +6934,7 @@ var ts; } } function emitExpressionStatement(node) { - var isArrowExpression = node.expression.kind === 150 /* ArrowFunction */; + var isArrowExpression = node.expression.kind === 153 /* ArrowFunction */; emitLeadingComments(node); if (isArrowExpression) write("("); @@ -6829,7 +6955,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(74 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 162 /* IfStatement */) { + if (node.elseStatement.kind === 165 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -6842,7 +6968,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 158 /* Block */) { + if (node.statement.kind === 161 /* Block */) { write(" "); } else { @@ -6908,7 +7034,7 @@ var ts; emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 168 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 171 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } @@ -6943,7 +7069,7 @@ var ts; return getLineOfLocalPosition(ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 172 /* CaseClause */) { + if (node.kind === 175 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -6998,7 +7124,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 188 /* ModuleDeclaration */); + } while (node && node.kind !== 191 /* ModuleDeclaration */); return node; } function emitModuleMemberName(node) { @@ -7110,7 +7236,7 @@ var ts; emitLeadingComments(node); } write("function "); - if (node.kind === 182 /* FunctionDeclaration */ || (node.kind === 149 /* FunctionExpression */ && node.name)) { + if (node.kind === 185 /* FunctionDeclaration */ || (node.kind === 152 /* FunctionExpression */ && node.name)) { emit(node.name); } emitSignatureAndBody(node); @@ -7140,16 +7266,16 @@ var ts; write(" {"); scopeEmitStart(node); increaseIndent(); - emitDetachedComments(node.body.kind === 183 /* FunctionBlock */ ? node.body.statements : node.body); + emitDetachedComments(node.body.kind === 186 /* FunctionBlock */ ? node.body.statements : node.body); var startIndex = 0; - if (node.body.kind === 183 /* FunctionBlock */) { + if (node.body.kind === 186 /* FunctionBlock */) { startIndex = emitDirectivePrologues(node.body.statements, true); } var outPos = writer.getTextPos(); emitCaptureThisForNodeIfNecessary(node); emitDefaultValueAssignments(node); emitRestParameter(node); - if (node.body.kind !== 183 /* FunctionBlock */ && outPos === writer.getTextPos()) { + if (node.body.kind !== 186 /* FunctionBlock */ && outPos === writer.getTextPos()) { decreaseIndent(); write(" "); emitStart(node.body); @@ -7162,7 +7288,7 @@ var ts; emitEnd(node.body); } else { - if (node.body.kind === 183 /* FunctionBlock */) { + if (node.body.kind === 186 /* FunctionBlock */) { emitLinesStartingAt(node.body.statements, startIndex); } else { @@ -7174,7 +7300,7 @@ var ts; emitTrailingComments(node.body); } writeLine(); - if (node.body.kind === 183 /* FunctionBlock */) { + if (node.body.kind === 186 /* FunctionBlock */) { emitLeadingCommentsOfPosition(node.body.statements.end); decreaseIndent(); emitToken(14 /* CloseBraceToken */, node.body.statements.end); @@ -7200,9 +7326,9 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 161 /* ExpressionStatement */) { + if (statement && statement.kind === 164 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 144 /* CallExpression */) { + if (expr && expr.kind === 147 /* CallExpression */) { var func = expr.func; if (func && func.kind === 89 /* SuperKeyword */) { return statement; @@ -7297,7 +7423,7 @@ var ts; write(".prototype"); } write(", "); - emitQuotedIdentifier(member.name); + emitExpressionForPropertyName(member.name); emitEnd(member.name); write(", {"); increaseIndent(); @@ -7503,7 +7629,7 @@ var ts; write("["); write(resolver.getLocalNameOfContainer(node)); write("["); - emitQuotedIdentifier(member.name); + emitExpressionForPropertyName(member.name); write("] = "); if (member.initializer && !isConstEnum) { emit(member.initializer); @@ -7512,7 +7638,7 @@ var ts; write(resolver.getEnumMemberValue(member).toString()); } write("] = "); - emitQuotedIdentifier(member.name); + emitExpressionForPropertyName(member.name); emitEnd(member); write(";"); emitTrailingComments(member); @@ -7520,7 +7646,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 188 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 191 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -7542,7 +7668,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 189 /* ModuleBlock */) { + if (node.body.kind === 192 /* ModuleBlock */) { emit(node.body); } else { @@ -7576,7 +7702,7 @@ var ts; emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); } if (emitImportDeclaration) { - if (node.externalModuleName && node.parent.kind === 193 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { + if (node.externalModuleName && node.parent.kind === 196 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { if (node.flags & 1 /* Export */) { writeLine(); emitLeadingComments(node); @@ -7616,7 +7742,7 @@ var ts; function getExternalImportDeclarations(node) { var result = []; ts.forEach(node.statements, function (stat) { - if (stat.kind === 190 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { + if (stat.kind === 193 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { result.push(stat); } }); @@ -7624,7 +7750,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 191 /* ExportAssignment */) { + if (node.kind === 194 /* ExportAssignment */) { return node; } }); @@ -7765,102 +7891,104 @@ var ts; case 11 /* TemplateMiddle */: case 12 /* TemplateTail */: return emitLiteral(node); - case 155 /* TemplateExpression */: + case 158 /* TemplateExpression */: return emitTemplateExpression(node); - case 156 /* TemplateSpan */: + case 159 /* TemplateSpan */: return emitTemplateSpan(node); case 121 /* QualifiedName */: return emitPropertyAccess(node); - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: return emitArrayLiteral(node); - case 140 /* ObjectLiteral */: + case 142 /* ObjectLiteral */: return emitObjectLiteral(node); - case 141 /* PropertyAssignment */: + case 143 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 142 /* PropertyAccess */: + case 144 /* ShorthandPropertyAssignment */: + return emitShortHandPropertyAssignment(node); + case 145 /* PropertyAccess */: return emitPropertyAccess(node); - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: return emitIndexedAccess(node); - case 144 /* CallExpression */: + case 147 /* CallExpression */: return emitCallExpression(node); - case 145 /* NewExpression */: + case 148 /* NewExpression */: return emitNewExpression(node); - case 146 /* TaggedTemplateExpression */: + case 149 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return emit(node.operand); - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return emitParenExpression(node); - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: return emitUnaryExpression(node); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return emitBinaryExpression(node); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return emitConditionalExpression(node); - case 157 /* OmittedExpression */: + case 160 /* OmittedExpression */: return; - case 158 /* Block */: - case 177 /* TryBlock */: - case 179 /* FinallyBlock */: - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 182 /* FinallyBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: return emitBlock(node); - case 159 /* VariableStatement */: + case 162 /* VariableStatement */: return emitVariableStatement(node); - case 160 /* EmptyStatement */: + case 163 /* EmptyStatement */: return write(";"); - case 161 /* ExpressionStatement */: + case 164 /* ExpressionStatement */: return emitExpressionStatement(node); - case 162 /* IfStatement */: + case 165 /* IfStatement */: return emitIfStatement(node); - case 163 /* DoStatement */: + case 166 /* DoStatement */: return emitDoStatement(node); - case 164 /* WhileStatement */: + case 167 /* WhileStatement */: return emitWhileStatement(node); - case 165 /* ForStatement */: + case 168 /* ForStatement */: return emitForStatement(node); - case 166 /* ForInStatement */: + case 169 /* ForInStatement */: return emitForInStatement(node); - case 167 /* ContinueStatement */: - case 168 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 171 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 169 /* ReturnStatement */: + case 172 /* ReturnStatement */: return emitReturnStatement(node); - case 170 /* WithStatement */: + case 173 /* WithStatement */: return emitWithStatement(node); - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: return emitSwitchStatement(node); - case 172 /* CaseClause */: - case 173 /* DefaultClause */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 174 /* LabeledStatement */: + case 177 /* LabeledStatement */: return emitLabelledStatement(node); - case 175 /* ThrowStatement */: + case 178 /* ThrowStatement */: return emitThrowStatement(node); - case 176 /* TryStatement */: + case 179 /* TryStatement */: return emitTryStatement(node); - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: return emitCatchBlock(node); - case 180 /* DebuggerStatement */: + case 183 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return emitClassDeclaration(node); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return emitImportDeclaration(node); - case 193 /* SourceFile */: + case 196 /* SourceFile */: return emitSourceFile(node); } } @@ -7878,7 +8006,7 @@ var ts; return leadingComments; } function getLeadingCommentsToEmit(node) { - if (node.parent.kind === 193 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 196 /* SourceFile */ || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -7895,7 +8023,7 @@ var ts; emitComments(leadingComments, true, writer, writeComment); } function emitTrailingDeclarationComments(node) { - if (node.parent.kind === 193 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 196 /* SourceFile */ || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(trailingComments, false, writer, writeComment); } @@ -8087,7 +8215,7 @@ var ts; if (node.flags & 1 /* Export */) { write("export "); } - if (node.kind !== 185 /* InterfaceDeclaration */) { + if (node.kind !== 188 /* InterfaceDeclaration */) { write("declare "); } } @@ -8143,7 +8271,7 @@ var ts; emitDeclarationFlags(node); write("module "); emitSourceTextOfNode(node.name); - while (node.body.kind !== 189 /* ModuleBlock */) { + while (node.body.kind !== 192 /* ModuleBlock */) { node = node.body; write("."); emitSourceTextOfNode(node.name); @@ -8215,10 +8343,10 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 130 /* ConstructSignature */: @@ -8231,14 +8359,14 @@ var ts; if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 184 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 187 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8276,7 +8404,7 @@ var ts; resolver.writeTypeAtLocation(node, enclosingDeclaration, 1 /* WriteArrayAsGenericType */ | 2 /* UseTypeOfFunction */, writer); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.kind === 184 /* ClassDeclaration */) { + if (node.parent.kind === 187 /* ClassDeclaration */) { if (symbolAccesibilityResult.errorModuleName) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2; } @@ -8361,7 +8489,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 181 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 184 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { emitSourceTextOfNode(node.name); if (node.kind === 124 /* Property */ && (node.flags & 4 /* QuestionMark */)) { write("?"); @@ -8374,14 +8502,14 @@ var ts; } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 181 /* VariableDeclaration */) { + if (node.kind === 184 /* VariableDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 124 /* Property */) { if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 184 /* ClassDeclaration */) { + else if (node.parent.kind === 187 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { @@ -8460,10 +8588,10 @@ var ts; } } function emitFunctionDeclaration(node) { - if ((node.kind !== 182 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 185 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); emitDeclarationFlags(node); - if (node.kind === 182 /* FunctionDeclaration */) { + if (node.kind === 185 /* FunctionDeclaration */) { write("function "); emitSourceTextOfNode(node.name); } @@ -8525,14 +8653,14 @@ var ts; if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 184 /* ClassDeclaration */) { + else if (node.parent.kind === 187 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -8576,14 +8704,14 @@ var ts; if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 184 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 187 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8599,7 +8727,7 @@ var ts; function emitNode(node) { switch (node.kind) { case 126 /* Constructor */: - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: case 125 /* Method */: return emitFunctionDeclaration(node); case 130 /* ConstructSignature */: @@ -8610,27 +8738,27 @@ var ts; case 127 /* GetAccessor */: case 128 /* SetAccessor */: return emitAccessorDeclaration(node); - case 159 /* VariableStatement */: + case 162 /* VariableStatement */: return emitVariableStatement(node); case 124 /* Property */: return emitPropertyDeclaration(node); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return emitClassDeclaration(node); - case 186 /* TypeAliasDeclaration */: + case 189 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 192 /* EnumMember */: + case 195 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return emitImportDeclaration(node); - case 191 /* ExportAssignment */: + case 194 /* ExportAssignment */: return emitExportAssignment(node); - case 193 /* SourceFile */: + case 196 /* SourceFile */: return emitSourceFile(node); } } @@ -8692,9 +8820,9 @@ var ts; } } var hasSemanticErrors = resolver.hasSemanticErrors(); - var hasEarlyErrors = resolver.hasEarlyErrors(targetSourceFile); + var isEmitBlocked = resolver.isEmitBlocked(targetSourceFile); function emitFile(jsFilePath, sourceFile) { - if (!hasEarlyErrors) { + if (!isEmitBlocked) { emitJavaScript(jsFilePath, sourceFile); if (!hasSemanticErrors && compilerOptions.declaration) { emitDeclarations(jsFilePath, sourceFile); @@ -8725,7 +8853,7 @@ var ts; diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); var hasEmitterError = ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); var returnCode; - if (hasEarlyErrors) { + if (isEmitBlocked) { returnCode = 1 /* AllOutputGenerationSkipped */; } else if (hasEmitterError) { @@ -8810,7 +8938,7 @@ var ts; checkProgram: checkProgram, emitFiles: invokeEmitter, getParentOfSymbol: getParentOfSymbol, - getTypeOfSymbol: getTypeOfSymbol, + getNarrowedTypeOfSymbol: getNarrowedTypeOfSymbol, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, @@ -8819,6 +8947,7 @@ var ts; getReturnTypeOfSignature: getReturnTypeOfSignature, getSymbolsInScope: getSymbolsInScope, getSymbolInfo: getSymbolInfo, + getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, getTypeOfNode: getTypeOfNode, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, @@ -8835,7 +8964,8 @@ var ts; getAliasedSymbol: resolveImport, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, - hasEarlyErrors: hasEarlyErrors + hasEarlyErrors: hasEarlyErrors, + isEmitBlocked: isEmitBlocked }; var undefinedSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "undefined"); var argumentsSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "arguments"); @@ -8865,6 +8995,7 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; + var globalTemplateStringsArrayType; var tupleTypes = {}; var unionTypes = {}; var stringLiteralTypes = {}; @@ -9013,10 +9144,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 193 /* SourceFile */); + return ts.getAncestor(node, 196 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 193 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 196 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -9057,21 +9188,21 @@ var ts; } } switch (location.kind) { - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 35653619 /* ModuleMember */)) { break loop; } break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; case 124 /* Property */: - if (location.parent.kind === 184 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { + if (location.parent.kind === 187 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { @@ -9080,8 +9211,8 @@ var ts; } } break; - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 3152352 /* Type */)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -9094,14 +9225,14 @@ var ts; case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 182 /* FunctionDeclaration */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 153 /* ArrowFunction */: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 149 /* FunctionExpression */: + case 152 /* FunctionExpression */: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -9112,7 +9243,7 @@ var ts; break loop; } break; - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: var id = location.variable; if (name === id.text) { result = location.symbol; @@ -9128,21 +9259,21 @@ var ts; } if (!result) { if (nameNotFoundMessage) { - error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.identifierToString(nameArg)); + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } return undefined; } if (nameNotFoundMessage) { if (propertyWithInvalidInitializer) { var propertyName = propertyWithInvalidInitializer.name; - error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.identifierToString(propertyName), typeof nameArg === "string" ? nameArg : ts.identifierToString(nameArg)); + error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); return undefined; } if (result.flags & 2 /* BlockScopedVariable */) { var declaration = ts.forEach(result.declarations, function (d) { return d.flags & 6144 /* BlockScoped */ ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); if (!isDefinedBefore(declaration, errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.identifierToString(declaration.name)); + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } } @@ -9153,7 +9284,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = getDeclarationOfKind(symbol, 190 /* ImportDeclaration */); + var node = getDeclarationOfKind(symbol, 193 /* ImportDeclaration */); var target = node.externalModuleName ? resolveExternalModuleName(node, node.externalModuleName) : getSymbolOfPartOfRightHandSideOfImport(node.entityName, node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; @@ -9169,7 +9300,7 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 190 /* ImportDeclaration */); + importDeclaration = ts.getAncestor(entityName, 193 /* ImportDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 63 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { @@ -9179,7 +9310,7 @@ var ts; return resolveEntityName(importDeclaration, entityName, 1536 /* Namespace */); } else { - ts.Debug.assert(entityName.parent.kind === 190 /* ImportDeclaration */); + ts.Debug.assert(entityName.parent.kind === 193 /* ImportDeclaration */); return resolveEntityName(importDeclaration, entityName, 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */); } } @@ -9199,7 +9330,7 @@ var ts; return; var symbol = getSymbol(namespace.exports, name.right.text, meaning); if (!symbol) { - error(location, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.identifierToString(name.right)); + error(location, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(name.right)); return; } } @@ -9284,9 +9415,9 @@ var ts; var seenExportedMember = false; var result = []; ts.forEach(symbol.declarations, function (declaration) { - var block = (declaration.kind === 193 /* SourceFile */ ? declaration : declaration.body); + var block = (declaration.kind === 196 /* SourceFile */ ? declaration : declaration.body); ts.forEach(block.statements, function (node) { - if (node.kind === 191 /* ExportAssignment */) { + if (node.kind === 194 /* ExportAssignment */) { result.push(node); } else { @@ -9393,17 +9524,17 @@ var ts; } } switch (location.kind) { - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location).members)) { return result; } @@ -9434,7 +9565,7 @@ var ts; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 33554432 /* Import */) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return declaration.kind === 190 /* ImportDeclaration */ && declaration.externalModuleName; })) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return declaration.kind === 193 /* ImportDeclaration */ && declaration.externalModuleName; })) { var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { return [symbolFromSymbolTable]; @@ -9516,7 +9647,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 188 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 193 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 191 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 196 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9526,7 +9657,7 @@ var ts; return { aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 190 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 193 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -9547,7 +9678,7 @@ var ts; var firstIdentifier = getFirstIdentifier(entityName); var symbolOfNameSpace = resolveName(entityName.parent, firstIdentifier.text, 1536 /* Namespace */, ts.Diagnostics.Cannot_find_name_0, firstIdentifier); var hasNamespaceDeclarationsVisibile = hasVisibleDeclarations(symbolOfNameSpace); - return hasNamespaceDeclarationsVisibile ? { accessibility: 0 /* Accessible */, aliasesToMakeVisible: hasNamespaceDeclarationsVisibile.aliasesToMakeVisible } : { accessibility: 1 /* NotAccessible */, errorSymbolName: ts.identifierToString(firstIdentifier) }; + return hasNamespaceDeclarationsVisibile ? { accessibility: 0 /* Accessible */, aliasesToMakeVisible: hasNamespaceDeclarationsVisibile.aliasesToMakeVisible } : { accessibility: 1 /* NotAccessible */, errorSymbolName: ts.declarationNameToString(firstIdentifier) }; } function releaseStringWriter(writer) { writer.clear(); @@ -9586,10 +9717,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 138 /* ParenType */) { + while (node.kind === 140 /* ParenType */) { node = node.parent; } - if (node.kind === 186 /* TypeAliasDeclaration */) { + if (node.kind === 189 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -9601,7 +9732,7 @@ var ts; if (symbol.declarations && symbol.declarations.length > 0) { var declaration = symbol.declarations[0]; if (declaration.name) { - writer.writeSymbol(ts.identifierToString(declaration.name), symbol); + writer.writeSymbol(ts.declarationNameToString(declaration.name), symbol); return; } } @@ -9752,7 +9883,7 @@ var ts; function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { var isStaticMethodSymbol = !!(type.symbol.flags & 8192 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 193 /* SourceFile */ || declaration.parent.kind === 189 /* ModuleBlock */; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 196 /* SourceFile */ || declaration.parent.kind === 192 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2 /* UseTypeOfFunction */) || (typeStack && ts.contains(typeStack, type)); } @@ -9971,12 +10102,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 188 /* ModuleDeclaration */) { + if (node.kind === 191 /* ModuleDeclaration */) { if (node.name.kind === 7 /* StringLiteral */) { return node; } } - else if (node.kind === 193 /* SourceFile */) { + else if (node.kind === 196 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10018,16 +10149,16 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 181 /* VariableDeclaration */: - case 188 /* ModuleDeclaration */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 182 /* FunctionDeclaration */: - case 187 /* EnumDeclaration */: - case 190 /* ImportDeclaration */: - var parent = node.kind === 181 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (!(node.flags & 1 /* Export */) && !(node.kind !== 190 /* ImportDeclaration */ && parent.kind !== 193 /* SourceFile */ && ts.isInAmbientContext(parent))) { + case 184 /* VariableDeclaration */: + case 191 /* ModuleDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 185 /* FunctionDeclaration */: + case 190 /* EnumDeclaration */: + case 193 /* ImportDeclaration */: + var parent = node.kind === 184 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (!(node.flags & 1 /* Export */) && !(node.kind !== 193 /* ImportDeclaration */ && parent.kind !== 196 /* SourceFile */ && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); @@ -10041,9 +10172,9 @@ var ts; case 129 /* CallSignature */: case 131 /* IndexSignature */: case 123 /* Parameter */: - case 189 /* ModuleBlock */: + case 192 /* ModuleBlock */: return isDeclarationVisible(node.parent); - case 193 /* SourceFile */: + case 196 /* SourceFile */: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -10061,8 +10192,8 @@ var ts; var classType = getDeclaredTypeOfSymbol(prototype.parent); return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } - function getTypeOfVariableDeclaration(declaration) { - if (declaration.parent.kind === 166 /* ForInStatement */) { + function getTypeOfVariableOrPropertyDeclaration(declaration) { + if (declaration.parent.kind === 169 /* ForInStatement */) { return anyType; } if (declaration.type) { @@ -10083,7 +10214,7 @@ var ts; } if (declaration.initializer) { var type = checkAndMarkExpression(declaration.initializer); - if (declaration.kind !== 141 /* PropertyAssignment */) { + if (declaration.kind !== 143 /* PropertyAssignment */) { var unwidenedType = type; type = getWidenedType(type); if (type !== unwidenedType) { @@ -10092,6 +10223,10 @@ var ts; } return type; } + if (declaration.kind === 144 /* ShorthandPropertyAssignment */) { + var type = checkIdentifier(declaration.name); + return type; + } var type = declaration.flags & 8 /* Rest */ ? createArrayType(anyType) : anyType; checkImplicitAny(type); return type; @@ -10115,7 +10250,7 @@ var ts; default: var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; } - error(declaration, diagnostic, ts.identifierToString(declaration.name), typeToString(type)); + error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeToString(type)); } } function getTypeOfVariableOrParameterOrProperty(symbol) { @@ -10125,11 +10260,11 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.kind === 178 /* CatchBlock */) { + if (declaration.kind === 181 /* CatchBlock */) { return links.type = anyType; } links.type = resolvingType; - var type = getTypeOfVariableDeclaration(declaration); + var type = getTypeOfVariableOrPropertyDeclaration(declaration); if (links.type === resolvingType) { links.type = type; } @@ -10265,7 +10400,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 185 /* InterfaceDeclaration */ || node.kind === 184 /* ClassDeclaration */) { + if (node.kind === 188 /* InterfaceDeclaration */ || node.kind === 187 /* ClassDeclaration */) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10296,7 +10431,7 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = getDeclarationOfKind(symbol, 184 /* ClassDeclaration */); + var declaration = getDeclarationOfKind(symbol, 187 /* ClassDeclaration */); if (declaration.baseType) { var baseType = getTypeFromTypeReferenceNode(declaration.baseType); if (baseType !== unknownType) { @@ -10336,7 +10471,7 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 185 /* InterfaceDeclaration */ && declaration.baseTypes) { + if (declaration.kind === 188 /* InterfaceDeclaration */ && declaration.baseTypes) { ts.forEach(declaration.baseTypes, function (node) { var baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { @@ -10367,7 +10502,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = getDeclarationOfKind(symbol, 186 /* TypeAliasDeclaration */); + var declaration = getDeclarationOfKind(symbol, 189 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -10375,7 +10510,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = getDeclarationOfKind(symbol, 186 /* TypeAliasDeclaration */); + var declaration = getDeclarationOfKind(symbol, 189 /* TypeAliasDeclaration */); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10844,7 +10979,9 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 182 /* FunctionDeclaration */: + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 185 /* FunctionDeclaration */: case 125 /* Method */: case 126 /* Constructor */: case 129 /* CallSignature */: @@ -10852,8 +10989,8 @@ var ts; case 131 /* IndexSignature */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -10886,7 +11023,7 @@ var ts; if (compilerOptions.noImplicitAny) { var declaration = signature.declaration; if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.identifierToString(declaration.name)); + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); } else { error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); @@ -11074,9 +11211,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 187 /* EnumDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: return declaration; } } @@ -11216,7 +11353,7 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeLiteralNode(node) { + function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { links.resolvedType = createObjectType(32768 /* Anonymous */, node.symbol); @@ -11253,18 +11390,20 @@ var ts; return getTypeFromStringLiteral(node); case 132 /* TypeReference */: return getTypeFromTypeReferenceNode(node); - case 133 /* TypeQuery */: + case 135 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 135 /* ArrayType */: + case 137 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 136 /* TupleType */: + case 138 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 137 /* UnionType */: + case 139 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 138 /* ParenType */: + case 140 /* ParenType */: return getTypeFromTypeNode(node.type); - case 134 /* TypeLiteral */: - return getTypeFromTypeLiteralNode(node); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: + case 136 /* TypeLiteral */: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 63 /* Identifier */: case 121 /* QualifiedName */: var symbol = getSymbolInfo(node); @@ -11411,16 +11550,16 @@ var ts; } function isContextSensitiveExpression(node) { switch (node.kind) { - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: return !node.typeParameters && !ts.forEach(node.parameters, function (p) { return p.type; }); - case 140 /* ObjectLiteral */: - return ts.forEach(node.properties, function (p) { return p.kind === 141 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); - case 139 /* ArrayLiteral */: + case 142 /* ObjectLiteral */: + return ts.forEach(node.properties, function (p) { return p.kind === 143 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); + case 141 /* ArrayLiteral */: return ts.forEach(node.elements, function (e) { return isContextSensitiveExpression(e); }); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return isContextSensitiveExpression(node.whenTrue) || isContextSensitiveExpression(node.whenFalse); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return node.operator === 48 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); } return false; @@ -11469,6 +11608,7 @@ var ts; var errorInfo; var sourceStack; var targetStack; + var maybeStack; var expandingFlags; var depth = 0; var overflow = false; @@ -11613,11 +11753,11 @@ var ts; var id = source.id + "," + target.id; var related = relation[id]; if (related !== undefined) { - return related; + return related ? -1 /* True */ : 0 /* False */; } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (source === sourceStack[i] && target === targetStack[i]) { + if (maybeStack[i][id]) { return 1 /* Maybe */; } } @@ -11629,10 +11769,13 @@ var ts; else { sourceStack = []; targetStack = []; + maybeStack = []; expandingFlags = 0; } sourceStack[depth] = source; targetStack[depth] = target; + maybeStack[depth] = {}; + maybeStack[depth][id] = true; depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) @@ -11640,7 +11783,7 @@ var ts; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; if (expandingFlags === 3) { - var result = -1 /* True */; + var result = 1 /* Maybe */; } else { var result = propertiesRelatedTo(source, target, reportErrors); @@ -11659,8 +11802,15 @@ var ts; } expandingFlags = saveExpandingFlags; depth--; - if (result !== 1 /* Maybe */) { - relation[id] = result; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = result === -1 /* True */ || depth === 0 ? relation : maybeStack[depth - 1]; + for (var p in maybeCache) { + destinationCache[p] = maybeCache[p]; + } + } + else { + relation[id] = false; } return result; } @@ -12139,8 +12289,9 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var i = 0; i < typeParameters.length; i++) - inferences.push([]); + for (var i = 0; i < typeParameters.length; i++) { + inferences.push({ primary: undefined, secondary: undefined }); + } return { typeParameters: typeParameters, inferUnionTypes: inferUnionTypes, @@ -12153,6 +12304,7 @@ var ts; var sourceStack; var targetStack; var depth = 0; + var inferiority = 0; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { @@ -12179,10 +12331,10 @@ var ts; var typeParameters = context.typeParameters; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { - context.inferenceCount++; var inferences = context.inferences[i]; - if (!ts.contains(inferences, source)) - inferences.push(source); + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + if (!ts.contains(candidates, source)) + candidates.push(source); break; } } @@ -12196,7 +12348,6 @@ var ts; } else if (target.flags & 16384 /* Union */) { var targetTypes = target.types; - var startCount = context.inferenceCount; var typeParameterCount = 0; var typeParameter; for (var i = 0; i < targetTypes.length; i++) { @@ -12209,8 +12360,10 @@ var ts; inferFromTypes(source, t); } } - if (context.inferenceCount === startCount && typeParameterCount === 1) { + if (typeParameterCount === 1) { + inferiority++; inferFromTypes(source, typeParameter); + inferiority--; } } else if (source.flags & 16384 /* Union */) { @@ -12272,10 +12425,14 @@ var ts; } } } + function getInferenceCandidates(context, index) { + var inferences = context.inferences[index]; + return inferences.primary || inferences.secondary || emptyArray; + } function getInferredType(context, index) { var inferredType = context.inferredTypes[index]; if (!inferredType) { - var inferences = context.inferences[index]; + var inferences = getInferenceCandidates(context, index); if (inferences.length) { var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : inferenceFailureType; @@ -12310,7 +12467,7 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 133 /* TypeQuery */: + case 135 /* TypeQuery */: return true; case 63 /* Identifier */: case 121 /* QualifiedName */: @@ -12346,7 +12503,7 @@ var ts; function isAssignedInBinaryExpression(node) { if (node.operator >= 51 /* FirstAssignment */ && node.operator <= 62 /* LastAssignment */) { var n = node.left; - while (n.kind === 148 /* ParenExpression */) { + while (n.kind === 151 /* ParenExpression */) { n = n.expression; } if (n.kind === 63 /* Identifier */ && getResolvedSymbol(n) === symbol) { @@ -12363,40 +12520,40 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return isAssignedInVariableDeclaration(node); - case 139 /* ArrayLiteral */: - case 140 /* ObjectLiteral */: - case 142 /* PropertyAccess */: - case 143 /* IndexedAccess */: - case 144 /* CallExpression */: - case 145 /* NewExpression */: - case 147 /* TypeAssertion */: - case 148 /* ParenExpression */: - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: - case 154 /* ConditionalExpression */: - case 158 /* Block */: - case 159 /* VariableStatement */: - case 161 /* ExpressionStatement */: - case 162 /* IfStatement */: - case 163 /* DoStatement */: - case 164 /* WhileStatement */: - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 169 /* ReturnStatement */: - case 170 /* WithStatement */: - case 171 /* SwitchStatement */: - case 172 /* CaseClause */: - case 173 /* DefaultClause */: - case 174 /* LabeledStatement */: - case 175 /* ThrowStatement */: - case 176 /* TryStatement */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: + case 141 /* ArrayLiteral */: + case 142 /* ObjectLiteral */: + case 145 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: + case 150 /* TypeAssertion */: + case 151 /* ParenExpression */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: + case 157 /* ConditionalExpression */: + case 161 /* Block */: + case 162 /* VariableStatement */: + case 164 /* ExpressionStatement */: + case 165 /* IfStatement */: + case 166 /* DoStatement */: + case 167 /* WhileStatement */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 172 /* ReturnStatement */: + case 173 /* WithStatement */: + case 174 /* SwitchStatement */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12404,26 +12561,23 @@ var ts; } function getNarrowedTypeOfSymbol(symbol, node) { var type = getTypeOfSymbol(symbol); - if (symbol.flags & 3 /* Variable */ && type.flags & 65025 /* Structured */) { - while (true) { + if (node && (symbol.flags & 3 /* Variable */ && type.flags & 65025 /* Structured */)) { + loop: while (true) { var child = node; node = node.parent; - if (!node || node.kind === 183 /* FunctionBlock */ || node.kind === 189 /* ModuleBlock */) { - break; - } var narrowedType = type; switch (node.kind) { - case 162 /* IfStatement */: + case 165 /* IfStatement */: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: if (child === node.right) { if (node.operator === 47 /* AmpersandAmpersandToken */) { narrowedType = narrowType(type, node.left, true); @@ -12433,8 +12587,16 @@ var ts; } } break; + case 196 /* SourceFile */: + case 191 /* ModuleDeclaration */: + case 185 /* FunctionDeclaration */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + break loop; } - if (narrowedType !== type) { + if (narrowedType !== type && isTypeSubtypeOf(narrowedType, type)) { if (isVariableAssignedWithin(symbol, node)) { break; } @@ -12446,7 +12608,7 @@ var ts; function narrowTypeByEquality(type, expr, assumeTrue) { var left = expr.left; var right = expr.right; - if (left.kind !== 151 /* PrefixOperator */ || left.operator !== 95 /* TypeOfKeyword */ || left.operand.kind !== 63 /* Identifier */ || right.kind !== 7 /* StringLiteral */ || getResolvedSymbol(left.operand) !== symbol) { + if (left.kind !== 154 /* PrefixOperator */ || left.operator !== 95 /* TypeOfKeyword */ || left.operand.kind !== 63 /* Identifier */ || right.kind !== 7 /* StringLiteral */ || getResolvedSymbol(left.operand) !== symbol) { return type; } var t = right.text; @@ -12500,9 +12662,9 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return narrowType(type, expr.expression, assumeTrue); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: var operator = expr.operator; if (operator === 29 /* EqualsEqualsEqualsToken */ || operator === 30 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); @@ -12517,7 +12679,7 @@ var ts; return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 151 /* PrefixOperator */: + case 154 /* PrefixOperator */: if (expr.operator === 45 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -12529,7 +12691,7 @@ var ts; function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol.flags & 33554432 /* Import */) { - getSymbolLinks(symbol).referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); + getSymbolLinks(symbol).referenced = getSymbolLinks(symbol).referenced || (!isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol))); } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); @@ -12537,7 +12699,7 @@ var ts; return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 184 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 187 /* ClassDeclaration */ ? container.parent : undefined; getNodeLinks(node).flags |= 2 /* LexicalThis */; if (container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */) { getNodeLinks(classNode).flags |= 4 /* CaptureThis */; @@ -12549,15 +12711,15 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 150 /* ArrowFunction */) { + if (container.kind === 153 /* ArrowFunction */) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = true; } switch (container.kind) { - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 126 /* Constructor */: @@ -12574,7 +12736,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 184 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 187 /* ClassDeclaration */ ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -12587,9 +12749,9 @@ var ts; if (!node) return node; switch (node.kind) { - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: case 124 /* Property */: case 125 /* Method */: case 126 /* Constructor */: @@ -12608,8 +12770,8 @@ var ts; return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 144 /* CallExpression */ && node.parent.func === node; - var enclosingClass = ts.getAncestor(node, 184 /* ClassDeclaration */); + var isCallExpression = node.parent.kind === 147 /* CallExpression */ && node.parent.func === node; + var enclosingClass = ts.getAncestor(node, 187 /* ClassDeclaration */); var baseClass; if (enclosingClass && enclosingClass.baseType) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -12627,11 +12789,11 @@ var ts; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 150 /* ArrowFunction */) { + while (container && container.kind === 153 /* ArrowFunction */) { container = getSuperContainer(container); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 184 /* ClassDeclaration */) { + if (container && container.parent && container.parent.kind === 187 /* ClassDeclaration */) { if (container.flags & 128 /* Static */) { canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */; } @@ -12670,7 +12832,7 @@ var ts; } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (func.kind === 149 /* FunctionExpression */ || func.kind === 150 /* ArrowFunction */) { + if (func.kind === 152 /* FunctionExpression */ || func.kind === 153 /* ArrowFunction */) { if (isContextSensitiveExpression(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -12809,25 +12971,25 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 123 /* Parameter */: case 124 /* Property */: return getContextualTypeForInitializerExpression(node); - case 150 /* ArrowFunction */: - case 169 /* ReturnStatement */: + case 153 /* ArrowFunction */: + case 172 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 144 /* CallExpression */: - case 145 /* NewExpression */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: return getContextualTypeForArgument(node); - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return getTypeFromTypeNode(parent.type); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 141 /* PropertyAssignment */: + case 143 /* PropertyAssignment */: return getContextualTypeForPropertyExpression(node); - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: return getContextualTypeForElementExpression(node); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); } return undefined; @@ -12849,19 +13011,31 @@ var ts; if (!(type.flags & 16384 /* Union */)) { return getNonGenericSignature(type); } - var result; + var signatureList; var types = type.types; for (var i = 0; i < types.length; i++) { + if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0 /* Call */).length > 1) { + return undefined; + } var signature = getNonGenericSignature(types[i]); if (signature) { - if (!result) { - result = signature; + if (!signatureList) { + signatureList = [signature]; } - else if (!compareSignatures(result, signature, true, compareTypes)) { + else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; } + else { + signatureList.push(signature); + } } } + var result; + if (signatureList) { + result = cloneSignature(signatureList[0]); + result.resolvedReturnType = undefined; + result.unionSignatures = signatureList; + } return result; } function isInferentialContext(mapper) { @@ -12890,7 +13064,15 @@ var ts; if (ts.hasProperty(members, id)) { var member = members[id]; if (member.flags & 4 /* Property */) { - var type = checkExpression(member.declarations[0].initializer, contextualMapper); + var memberDecl = member.declarations[0]; + var type; + if (memberDecl.kind === 143 /* PropertyAssignment */) { + type = checkExpression(memberDecl.initializer, contextualMapper); + } + else { + ts.Debug.assert(memberDecl.kind === 144 /* ShorthandPropertyAssignment */); + type = checkExpression(memberDecl.name, contextualMapper); + } var prop = createSymbol(4 /* Property */ | 268435456 /* Transient */ | member.flags, member.name); prop.declarations = member.declarations; prop.parent = member.parent; @@ -12945,7 +13127,7 @@ var ts; if (!(flags & (32 /* Private */ | 64 /* Protected */))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 184 /* ClassDeclaration */); + var enclosingClassDeclaration = ts.getAncestor(node, 187 /* ClassDeclaration */); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32 /* Private */) { @@ -12980,7 +13162,7 @@ var ts; var prop = getPropertyOfType(apparentType, node.right.text); if (!prop) { if (node.right.text) { - error(node.right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.identifierToString(node.right), typeToString(type)); + error(node.right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(node.right), typeToString(type)); } return unknownType; } @@ -13050,29 +13232,64 @@ var ts; return unknownType; } function resolveUntypedCall(node) { - ts.forEach(node.arguments, function (argument) { - checkExpression(argument); - }); + if (node.kind === 149 /* TaggedTemplateExpression */) { + checkExpression(node.template); + } + else { + ts.forEach(node.arguments, function (argument) { + checkExpression(argument); + }); + } return anySignature; } function resolveErrorCall(node) { resolveUntypedCall(node); return unknownSignature; } - function signatureHasCorrectArity(node, signature) { - if (!node.arguments) { - return signature.minArgumentCount === 0; + function hasCorrectArity(node, args, signature) { + var adjustedArgCount; + var typeArguments; + var callIsIncomplete; + if (node.kind === 149 /* TaggedTemplateExpression */) { + var tagExpression = node; + adjustedArgCount = args.length; + typeArguments = undefined; + if (tagExpression.template.kind === 158 /* TemplateExpression */) { + var templateExpression = tagExpression.template; + var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); + ts.Debug.assert(lastSpan !== undefined); + callIsIncomplete = lastSpan.literal.kind === 120 /* Missing */ || ts.isUnterminatedTemplateEnd(lastSpan.literal); + } + else { + var templateLiteral = tagExpression.template; + ts.Debug.assert(templateLiteral.kind === 9 /* NoSubstitutionTemplateLiteral */); + callIsIncomplete = ts.isUnterminatedTemplateEnd(templateLiteral); + } } - var args = node.arguments; - var numberOfArgs = args.hasTrailingComma ? args.length + 1 : args.length; - var hasTooManyArguments = !signature.hasRestParameter && numberOfArgs > signature.parameters.length; - var hasRightNumberOfTypeArguments = !node.typeArguments || (signature.typeParameters && node.typeArguments.length === signature.typeParameters.length); - if (hasTooManyArguments || !hasRightNumberOfTypeArguments) { - return false; + else { + var callExpression = node; + if (!callExpression.arguments) { + ts.Debug.assert(callExpression.kind === 148 /* NewExpression */); + return signature.minArgumentCount === 0; + } + adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; + callIsIncomplete = callExpression.arguments.end === callExpression.end; + typeArguments = callExpression.typeArguments; + } + ts.Debug.assert(adjustedArgCount !== undefined, "'adjustedArgCount' undefined"); + ts.Debug.assert(callIsIncomplete !== undefined, "'callIsIncomplete' undefined"); + return checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature); + function checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature) { + if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { + return false; + } + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + if (!hasRightNumberOfTypeArgs) { + return false; + } + var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; } - var callIsIncomplete = args.end === node.end; - var hasEnoughArguments = numberOfArgs >= signature.minArgumentCount; - return callIsIncomplete || hasEnoughArguments; } function getSingleCallSignature(type) { if (type.flags & 48128 /* ObjectType */) { @@ -13095,17 +13312,21 @@ var ts; var context = createInferenceContext(typeParameters, false); var mapper = createInferenceMapper(context); for (var i = 0; i < args.length; i++) { - if (args[i].kind === 157 /* OmittedExpression */) { + if (args[i].kind === 160 /* OmittedExpression */) { continue; } if (!excludeArgument || excludeArgument[i] === undefined) { var parameterType = getTypeAtPosition(signature, i); + if (i === 0 && args[i].parent.kind === 149 /* TaggedTemplateExpression */) { + inferTypes(context, globalTemplateStringsArrayType, parameterType); + continue; + } inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); } } if (excludeArgument) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 157 /* OmittedExpression */) { + if (args[i].kind === 160 /* OmittedExpression */) { continue; } if (excludeArgument[i] === false) { @@ -13139,37 +13360,60 @@ var ts; } return typeArgumentsAreAssignable; } - function checkApplicableSignature(node, signature, relation, excludeArgument, reportErrors) { - if (node.arguments) { - for (var i = 0; i < node.arguments.length; i++) { - var arg = node.arguments[i]; - if (arg.kind === 157 /* OmittedExpression */) { - continue; - } - var paramType = getTypeAtPosition(signature, i); - var argType = arg.kind === 7 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); - var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); - if (!isValidArgument) { - return false; - } + function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + var argType; + if (arg.kind === 160 /* OmittedExpression */) { + continue; + } + var paramType = getTypeAtPosition(signature, i); + if (i === 0 && node.kind === 149 /* TaggedTemplateExpression */) { + argType = globalTemplateStringsArrayType; + } + else { + argType = arg.kind === 7 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + } + var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); + if (!isValidArgument) { + return false; } } return true; } + function getEffectiveCallArguments(node) { + var args; + if (node.kind === 149 /* TaggedTemplateExpression */) { + var template = node.template; + args = [template]; + if (template.kind === 158 /* TemplateExpression */) { + ts.forEach(template.templateSpans, function (span) { + args.push(span.expression); + }); + } + } + else { + args = node.arguments || emptyArray; + } + return args; + } function resolveCall(node, signatures, candidatesOutArray) { - ts.forEach(node.typeArguments, checkSourceElement); + var isTaggedTemplate = node.kind === 149 /* TaggedTemplateExpression */; + var typeArguments = isTaggedTemplate ? undefined : node.typeArguments; + ts.forEach(typeArguments, checkSourceElement); var candidates = candidatesOutArray || []; collectCandidates(); if (!candidates.length) { error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); return resolveErrorCall(node); } - var args = node.arguments || emptyArray; + var args = getEffectiveCallArguments(node); var excludeArgument; - for (var i = 0; i < args.length; i++) { + for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { if (isContextSensitiveExpression(args[i])) { - if (!excludeArgument) + if (!excludeArgument) { excludeArgument = new Array(args.length); + } excludeArgument[i] = true; } } @@ -13178,30 +13422,30 @@ var ts; var resultOfFailedInference; var result; if (candidates.length > 1) { - result = chooseOverload(candidates, subtypeRelation, excludeArgument); + result = chooseOverload(candidates, subtypeRelation); } if (!result) { candidateForArgumentError = undefined; candidateForTypeArgumentError = undefined; resultOfFailedInference = undefined; - result = chooseOverload(candidates, assignableRelation, excludeArgument); + result = chooseOverload(candidates, assignableRelation); } if (result) { return result; } if (candidateForArgumentError) { - checkApplicableSignature(node, candidateForArgumentError, assignableRelation, undefined, true); + checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); } else if (candidateForTypeArgumentError) { - if (node.typeArguments) { + if (!isTaggedTemplate && node.typeArguments) { checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true); } else { ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; - var inferenceCandidates = resultOfFailedInference.inferences[resultOfFailedInference.failedTypeParameterIndex]; + var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex); var diagnosticChainHead = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); - reportNoCommonSupertypeError(inferenceCandidates, node.func, diagnosticChainHead); + reportNoCommonSupertypeError(inferenceCandidates, node.func || node.tag, diagnosticChainHead); } } else { @@ -13209,15 +13453,15 @@ var ts; } if (!fullTypeCheck) { for (var i = 0, n = candidates.length; i < n; i++) { - if (signatureHasCorrectArity(node, candidates[i])) { + if (hasCorrectArity(node, args, candidates[i])) { return candidates[i]; } } } return resolveErrorCall(node); - function chooseOverload(candidates, relation, excludeArgument) { + function chooseOverload(candidates, relation) { for (var i = 0; i < candidates.length; i++) { - if (!signatureHasCorrectArity(node, candidates[i])) { + if (!hasCorrectArity(node, args, candidates[i])) { continue; } var originalCandidate = candidates[i]; @@ -13227,9 +13471,9 @@ var ts; if (candidate.typeParameters) { var typeArgumentTypes; var typeArgumentsAreValid; - if (node.typeArguments) { + if (typeArguments) { typeArgumentTypes = new Array(candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(candidate, node.typeArguments, typeArgumentTypes, false); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); } else { inferenceResult = inferTypeArguments(candidate, args, excludeArgument); @@ -13241,7 +13485,7 @@ var ts; } candidate = getSignatureInstantiation(candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; @@ -13257,7 +13501,7 @@ var ts; } else { candidateForTypeArgumentError = originalCandidate; - if (!node.typeArguments) { + if (!typeArguments) { resultOfFailedInference = inferenceResult; } } @@ -13360,11 +13604,38 @@ var ts; error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); return resolveErrorCall(node); } + function resolveTaggedTemplateExpression(node, candidatesOutArray) { + var tagType = checkExpression(node.tag); + var apparentType = getApparentType(tagType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); + if (tagType === anyType || (!callSignatures.length && !(tagType.flags & 16384 /* Union */) && isTypeAssignableTo(tagType, globalFunctionType))) { + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } function getResolvedSignature(node, candidatesOutArray) { var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - links.resolvedSignature = node.kind === 144 /* CallExpression */ ? resolveCallExpression(node, candidatesOutArray) : resolveNewExpression(node, candidatesOutArray); + if (node.kind === 147 /* CallExpression */) { + links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); + } + else if (node.kind === 148 /* NewExpression */) { + links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); + } + else if (node.kind === 149 /* TaggedTemplateExpression */) { + links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); + } + else { + ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); + } } return links.resolvedSignature; } @@ -13373,9 +13644,9 @@ var ts; if (node.func.kind === 89 /* SuperKeyword */) { return voidType; } - if (node.kind === 145 /* NewExpression */) { + if (node.kind === 148 /* NewExpression */) { var declaration = signature.declaration; - if (declaration && (declaration.kind !== 126 /* Constructor */ && declaration.kind !== 130 /* ConstructSignature */)) { + if (declaration && declaration.kind !== 126 /* Constructor */ && declaration.kind !== 130 /* ConstructSignature */ && declaration.kind !== 134 /* ConstructorType */) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13385,9 +13656,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { - checkExpression(node.tag); - checkExpression(node.template); - return anyType; + return getReturnTypeOfSignature(getResolvedSignature(node)); } function checkTypeAssertion(node) { var exprType = checkExpression(node.operand); @@ -13418,7 +13687,7 @@ var ts; } function getReturnTypeFromBody(func, contextualMapper) { var contextualSignature = getContextualSignature(func); - if (func.body.kind !== 183 /* FunctionBlock */) { + if (func.body.kind !== 186 /* FunctionBlock */) { var unwidenedType = checkAndMarkExpression(func.body, contextualMapper); var widenedType = getWidenedType(unwidenedType); if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { @@ -13437,7 +13706,7 @@ var ts; if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== commonType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { var typeName = typeToString(widenedType); if (func.name) { - error(func, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.identifierToString(func.name), typeName); + error(func, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.declarationNameToString(func.name), typeName); } else { error(func, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeName); @@ -13466,7 +13735,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 175 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 178 /* ThrowStatement */); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!fullTypeCheck) { @@ -13475,7 +13744,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (!func.body || func.body.kind !== 183 /* FunctionBlock */) { + if (!func.body || func.body.kind !== 186 /* FunctionBlock */) { return; } var bodyBlock = func.body; @@ -13519,7 +13788,7 @@ var ts; if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } - if (node.body.kind === 183 /* FunctionBlock */) { + if (node.body.kind === 186 /* FunctionBlock */) { checkSourceElement(node.body); } else { @@ -13547,12 +13816,12 @@ var ts; case 63 /* Identifier */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: return true; - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -13561,10 +13830,10 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 63 /* Identifier */: - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: var symbol = findSymbol(n); return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096 /* Const */) !== 0; - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: var index = n.index; var symbol = findSymbol(n.object); if (symbol && index.kind === 7 /* StringLiteral */) { @@ -13573,7 +13842,7 @@ var ts; return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096 /* Const */) !== 0; } return false; - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return isConstVariableReference(n.expression); default: return false; @@ -13808,7 +14077,7 @@ var ts; } } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 142 /* PropertyAccess */ && node.parent.left === node) || (node.parent.kind === 143 /* IndexedAccess */ && node.parent.object === node) || ((node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 145 /* PropertyAccess */ && node.parent.left === node) || (node.parent.kind === 146 /* IndexedAccess */ && node.parent.object === node) || ((node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -13830,7 +14099,7 @@ var ts; return booleanType; case 6 /* NumericLiteral */: return numberType; - case 155 /* TemplateExpression */: + case 158 /* TemplateExpression */: return checkTemplateExpression(node); case 7 /* StringLiteral */: case 9 /* NoSubstitutionTemplateLiteral */: @@ -13839,35 +14108,35 @@ var ts; return globalRegExpType; case 121 /* QualifiedName */: return checkPropertyAccess(node); - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: return checkArrayLiteral(node, contextualMapper); - case 140 /* ObjectLiteral */: + case 142 /* ObjectLiteral */: return checkObjectLiteral(node, contextualMapper); - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: return checkPropertyAccess(node); - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: return checkIndexedAccess(node); - case 144 /* CallExpression */: - case 145 /* NewExpression */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: return checkCallExpression(node); - case 146 /* TaggedTemplateExpression */: + case 149 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return checkTypeAssertion(node); - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return checkExpression(node.expression); - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: return checkFunctionExpression(node, contextualMapper); - case 151 /* PrefixOperator */: + case 154 /* PrefixOperator */: return checkPrefixExpression(node); - case 152 /* PostfixOperator */: + case 155 /* PostfixOperator */: return checkPostfixExpression(node); - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 154 /* ConditionalExpression */: + case 157 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 157 /* OmittedExpression */: + case 160 /* OmittedExpression */: return undefinedType; } return unknownType; @@ -13903,7 +14172,7 @@ var ts; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(parameterDeclaration.parent.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { if (referencedSymbol.valueDeclaration.kind === 123 /* Parameter */) { if (referencedSymbol.valueDeclaration === parameterDeclaration) { - error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.identifierToString(parameterDeclaration.name)); + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(parameterDeclaration.name)); return; } var enclosingOrReferencedParameter = ts.forEach(parameterDeclaration.parent.parameters, function (p) { return p === parameterDeclaration || p === referencedSymbol.valueDeclaration ? p : undefined; }); @@ -13911,7 +14180,7 @@ var ts; return; } } - error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.identifierToString(parameterDeclaration.name), ts.identifierToString(n)); + error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(parameterDeclaration.name), ts.declarationNameToString(n)); } } else { @@ -13947,7 +14216,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 185 /* InterfaceDeclaration */) { + if (node.kind === 188 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -14003,17 +14272,17 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 144 /* CallExpression */ && n.func.kind === 89 /* SuperKeyword */; + return n.kind === 147 /* CallExpression */ && n.func.kind === 89 /* SuperKeyword */; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 149 /* FunctionExpression */: - case 182 /* FunctionDeclaration */: - case 150 /* ArrowFunction */: - case 140 /* ObjectLiteral */: return false; + case 152 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 153 /* ArrowFunction */: + case 142 /* ObjectLiteral */: return false; default: return ts.forEachChild(n, containsSuperCall); } } @@ -14021,7 +14290,7 @@ var ts; if (n.kind === 91 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 149 /* FunctionExpression */ && n.kind !== 182 /* FunctionDeclaration */) { + else if (n.kind !== 152 /* FunctionExpression */ && n.kind !== 185 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -14033,7 +14302,7 @@ var ts; var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 161 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 164 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -14091,7 +14360,7 @@ var ts; function checkTypeLiteral(node) { ts.forEach(node.members, checkSourceElement); if (fullTypeCheck) { - var type = getTypeFromTypeLiteralNode(node); + var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); checkIndexConstraints(type); checkTypeForDuplicateIndexSignatures(node); } @@ -14120,9 +14389,8 @@ var ts; error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); return; } - var symbol = getSymbolOfNode(signatureDeclarationNode); var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 185 /* InterfaceDeclaration */) { + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 188 /* InterfaceDeclaration */) { ts.Debug.assert(signatureDeclarationNode.kind === 129 /* CallSignature */ || signatureDeclarationNode.kind === 130 /* ConstructSignature */); var signatureKind = signatureDeclarationNode.kind === 129 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); @@ -14142,7 +14410,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = n.flags; - if (n.parent.kind !== 185 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 188 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { flags |= 1 /* Export */; } @@ -14209,7 +14477,7 @@ var ts; return; } else if (subsequentNode.body) { - error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.identifierToString(node.name)); + error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); return; } } @@ -14228,11 +14496,11 @@ var ts; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 185 /* InterfaceDeclaration */ || node.parent.kind === 134 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 188 /* InterfaceDeclaration */ || node.parent.kind === 136 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 182 /* FunctionDeclaration */ || node.kind === 125 /* Method */ || node.kind === 126 /* Constructor */) { + if (node.kind === 185 /* FunctionDeclaration */ || node.kind === 125 /* Method */ || node.kind === 126 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -14320,20 +14588,20 @@ var ts; if (commonDeclarationSpace) { ts.forEach(symbol.declarations, function (d) { if (getDeclarationSpaces(d) & commonDeclarationSpace) { - error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.identifierToString(d.name)); + error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name)); } }); } function getDeclarationSpaces(d) { switch (d.kind) { - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return 8388608 /* ExportType */; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return d.name.kind === 7 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 16777216 /* ExportNamespace */ | 4194304 /* ExportValue */ : 16777216 /* ExportNamespace */; - case 184 /* ClassDeclaration */: - case 187 /* EnumDeclaration */: + case 187 /* ClassDeclaration */: + case 190 /* EnumDeclaration */: return 8388608 /* ExportType */ | 4194304 /* ExportValue */; - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: var result = 0; var target = resolveImport(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { @@ -14366,7 +14634,7 @@ var ts; if (!isPrivateWithinAmbient(node)) { var typeName = typeToString(anyType); if (node.name) { - error(node, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.identifierToString(node.name), typeName); + error(node, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type, ts.declarationNameToString(node.name), typeName); } else { error(node, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeName); @@ -14408,10 +14676,10 @@ var ts; return; } switch (current.kind) { - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: case 125 /* Method */: - case 150 /* ArrowFunction */: + case 153 /* ArrowFunction */: case 126 /* Constructor */: if (ts.hasRestParameters(current)) { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter); @@ -14463,7 +14731,7 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 184 /* ClassDeclaration */); + var enclosingClass = ts.getAncestor(node, 187 /* ClassDeclaration */); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } @@ -14481,12 +14749,12 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 188 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 191 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } - var parent = node.kind === 181 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (parent.kind === 193 /* SourceFile */ && ts.isExternalModule(parent)) { - error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, name.text, name.text); + var parent = node.kind === 184 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (parent.kind === 196 /* SourceFile */ && ts.isExternalModule(parent)) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkCollisionWithConstDeclarations(node) { @@ -14514,7 +14782,7 @@ var ts; type = typeOfValueDeclaration; } else { - type = getTypeOfVariableDeclaration(node); + type = getTypeOfVariableOrPropertyDeclaration(node); } if (node.initializer) { if (!(getNodeLinks(node.initializer).flags & 1 /* TypeChecked */)) { @@ -14527,7 +14795,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); if (!useTypeFromValueDeclaration) { if (typeOfValueDeclaration !== unknownType && type !== unknownType && !isTypeIdenticalTo(typeOfValueDeclaration, type)) { - error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.identifierToString(node.name), typeToString(typeOfValueDeclaration), typeToString(type)); + error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(typeOfValueDeclaration), typeToString(type)); } } } @@ -14704,7 +14972,7 @@ var ts; if (fullTypeCheck) { for (var j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { - error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.identifierToString(node.name)); + error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); } } } @@ -14873,7 +15141,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = getDeclarationOfKind(symbol, 185 /* InterfaceDeclaration */); + var firstInterfaceDecl = getDeclarationOfKind(symbol, 188 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -14944,7 +15212,7 @@ var ts; return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 151 /* PrefixOperator */: + case 154 /* PrefixOperator */: var value = evalConstant(e.operand); if (value === undefined) { return undefined; @@ -14955,7 +15223,7 @@ var ts; case 46 /* TildeToken */: return enumIsConst ? ~value : undefined; } return undefined; - case 153 /* BinaryExpression */: + case 156 /* BinaryExpression */: if (!enumIsConst) { return undefined; } @@ -14983,11 +15251,11 @@ var ts; return undefined; case 6 /* NumericLiteral */: return +e.text; - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: return enumIsConst ? evalConstant(e.expression) : undefined; case 63 /* Identifier */: - case 143 /* IndexedAccess */: - case 142 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 145 /* PropertyAccess */: if (!enumIsConst) { return undefined; } @@ -15000,7 +15268,7 @@ var ts; propertyName = e.text; } else { - if (e.kind === 143 /* IndexedAccess */) { + if (e.kind === 146 /* IndexedAccess */) { if (e.index.kind !== 7 /* StringLiteral */) { return undefined; } @@ -15056,7 +15324,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 187 /* EnumDeclaration */) { + if (declaration.kind !== 190 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -15079,7 +15347,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 184 /* ClassDeclaration */ || (declaration.kind === 182 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 187 /* ClassDeclaration */ || (declaration.kind === 185 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -15133,7 +15401,7 @@ var ts; checkExpression(node.entityName); } else { - error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.identifierToString(moduleName)); + error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } if (target.flags & 3152352 /* Type */) { @@ -15142,10 +15410,10 @@ var ts; } } else { - if (node.parent.kind === 193 /* SourceFile */) { + if (node.parent.kind === 196 /* SourceFile */) { target = resolveImport(symbol); } - else if (node.parent.kind === 189 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { + else if (node.parent.kind === 192 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { if (isExternalModuleNameRelative(node.externalModuleName.text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); target = unknownSymbol; @@ -15167,7 +15435,7 @@ var ts; } function checkExportAssignment(node) { var container = node.parent; - if (container.kind !== 193 /* SourceFile */) { + if (container.kind !== 196 /* SourceFile */) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -15182,6 +15450,8 @@ var ts; return checkParameter(node); case 124 /* Property */: return checkPropertyDeclaration(node); + case 133 /* FunctionType */: + case 134 /* ConstructorType */: case 129 /* CallSignature */: case 130 /* ConstructSignature */: case 131 /* IndexSignature */: @@ -15195,76 +15465,76 @@ var ts; return checkAccessorDeclaration(node); case 132 /* TypeReference */: return checkTypeReference(node); - case 133 /* TypeQuery */: + case 135 /* TypeQuery */: return checkTypeQuery(node); - case 134 /* TypeLiteral */: + case 136 /* TypeLiteral */: return checkTypeLiteral(node); - case 135 /* ArrayType */: + case 137 /* ArrayType */: return checkArrayType(node); - case 136 /* TupleType */: + case 138 /* TupleType */: return checkTupleType(node); - case 137 /* UnionType */: + case 139 /* UnionType */: return checkUnionType(node); - case 138 /* ParenType */: + case 140 /* ParenType */: return checkSourceElement(node.type); - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 158 /* Block */: + case 161 /* Block */: return checkBlock(node); - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: return checkBody(node); - case 159 /* VariableStatement */: + case 162 /* VariableStatement */: return checkVariableStatement(node); - case 161 /* ExpressionStatement */: + case 164 /* ExpressionStatement */: return checkExpressionStatement(node); - case 162 /* IfStatement */: + case 165 /* IfStatement */: return checkIfStatement(node); - case 163 /* DoStatement */: + case 166 /* DoStatement */: return checkDoStatement(node); - case 164 /* WhileStatement */: + case 167 /* WhileStatement */: return checkWhileStatement(node); - case 165 /* ForStatement */: + case 168 /* ForStatement */: return checkForStatement(node); - case 166 /* ForInStatement */: + case 169 /* ForInStatement */: return checkForInStatement(node); - case 167 /* ContinueStatement */: - case 168 /* BreakStatement */: + case 170 /* ContinueStatement */: + case 171 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 169 /* ReturnStatement */: + case 172 /* ReturnStatement */: return checkReturnStatement(node); - case 170 /* WithStatement */: + case 173 /* WithStatement */: return checkWithStatement(node); - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: return checkSwitchStatement(node); - case 174 /* LabeledStatement */: + case 177 /* LabeledStatement */: return checkLabeledStatement(node); - case 175 /* ThrowStatement */: + case 178 /* ThrowStatement */: return checkThrowStatement(node); - case 176 /* TryStatement */: + case 179 /* TryStatement */: return checkTryStatement(node); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return ts.Debug.fail("Checker encountered variable declaration"); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return checkClassDeclaration(node); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 186 /* TypeAliasDeclaration */: + case 189 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return checkImportDeclaration(node); - case 191 /* ExportAssignment */: + case 194 /* ExportAssignment */: return checkExportAssignment(node); } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionBody(node); break; @@ -15272,55 +15542,55 @@ var ts; case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 170 /* WithStatement */: + case 173 /* WithStatement */: checkFunctionExpressionBodies(node.expression); break; case 123 /* Parameter */: case 124 /* Property */: - case 139 /* ArrayLiteral */: - case 140 /* ObjectLiteral */: - case 141 /* PropertyAssignment */: - case 142 /* PropertyAccess */: - case 143 /* IndexedAccess */: - case 144 /* CallExpression */: - case 145 /* NewExpression */: - case 146 /* TaggedTemplateExpression */: - case 147 /* TypeAssertion */: - case 148 /* ParenExpression */: - case 151 /* PrefixOperator */: - case 152 /* PostfixOperator */: - case 153 /* BinaryExpression */: - case 154 /* ConditionalExpression */: - case 158 /* Block */: - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: - case 159 /* VariableStatement */: - case 161 /* ExpressionStatement */: - case 162 /* IfStatement */: - case 163 /* DoStatement */: - case 164 /* WhileStatement */: - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 167 /* ContinueStatement */: - case 168 /* BreakStatement */: - case 169 /* ReturnStatement */: - case 171 /* SwitchStatement */: - case 172 /* CaseClause */: - case 173 /* DefaultClause */: - case 174 /* LabeledStatement */: - case 175 /* ThrowStatement */: - case 176 /* TryStatement */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: - case 181 /* VariableDeclaration */: - case 184 /* ClassDeclaration */: - case 187 /* EnumDeclaration */: - case 192 /* EnumMember */: - case 193 /* SourceFile */: + case 141 /* ArrayLiteral */: + case 142 /* ObjectLiteral */: + case 143 /* PropertyAssignment */: + case 145 /* PropertyAccess */: + case 146 /* IndexedAccess */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: + case 149 /* TaggedTemplateExpression */: + case 150 /* TypeAssertion */: + case 151 /* ParenExpression */: + case 154 /* PrefixOperator */: + case 155 /* PostfixOperator */: + case 156 /* BinaryExpression */: + case 157 /* ConditionalExpression */: + case 161 /* Block */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: + case 162 /* VariableStatement */: + case 164 /* ExpressionStatement */: + case 165 /* IfStatement */: + case 166 /* DoStatement */: + case 167 /* WhileStatement */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 170 /* ContinueStatement */: + case 171 /* BreakStatement */: + case 172 /* ReturnStatement */: + case 174 /* SwitchStatement */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: + case 177 /* LabeledStatement */: + case 178 /* ThrowStatement */: + case 179 /* TryStatement */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 184 /* VariableDeclaration */: + case 187 /* ClassDeclaration */: + case 190 /* EnumDeclaration */: + case 195 /* EnumMember */: + case 196 /* SourceFile */: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -15391,7 +15661,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 170 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 173 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -15427,27 +15697,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 35653619 /* ModuleMember */); break; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 3152352 /* Type */); } break; - case 149 /* FunctionExpression */: + case 152 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 178 /* CatchBlock */: + case 181 /* CatchBlock */: if (location.variable.text) { copySymbol(location.symbol, meaning); } @@ -15465,10 +15735,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 122 /* TypeParameter */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 187 /* EnumDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 190 /* EnumDeclaration */: return true; } } @@ -15479,7 +15749,7 @@ var ts; return node.parent && node.parent.kind === 132 /* TypeReference */; } function isTypeNode(node) { - if (132 /* FirstTypeNode */ <= node.kind && node.kind <= 138 /* LastTypeNode */) { + if (132 /* FirstTypeNode */ <= node.kind && node.kind <= 140 /* LastTypeNode */) { return true; } switch (node.kind) { @@ -15489,20 +15759,20 @@ var ts; case 110 /* BooleanKeyword */: return true; case 97 /* VoidKeyword */: - return node.parent.kind !== 151 /* PrefixOperator */; + return node.parent.kind !== 154 /* PrefixOperator */; case 7 /* StringLiteral */: return node.parent.kind === 123 /* Parameter */; case 63 /* Identifier */: - if (node.parent.kind === 121 /* QualifiedName */) { + if (node.parent.kind === 121 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } case 121 /* QualifiedName */: ts.Debug.assert(node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); var parent = node.parent; - if (parent.kind === 133 /* TypeQuery */) { + if (parent.kind === 135 /* TypeQuery */) { return false; } - if (132 /* FirstTypeNode */ <= parent.kind && parent.kind <= 138 /* LastTypeNode */) { + if (132 /* FirstTypeNode */ <= parent.kind && parent.kind <= 140 /* LastTypeNode */) { return true; } switch (parent.kind) { @@ -15510,11 +15780,11 @@ var ts; return node === parent.constraint; case 124 /* Property */: case 123 /* Parameter */: - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: return node === parent.type; - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: case 126 /* Constructor */: case 125 /* Method */: case 127 /* GetAccessor */: @@ -15524,12 +15794,12 @@ var ts; case 130 /* ConstructSignature */: case 131 /* IndexSignature */: return node === parent.type; - case 147 /* TypeAssertion */: + case 150 /* TypeAssertion */: return node === parent.type; - case 144 /* CallExpression */: - case 145 /* NewExpression */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: return parent.typeArguments && parent.typeArguments.indexOf(node) >= 0; - case 146 /* TaggedTemplateExpression */: + case 149 /* TaggedTemplateExpression */: return false; } } @@ -15539,22 +15809,22 @@ var ts; while (node.parent.kind === 121 /* QualifiedName */) { node = node.parent; } - if (node.parent.kind === 190 /* ImportDeclaration */) { + if (node.parent.kind === 193 /* ImportDeclaration */) { return node.parent.entityName === node; } - if (node.parent.kind === 191 /* ExportAssignment */) { + if (node.parent.kind === 194 /* ExportAssignment */) { return node.parent.exportName === node; } return false; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 121 /* QualifiedName */ || node.parent.kind === 142 /* PropertyAccess */) && node.parent.right === node; + return (node.parent.kind === 121 /* QualifiedName */ || node.parent.kind === 145 /* PropertyAccess */) && node.parent.right === node; } function getSymbolOfEntityName(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 191 /* ExportAssignment */) { + if (entityName.parent.kind === 194 /* ExportAssignment */) { return resolveEntityName(entityName.parent.parent, entityName, 107455 /* Value */ | 3152352 /* Type */ | 1536 /* Namespace */ | 33554432 /* Import */); } if (isInRightSideOfImportOrExportAssignment(entityName)) { @@ -15568,7 +15838,7 @@ var ts; var meaning = 107455 /* Value */ | 33554432 /* Import */; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 121 /* QualifiedName */ || entityName.kind === 142 /* PropertyAccess */) { + else if (entityName.kind === 121 /* QualifiedName */ || entityName.kind === 145 /* PropertyAccess */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccess(entityName); @@ -15594,11 +15864,11 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 63 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 191 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); + return node.parent.kind === 194 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { case 63 /* Identifier */: - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: case 121 /* QualifiedName */: return getSymbolOfEntityName(node); case 91 /* ThisKeyword */: @@ -15612,13 +15882,13 @@ var ts; } return undefined; case 7 /* StringLiteral */: - if (node.parent.kind === 190 /* ImportDeclaration */ && node.parent.externalModuleName === node) { + if (node.parent.kind === 193 /* ImportDeclaration */ && node.parent.externalModuleName === node) { var importSymbol = getSymbolOfNode(node.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } case 6 /* NumericLiteral */: - if (node.parent.kind == 143 /* IndexedAccess */ && node.parent.index === node) { + if (node.parent.kind == 146 /* IndexedAccess */ && node.parent.index === node) { var objectType = checkExpression(node.parent.object); if (objectType === unknownType) return undefined; @@ -15631,6 +15901,12 @@ var ts; } return undefined; } + function getShorthandAssignmentValueSymbol(location) { + if (location && location.kind === 144 /* ShorthandPropertyAssignment */) { + return resolveEntityName(location, location.name, 107455 /* Value */); + } + return undefined; + } function getTypeOfNode(node) { if (isInsideWithStatementBody(node)) { return unknownType; @@ -15700,7 +15976,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 193 /* SourceFile */; + return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 196 /* SourceFile */; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -15733,7 +16009,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 188 /* ModuleDeclaration */ || node.kind === 187 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 191 /* ModuleDeclaration */ || node.kind === 190 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -15757,15 +16033,17 @@ var ts; return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; } function isTopLevelValueImportWithEntityName(node) { - if (node.parent.kind !== 193 /* SourceFile */ || !node.entityName) { + if (node.parent.kind !== 196 /* SourceFile */ || !node.entityName) { return false; } - var symbol = getSymbolOfNode(node); return isImportResolvedToValue(getSymbolOfNode(node)); } function hasSemanticErrors() { return getDiagnostics().length > 0 || getGlobalDiagnostics().length > 0; } + function isEmitBlocked(sourceFile) { + return program.getDiagnostics(sourceFile).length !== 0 || hasEarlyErrors(sourceFile) || (compilerOptions.noEmitOnError && getDiagnostics(sourceFile).length !== 0); + } function hasEarlyErrors(sourceFile) { return ts.forEach(getDiagnostics(sourceFile), function (d) { return d.isEarly; }); } @@ -15806,7 +16084,7 @@ var ts; if (symbol && (symbol.flags & 8 /* EnumMember */)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 192 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { + if (declaration.kind === 195 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { return constantValue; } } @@ -15814,7 +16092,7 @@ var ts; } function writeTypeAtLocation(location, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(location); - var type = symbol && !(symbol.flags & 2048 /* TypeLiteral */) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); + var type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* CallSignature */ | 262144 /* ConstructSignature */)) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -15832,7 +16110,7 @@ var ts; getEnumMemberValue: getEnumMemberValue, isTopLevelValueImportWithEntityName: isTopLevelValueImportWithEntityName, hasSemanticErrors: hasSemanticErrors, - hasEarlyErrors: hasEarlyErrors, + isEmitBlocked: isEmitBlocked, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, writeTypeAtLocation: writeTypeAtLocation, @@ -15866,1729 +16144,19 @@ var ts; globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); + globalTemplateStringsArrayType = compilerOptions.target >= 2 /* ES6 */ ? getGlobalType("TemplateStringsArray") : unknownType; } initializeTypeChecker(); return checker; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.DiagnosticCode = { - error_TS_0_1: "error TS{0}: {1}", - warning_TS_0_1: "warning TS{0}: {1}", - Unrecognized_escape_sequence: "Unrecognized escape sequence.", - Unexpected_character_0: "Unexpected character {0}.", - Missing_close_quote_character: "Missing close quote character.", - Identifier_expected: "Identifier expected.", - _0_keyword_expected: "'{0}' keyword expected.", - _0_expected: "'{0}' expected.", - Identifier_expected_0_is_a_keyword: "Identifier expected; '{0}' is a keyword.", - Automatic_semicolon_insertion_not_allowed: "Automatic semicolon insertion not allowed.", - Unexpected_token_0_expected: "Unexpected token; '{0}' expected.", - Trailing_comma_not_allowed: "Trailing comma not allowed.", - public_or_private_modifier_must_precede_static: "'public' or 'private' modifier must precede 'static'.", - Unexpected_token: "Unexpected token.", - Catch_clause_parameter_cannot_have_a_type_annotation: "Catch clause parameter cannot have a type annotation.", - A_rest_parameter_must_be_last_in_a_parameter_list: "A rest parameter must be last in a parameter list.", - Parameter_cannot_have_question_mark_and_initializer: "Parameter cannot have question mark and initializer.", - A_required_parameter_cannot_follow_an_optional_parameter: "A required parameter cannot follow an optional parameter.", - Index_signatures_cannot_have_rest_parameters: "Index signatures cannot have rest parameters.", - Index_signature_parameter_cannot_have_accessibility_modifiers: "Index signature parameter cannot have accessibility modifiers.", - Index_signature_parameter_cannot_have_a_question_mark: "Index signature parameter cannot have a question mark.", - Index_signature_parameter_cannot_have_an_initializer: "Index signature parameter cannot have an initializer.", - Index_signature_must_have_a_type_annotation: "Index signature must have a type annotation.", - Index_signature_parameter_must_have_a_type_annotation: "Index signature parameter must have a type annotation.", - Index_signature_parameter_type_must_be_string_or_number: "Index signature parameter type must be 'string' or 'number'.", - extends_clause_already_seen: "'extends' clause already seen.", - extends_clause_must_precede_implements_clause: "'extends' clause must precede 'implements' clause.", - Classes_can_only_extend_a_single_class: "Classes can only extend a single class.", - implements_clause_already_seen: "'implements' clause already seen.", - Accessibility_modifier_already_seen: "Accessibility modifier already seen.", - _0_modifier_must_precede_1_modifier: "'{0}' modifier must precede '{1}' modifier.", - _0_modifier_already_seen: "'{0}' modifier already seen.", - _0_modifier_cannot_appear_on_a_class_element: "'{0}' modifier cannot appear on a class element.", - Interface_declaration_cannot_have_implements_clause: "Interface declaration cannot have 'implements' clause.", - super_invocation_cannot_have_type_arguments: "'super' invocation cannot have type arguments.", - Only_ambient_modules_can_use_quoted_names: "Only ambient modules can use quoted names.", - Statements_are_not_allowed_in_ambient_contexts: "Statements are not allowed in ambient contexts.", - A_function_implementation_cannot_be_declared_in_an_ambient_context: "A function implementation cannot be declared in an ambient context.", - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: "A 'declare' modifier cannot be used in an already ambient context.", - Initializers_are_not_allowed_in_ambient_contexts: "Initializers are not allowed in ambient contexts.", - _0_modifier_cannot_appear_on_a_module_element: "'{0}' modifier cannot appear on a module element.", - A_declare_modifier_cannot_be_used_with_an_interface_declaration: "A 'declare' modifier cannot be used with an interface declaration.", - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: "A 'declare' modifier is required for a top level declaration in a .d.ts file.", - A_rest_parameter_cannot_be_optional: "A rest parameter cannot be optional.", - A_rest_parameter_cannot_have_an_initializer: "A rest parameter cannot have an initializer.", - set_accessor_must_have_exactly_one_parameter: "'set' accessor must have exactly one parameter.", - set_accessor_parameter_cannot_be_optional: "'set' accessor parameter cannot be optional.", - set_accessor_parameter_cannot_have_an_initializer: "'set' accessor parameter cannot have an initializer.", - set_accessor_cannot_have_rest_parameter: "'set' accessor cannot have rest parameter.", - get_accessor_cannot_have_parameters: "'get' accessor cannot have parameters.", - Modifiers_cannot_appear_here: "Modifiers cannot appear here.", - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: "Accessors are only available when targeting ECMAScript 5 and higher.", - Enum_member_must_have_initializer: "Enum member must have initializer.", - Export_assignment_cannot_be_used_in_internal_modules: "Export assignment cannot be used in internal modules.", - Ambient_enum_elements_can_only_have_integer_literal_initializers: "Ambient enum elements can only have integer literal initializers.", - module_class_interface_enum_import_or_statement: "module, class, interface, enum, import or statement", - constructor_function_accessor_or_variable: "constructor, function, accessor or variable", - statement: "statement", - case_or_default_clause: "case or default clause", - identifier: "identifier", - call_construct_index_property_or_function_signature: "call, construct, index, property or function signature", - expression: "expression", - type_name: "type name", - property_or_accessor: "property or accessor", - parameter: "parameter", - type: "type", - type_parameter: "type parameter", - A_declare_modifier_cannot_be_used_with_an_import_declaration: "A 'declare' modifier cannot be used with an import declaration.", - Invalid_reference_directive_syntax: "Invalid 'reference' directive syntax.", - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: "Octal literals are not available when targeting ECMAScript 5 and higher.", - Accessors_are_not_allowed_in_ambient_contexts: "Accessors are not allowed in ambient contexts.", - _0_modifier_cannot_appear_on_a_constructor_declaration: "'{0}' modifier cannot appear on a constructor declaration.", - _0_modifier_cannot_appear_on_a_parameter: "'{0}' modifier cannot appear on a parameter.", - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: "Only a single variable declaration is allowed in a 'for...in' statement.", - Type_parameters_cannot_appear_on_a_constructor_declaration: "Type parameters cannot appear on a constructor declaration.", - Type_annotation_cannot_appear_on_a_constructor_declaration: "Type annotation cannot appear on a constructor declaration.", - Type_parameters_cannot_appear_on_an_accessor: "Type parameters cannot appear on an accessor.", - Type_annotation_cannot_appear_on_a_set_accessor: "Type annotation cannot appear on a 'set' accessor.", - Index_signature_must_have_exactly_one_parameter: "Index signature must have exactly one parameter.", - _0_list_cannot_be_empty: "'{0}' list cannot be empty.", - variable_declaration: "variable declaration", - type_argument: "type argument", - Invalid_use_of_0_in_strict_mode: "Invalid use of '{0}' in strict mode.", - with_statements_are_not_allowed_in_strict_mode: "'with' statements are not allowed in strict mode.", - delete_cannot_be_called_on_an_identifier_in_strict_mode: "'delete' cannot be called on an identifier in strict mode.", - Invalid_left_hand_side_in_for_in_statement: "Invalid left-hand side in 'for...in' statement.", - continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: "'continue' statement can only be used within an enclosing iteration statement.", - break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: "'break' statement can only be used within an enclosing iteration or switch statement.", - Jump_target_not_found: "Jump target not found.", - Jump_target_cannot_cross_function_boundary: "Jump target cannot cross function boundary.", - return_statement_must_be_contained_within_a_function_body: "'return' statement must be contained within a function body.", - Expression_expected: "Expression expected.", - Type_expected: "Type expected.", - Template_literal_cannot_be_used_as_an_element_name: "Template literal cannot be used as an element name.", - Duplicate_identifier_0: "Duplicate identifier '{0}'.", - The_name_0_does_not_exist_in_the_current_scope: "The name '{0}' does not exist in the current scope.", - The_name_0_does_not_refer_to_a_value: "The name '{0}' does not refer to a value.", - super_can_only_be_used_inside_a_class_instance_method: "'super' can only be used inside a class instance method.", - The_left_hand_side_of_an_assignment_expression_must_be_a_variable_property_or_indexer: "The left-hand side of an assignment expression must be a variable, property or indexer.", - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: "Value of type '{0}' is not callable. Did you mean to include 'new'?", - Value_of_type_0_is_not_callable: "Value of type '{0}' is not callable.", - Value_of_type_0_is_not_newable: "Value of type '{0}' is not newable.", - An_index_expression_argument_must_be_string_number_or_any: "An index expression argument must be 'string', 'number', or 'any'.", - Operator_0_cannot_be_applied_to_types_1_and_2: "Operator '{0}' cannot be applied to types '{1}' and '{2}'.", - Type_0_is_not_assignable_to_type_1: "Type '{0}' is not assignable to type '{1}'.", - Type_0_is_not_assignable_to_type_1_NL_2: "Type '{0}' is not assignable to type '{1}':{NL}{2}", - Expected_var_class_interface_or_module: "Expected var, class, interface, or module.", - Getter_0_already_declared: "Getter '{0}' already declared.", - Setter_0_already_declared: "Setter '{0}' already declared.", - Exported_class_0_extends_private_class_1: "Exported class '{0}' extends private class '{1}'.", - Exported_class_0_implements_private_interface_1: "Exported class '{0}' implements private interface '{1}'.", - Exported_interface_0_extends_private_interface_1: "Exported interface '{0}' extends private interface '{1}'.", - Exported_class_0_extends_class_from_inaccessible_module_1: "Exported class '{0}' extends class from inaccessible module {1}.", - Exported_class_0_implements_interface_from_inaccessible_module_1: "Exported class '{0}' implements interface from inaccessible module {1}.", - Exported_interface_0_extends_interface_from_inaccessible_module_1: "Exported interface '{0}' extends interface from inaccessible module {1}.", - Public_static_property_0_of_exported_class_has_or_is_using_private_type_1: "Public static property '{0}' of exported class has or is using private type '{1}'.", - Public_property_0_of_exported_class_has_or_is_using_private_type_1: "Public property '{0}' of exported class has or is using private type '{1}'.", - Property_0_of_exported_interface_has_or_is_using_private_type_1: "Property '{0}' of exported interface has or is using private type '{1}'.", - Exported_variable_0_has_or_is_using_private_type_1: "Exported variable '{0}' has or is using private type '{1}'.", - Public_static_property_0_of_exported_class_is_using_inaccessible_module_1: "Public static property '{0}' of exported class is using inaccessible module {1}.", - Public_property_0_of_exported_class_is_using_inaccessible_module_1: "Public property '{0}' of exported class is using inaccessible module {1}.", - Property_0_of_exported_interface_is_using_inaccessible_module_1: "Property '{0}' of exported interface is using inaccessible module {1}.", - Exported_variable_0_is_using_inaccessible_module_1: "Exported variable '{0}' is using inaccessible module {1}.", - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.", - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.", - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.", - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1: "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1: "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.", - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1: "Parameter '{0}' of public method from exported class has or is using private type '{1}'.", - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1: "Parameter '{0}' of method from exported interface has or is using private type '{1}'.", - Parameter_0_of_exported_function_has_or_is_using_private_type_1: "Parameter '{0}' of exported function has or is using private type '{1}'.", - Parameter_0_of_constructor_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.", - Parameter_0_of_public_static_property_setter_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.", - Parameter_0_of_public_property_setter_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.", - Parameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1: "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - Parameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1: "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}", - Parameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.", - Parameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1: "Parameter '{0}' of public method from exported class is using inaccessible module {1}.", - Parameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1: "Parameter '{0}' of method from exported interface is using inaccessible module {1}.", - Parameter_0_of_exported_function_is_using_inaccessible_module_1: "Parameter '{0}' of exported function is using inaccessible module {1}.", - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_type_0: "Return type of public static property getter from exported class has or is using private type '{0}'.", - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_type_0: "Return type of public property getter from exported class has or is using private type '{0}'.", - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_0: "Return type of constructor signature from exported interface has or is using private type '{0}'.", - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_type_0: "Return type of call signature from exported interface has or is using private type '{0}'.", - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_type_0: "Return type of index signature from exported interface has or is using private type '{0}'.", - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_type_0: "Return type of public static method from exported class has or is using private type '{0}'.", - Return_type_of_public_method_from_exported_class_has_or_is_using_private_type_0: "Return type of public method from exported class has or is using private type '{0}'.", - Return_type_of_method_from_exported_interface_has_or_is_using_private_type_0: "Return type of method from exported interface has or is using private type '{0}'.", - Return_type_of_exported_function_has_or_is_using_private_type_0: "Return type of exported function has or is using private type '{0}'.", - Return_type_of_public_static_property_getter_from_exported_class_is_using_inaccessible_module_0: "Return type of public static property getter from exported class is using inaccessible module {0}.", - Return_type_of_public_property_getter_from_exported_class_is_using_inaccessible_module_0: "Return type of public property getter from exported class is using inaccessible module {0}.", - Return_type_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_0: "Return type of constructor signature from exported interface is using inaccessible module {0}.", - Return_type_of_call_signature_from_exported_interface_is_using_inaccessible_module_0: "Return type of call signature from exported interface is using inaccessible module {0}.", - Return_type_of_index_signature_from_exported_interface_is_using_inaccessible_module_0: "Return type of index signature from exported interface is using inaccessible module {0}.", - Return_type_of_public_static_method_from_exported_class_is_using_inaccessible_module_0: "Return type of public static method from exported class is using inaccessible module {0}.", - Return_type_of_public_method_from_exported_class_is_using_inaccessible_module_0: "Return type of public method from exported class is using inaccessible module {0}.", - Return_type_of_method_from_exported_interface_is_using_inaccessible_module_0: "Return type of method from exported interface is using inaccessible module {0}.", - Return_type_of_exported_function_is_using_inaccessible_module_0: "Return type of exported function is using inaccessible module {0}.", - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", - A_parameter_list_must_follow_a_generic_type_argument_list_expected: "A parameter list must follow a generic type argument list. '(' expected.", - Multiple_constructor_implementations_are_not_allowed: "Multiple constructor implementations are not allowed.", - Cannot_find_external_module_0: "Cannot find external module '{0}'.", - Module_cannot_be_aliased_to_a_non_module_type: "Module cannot be aliased to a non-module type.", - A_class_may_only_extend_another_class: "A class may only extend another class.", - A_class_may_only_implement_another_class_or_interface: "A class may only implement another class or interface.", - An_interface_may_only_extend_a_class_or_another_interface: "An interface may only extend a class or another interface.", - Unable_to_resolve_type: "Unable to resolve type.", - Unable_to_resolve_type_of_0: "Unable to resolve type of '{0}'.", - Unable_to_resolve_type_parameter_constraint: "Unable to resolve type parameter constraint.", - Type_parameter_constraint_cannot_be_a_primitive_type: "Type parameter constraint cannot be a primitive type.", - Supplied_parameters_do_not_match_any_signature_of_call_target: "Supplied parameters do not match any signature of call target.", - Supplied_parameters_do_not_match_any_signature_of_call_target_NL_0: "Supplied parameters do not match any signature of call target:{NL}{0}", - Cannot_use_new_with_an_expression_whose_type_lacks_a_signature: "Cannot use 'new' with an expression whose type lacks a signature.", - Only_a_void_function_can_be_called_with_the_new_keyword: "Only a void function can be called with the 'new' keyword.", - Could_not_select_overload_for_new_expression: "Could not select overload for 'new' expression.", - Type_0_does_not_satisfy_the_constraint_1: "Type '{0}' does not satisfy the constraint '{1}'.", - Could_not_select_overload_for_call_expression: "Could not select overload for 'call' expression.", - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: "Cannot invoke an expression whose type lacks a call signature.", - Calls_to_super_are_only_valid_inside_a_class: "Calls to 'super' are only valid inside a class.", - Generic_type_0_requires_1_type_argument_s: "Generic type '{0}' requires {1} type argument(s).", - Type_of_array_literal_cannot_be_determined_Best_common_type_could_not_be_found_for_array_elements: "Type of array literal cannot be determined. Best common type could not be found for array elements.", - Could_not_find_enclosing_symbol_for_dotted_name_0: "Could not find enclosing symbol for dotted name '{0}'.", - Property_0_does_not_exist_on_value_of_type_1: "Property '{0}' does not exist on value of type '{1}'.", - Cannot_find_name_0: "Cannot find name '{0}'.", - get_and_set_accessor_must_have_the_same_type: "'get' and 'set' accessor must have the same type.", - this_cannot_be_referenced_in_current_location: "'this' cannot be referenced in current location.", - Static_members_cannot_reference_class_type_parameters: "Static members cannot reference class type parameters.", - Type_0_recursively_references_itself_as_a_base_type: "Type '{0}' recursively references itself as a base type.", - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.", - super_can_only_be_referenced_in_a_derived_class: "'super' can only be referenced in a derived class.", - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.", - Constructors_for_derived_classes_must_contain_a_super_call: "Constructors for derived classes must contain a 'super' call.", - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: "Super calls are not permitted outside constructors or in nested functions inside constructors.", - _0_1_is_inaccessible: "'{0}.{1}' is inaccessible.", - this_cannot_be_referenced_in_a_module_body: "'this' cannot be referenced in a module body.", - Invalid_expression_types_not_known_to_support_the_addition_operator: "Invalid '+' expression - types not known to support the addition operator.", - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.", - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: "An arithmetic operand must be of type 'any', 'number' or an enum type.", - Variable_declarations_of_a_for_statement_cannot_use_a_type_annotation: "Variable declarations of a 'for' statement cannot use a type annotation.", - Variable_declarations_of_a_for_statement_must_be_of_types_string_or_any: "Variable declarations of a 'for' statement must be of types 'string' or 'any'.", - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.", - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.", - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.", - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.", - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.", - Setters_cannot_return_a_value: "Setters cannot return a value.", - Tried_to_query_type_of_uninitialized_module_0: "Tried to query type of uninitialized module '{0}'.", - Tried_to_set_variable_type_to_uninitialized_module_type_0: "Tried to set variable type to uninitialized module type '{0}'.", - Type_0_is_not_generic: "Type '{0}' is not generic.", - Getters_must_return_a_value: "Getters must return a value.", - Getter_and_setter_accessors_do_not_agree_in_visibility: "Getter and setter accessors do not agree in visibility.", - Invalid_left_hand_side_of_assignment_expression: "Invalid left-hand side of assignment expression.", - Function_declared_a_non_void_return_type_but_has_no_return_expression: "Function declared a non-void return type, but has no return expression.", - Cannot_resolve_return_type_reference: "Cannot resolve return type reference.", - Constructors_cannot_have_a_return_type_of_void: "Constructors cannot have a return type of 'void'.", - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.", - All_symbols_within_a_with_block_will_be_resolved_to_any: "All symbols within a with block will be resolved to 'any'.", - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: "Import declarations in an internal module cannot reference an external module.", - Class_0_declares_interface_1_but_does_not_implement_it_NL_2: "Class {0} declares interface {1} but does not implement it:{NL}{2}", - Class_0_declares_class_1_as_an_interface_but_does_not_implement_it_NL_2: "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}", - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: "The operand of an increment or decrement operator must be a variable, property or indexer.", - this_cannot_be_referenced_in_a_static_property_initializer: "'this' cannot be referenced in a static property initializer.", - Class_0_cannot_extend_class_1_NL_2: "Class '{0}' cannot extend class '{1}':{NL}{2}", - Interface_0_cannot_extend_class_1_NL_2: "Interface '{0}' cannot extend class '{1}':{NL}{2}", - Interface_0_cannot_extend_interface_1_NL_2: "Interface '{0}' cannot extend interface '{1}':{NL}{2}", - Overload_signature_is_not_compatible_with_function_definition: "Overload signature is not compatible with function definition.", - Overload_signature_is_not_compatible_with_function_definition_NL_0: "Overload signature is not compatible with function definition:{NL}{0}", - Overload_signatures_must_all_be_public_or_private: "Overload signatures must all be public or private.", - Overload_signatures_must_all_be_exported_or_not_exported: "Overload signatures must all be exported or not exported.", - Overload_signatures_must_all_be_ambient_or_non_ambient: "Overload signatures must all be ambient or non-ambient.", - Overload_signatures_must_all_be_optional_or_required: "Overload signatures must all be optional or required.", - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: "Specialized overload signature is not assignable to any non-specialized signature.", - this_cannot_be_referenced_in_constructor_arguments: "'this' cannot be referenced in constructor arguments.", - Instance_member_cannot_be_accessed_off_a_class: "Instance member cannot be accessed off a class.", - Untyped_function_calls_may_not_accept_type_arguments: "Untyped function calls may not accept type arguments.", - Non_generic_functions_may_not_accept_type_arguments: "Non-generic functions may not accept type arguments.", - A_generic_type_may_not_reference_itself_with_a_wrapped_form_of_its_own_type_parameters: "A generic type may not reference itself with a wrapped form of its own type parameters.", - A_rest_parameter_must_be_of_an_array_type: "A rest parameter must be of an array type.", - Overload_signature_implementation_cannot_use_specialized_type: "Overload signature implementation cannot use specialized type.", - Export_assignments_may_only_be_used_at_the_top_level_of_external_modules: "Export assignments may only be used at the top-level of external modules.", - Export_assignments_may_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules: "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules.", - Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword: "Only public methods of the base class are accessible via the 'super' keyword.", - Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1: "Numeric indexer type '{0}' must be assignable to string indexer type '{1}'.", - Numeric_indexer_type_0_must_be_assignable_to_string_indexer_type_1_NL_2: "Numeric indexer type '{0}' must be assignable to string indexer type '{1}':{NL}{2}", - All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0: "All numerically named properties must be assignable to numeric indexer type '{0}'.", - All_numerically_named_properties_must_be_assignable_to_numeric_indexer_type_0_NL_1: "All numerically named properties must be assignable to numeric indexer type '{0}':{NL}{1}", - All_named_properties_must_be_assignable_to_string_indexer_type_0: "All named properties must be assignable to string indexer type '{0}'.", - All_named_properties_must_be_assignable_to_string_indexer_type_0_NL_1: "All named properties must be assignable to string indexer type '{0}':{NL}{1}", - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: "A parameter initializer is only allowed in a function or constructor implementation.", - Function_expression_declared_a_non_void_return_type_but_has_no_return_expression: "Function expression declared a non-void return type, but has no return expression.", - Import_declaration_referencing_identifier_from_internal_module_can_only_be_made_with_variables_functions_classes_interfaces_enums_and_internal_modules: "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.", - Module_0_has_no_exported_member_1: "Module '{0}' has no exported member '{1}'.", - Unable_to_resolve_module_reference_0: "Unable to resolve module reference '{0}'.", - Could_not_find_module_0_in_module_1: "Could not find module '{0}' in module '{1}'.", - Exported_import_declaration_0_is_assigned_value_with_type_that_has_or_is_using_private_type_1: "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.", - Exported_import_declaration_0_is_assigned_value_with_type_that_is_using_inaccessible_module_1: "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.", - Exported_import_declaration_0_is_assigned_type_that_has_or_is_using_private_type_1: "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.", - Exported_import_declaration_0_is_assigned_type_that_is_using_inaccessible_module_1: "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.", - Exported_import_declaration_0_is_assigned_container_that_is_or_is_using_inaccessible_module_1: "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.", - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_1: "Type name '{0}' in extends clause does not reference constructor function for '{1}'.", - Internal_module_reference_0_in_import_declaration_does_not_reference_module_instance_for_1: "Internal module reference '{0}' in import declaration does not reference module instance for '{1}'.", - Module_0_cannot_merge_with_previous_declaration_of_1_in_a_different_file_2: "Module '{0}' cannot merge with previous declaration of '{1}' in a different file '{2}'.", - Interface_0_cannot_simultaneously_extend_types_1_and_2_NL_3: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':{NL}{3}", - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.", - Ambient_external_module_declaration_cannot_be_reopened: "Ambient external module declaration cannot be reopened.", - All_declarations_of_merged_declaration_0_must_be_exported_or_not_exported: "All declarations of merged declaration '{0}' must be exported or not exported.", - super_cannot_be_referenced_in_constructor_arguments: "'super' cannot be referenced in constructor arguments.", - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: "Return type of constructor signature must be assignable to the instance type of the class.", - Ambient_external_module_declaration_must_be_defined_in_global_context: "Ambient external module declaration must be defined in global context.", - Ambient_external_module_declaration_cannot_specify_relative_module_name: "Ambient external module declaration cannot specify relative module name.", - Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name.", - No_best_common_type_exists_among_return_expressions: "No best common type exists among return expressions.", - Import_declaration_cannot_refer_to_external_module_reference_when_noResolve_option_is_set: "Import declaration cannot refer to external module reference when --noResolve option is set.", - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.", - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.", - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.", - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: "Expression resolves to '_super' that compiler uses to capture base class reference.", - TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.", - TypeParameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of call signature from exported interface has or is using private type '{1}'.", - TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1: "TypeParameter '{0}' of public static method from exported class has or is using private type '{1}'.", - TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1: "TypeParameter '{0}' of public method from exported class has or is using private type '{1}'.", - TypeParameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of method from exported interface has or is using private type '{1}'.", - TypeParameter_0_of_exported_function_has_or_is_using_private_type_1: "TypeParameter '{0}' of exported function has or is using private type '{1}'.", - TypeParameter_0_of_constructor_signature_from_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.", - TypeParameter_0_of_call_signature_from_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of call signature from exported interface is using inaccessible module {1}", - TypeParameter_0_of_public_static_method_from_exported_class_is_using_inaccessible_module_1: "TypeParameter '{0}' of public static method from exported class is using inaccessible module {1}.", - TypeParameter_0_of_public_method_from_exported_class_is_using_inaccessible_module_1: "TypeParameter '{0}' of public method from exported class is using inaccessible module {1}.", - TypeParameter_0_of_method_from_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of method from exported interface is using inaccessible module {1}.", - TypeParameter_0_of_exported_function_is_using_inaccessible_module_1: "TypeParameter '{0}' of exported function is using inaccessible module {1}.", - TypeParameter_0_of_exported_class_has_or_is_using_private_type_1: "TypeParameter '{0}' of exported class has or is using private type '{1}'.", - TypeParameter_0_of_exported_interface_has_or_is_using_private_type_1: "TypeParameter '{0}' of exported interface has or is using private type '{1}'.", - TypeParameter_0_of_exported_class_is_using_inaccessible_module_1: "TypeParameter '{0}' of exported class is using inaccessible module {1}.", - TypeParameter_0_of_exported_interface_is_using_inaccessible_module_1: "TypeParameter '{0}' of exported interface is using inaccessible module {1}.", - Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter.", - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", - No_best_common_type_exists_between_0_and_1: "No best common type exists between '{0}' and '{1}'.", - No_best_common_type_exists_between_0_1_and_2: "No best common type exists between '{0}', '{1}', and '{2}'.", - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module.", - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list.", - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.", - Parameter_0_cannot_be_referenced_in_its_initializer: "Parameter '{0}' cannot be referenced in its initializer.", - Duplicate_string_index_signature: "Duplicate string index signature.", - Duplicate_number_index_signature: "Duplicate number index signature.", - All_declarations_of_an_interface_must_have_identical_type_parameters: "All declarations of an interface must have identical type parameters.", - Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter.", - Neither_type_0_nor_type_1_is_assignable_to_the_other: "Neither type '{0}' nor type '{1}' is assignable to the other.", - Neither_type_0_nor_type_1_is_assignable_to_the_other_NL_2: "Neither type '{0}' nor type '{1}' is assignable to the other:{NL}{2}", - Duplicate_function_implementation: "Duplicate function implementation.", - Function_implementation_expected: "Function implementation expected.", - Function_overload_name_must_be_0: "Function overload name must be '{0}'.", - Constructor_implementation_expected: "Constructor implementation expected.", - Class_name_cannot_be_0: "Class name cannot be '{0}'.", - Interface_name_cannot_be_0: "Interface name cannot be '{0}'.", - Enum_name_cannot_be_0: "Enum name cannot be '{0}'.", - A_module_cannot_have_multiple_export_assignments: "A module cannot have multiple export assignments.", - Export_assignment_not_allowed_in_module_with_exported_element: "Export assignment not allowed in module with exported element.", - A_parameter_property_is_only_allowed_in_a_constructor_implementation: "A parameter property is only allowed in a constructor implementation.", - Function_overload_must_be_static: "Function overload must be static.", - Function_overload_must_not_be_static: "Function overload must not be static.", - Type_0_is_missing_property_1_from_type_2: "Type '{0}' is missing property '{1}' from type '{2}'.", - Types_of_property_0_of_types_1_and_2_are_incompatible: "Types of property '{0}' of types '{1}' and '{2}' are incompatible.", - Types_of_property_0_of_types_1_and_2_are_incompatible_NL_3: "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}", - Property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2: "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - Property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2: "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - Types_0_and_1_define_property_2_as_private: "Types '{0}' and '{1}' define property '{2}' as private.", - Call_signatures_of_types_0_and_1_are_incompatible: "Call signatures of types '{0}' and '{1}' are incompatible.", - Call_signatures_of_types_0_and_1_are_incompatible_NL_2: "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - Type_0_requires_a_call_signature_but_type_1_lacks_one: "Type '{0}' requires a call signature, but type '{1}' lacks one.", - Construct_signatures_of_types_0_and_1_are_incompatible: "Construct signatures of types '{0}' and '{1}' are incompatible.", - Construct_signatures_of_types_0_and_1_are_incompatible_NL_2: "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - Type_0_requires_a_construct_signature_but_type_1_lacks_one: "Type '{0}' requires a construct signature, but type '{1}' lacks one.", - Index_signatures_of_types_0_and_1_are_incompatible: "Index signatures of types '{0}' and '{1}' are incompatible.", - Index_signatures_of_types_0_and_1_are_incompatible_NL_2: "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}", - Call_signature_expects_0_or_fewer_parameters: "Call signature expects {0} or fewer parameters.", - Could_not_apply_type_0_to_argument_1_which_is_of_type_2: "Could not apply type '{0}' to argument {1} which is of type '{2}'.", - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.", - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.", - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.", - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.", - Types_of_static_property_0_of_class_1_and_class_2_are_incompatible: "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.", - Types_of_static_property_0_of_class_1_and_class_2_are_incompatible_NL_3: "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}", - Type_reference_cannot_refer_to_container_0: "Type reference cannot refer to container '{0}'.", - Type_reference_must_refer_to_type: "Type reference must refer to type.", - In_enums_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_the_first_enum_element: "In enums with multiple declarations only one declaration can omit an initializer for the first enum element.", - _0_overload_s: " (+ {0} overload(s))", - Variable_declaration_cannot_have_the_same_name_as_an_import_declaration: "Variable declaration cannot have the same name as an import declaration.", - Signature_expected_0_type_arguments_got_1_instead: "Signature expected {0} type arguments, got {1} instead.", - Property_0_defined_as_optional_in_type_1_but_is_required_in_type_2: "Property '{0}' defined as optional in type '{1}', but is required in type '{2}'.", - Types_0_and_1_originating_in_infinitely_expanding_type_reference_do_not_refer_to_same_named_type: "Types '{0}' and '{1}' originating in infinitely expanding type reference do not refer to same named type.", - Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments: "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments.", - Types_0_and_1_originating_in_infinitely_expanding_type_reference_have_incompatible_type_arguments_NL_2: "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments:{NL}{2}", - Named_properties_0_of_types_1_and_2_are_not_identical: "Named properties '{0}' of types '{1}' and '{2}' are not identical.", - Types_of_string_indexer_of_types_0_and_1_are_not_identical: "Types of string indexer of types '{0}' and '{1}' are not identical.", - Types_of_number_indexer_of_types_0_and_1_are_not_identical: "Types of number indexer of types '{0}' and '{1}' are not identical.", - Type_of_number_indexer_in_type_0_is_not_assignable_to_string_indexer_type_in_type_1_NL_2: "Type of number indexer in type '{0}' is not assignable to string indexer type in type '{1}'.{NL}{2}", - Type_of_property_0_in_type_1_is_not_assignable_to_string_indexer_type_in_type_2_NL_3: "Type of property '{0}' in type '{1}' is not assignable to string indexer type in type '{2}'.{NL}{3}", - Type_of_property_0_in_type_1_is_not_assignable_to_number_indexer_type_in_type_2_NL_3: "Type of property '{0}' in type '{1}' is not assignable to number indexer type in type '{2}'.{NL}{3}", - Static_property_0_defined_as_private_in_type_1_is_defined_as_public_in_type_2: "Static property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.", - Static_property_0_defined_as_public_in_type_1_is_defined_as_private_in_type_2: "Static property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.", - Types_0_and_1_define_static_property_2_as_private: "Types '{0}' and '{1}' define static property '{2}' as private.", - Current_host_does_not_support_0_option: "Current host does not support '{0}' option.", - ECMAScript_target_version_0_not_supported_Specify_a_valid_target_version_1_default_or_2: "ECMAScript target version '{0}' not supported. Specify a valid target version: '{1}' (default), or '{2}'", - Argument_for_0_option_must_be_1_or_2: "Argument for '{0}' option must be '{1}' or '{2}'", - Could_not_find_file_0: "Could not find file: '{0}'.", - A_file_cannot_have_a_reference_to_itself: "A file cannot have a reference to itself.", - Cannot_resolve_referenced_file_0: "Cannot resolve referenced file: '{0}'.", - Cannot_find_the_common_subdirectory_path_for_the_input_files: "Cannot find the common subdirectory path for the input files.", - Emit_Error_0: "Emit Error: {0}.", - Cannot_read_file_0_1: "Cannot read file '{0}': {1}", - Unsupported_file_encoding: "Unsupported file encoding.", - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: "Locale must be of the form or -. For example '{0}' or '{1}'.", - Unsupported_locale_0: "Unsupported locale: '{0}'.", - Execution_Failed_NL: "Execution Failed.{NL}", - Invalid_call_to_up: "Invalid call to 'up'", - Invalid_call_to_down: "Invalid call to 'down'", - Base64_value_0_finished_with_a_continuation_bit: "Base64 value '{0}' finished with a continuation bit.", - Unknown_compiler_option_0: "Unknown compiler option '{0}'", - Expected_0_arguments_to_message_got_1_instead: "Expected {0} arguments to message, got {1} instead.", - Expected_the_message_0_to_have_1_arguments_but_it_had_2: "Expected the message '{0}' to have {1} arguments, but it had {2}", - Could_not_delete_file_0: "Could not delete file '{0}'", - Could_not_create_directory_0: "Could not create directory '{0}'", - Error_while_executing_file_0: "Error while executing file '{0}': ", - Cannot_compile_external_modules_unless_the_module_flag_is_provided: "Cannot compile external modules unless the '--module' flag is provided.", - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: "Option mapRoot cannot be specified without specifying sourcemap option.", - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: "Option sourceRoot cannot be specified without specifying sourcemap option.", - Options_mapRoot_and_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.", - Option_0_specified_without_1: "Option '{0}' specified without '{1}'", - codepage_option_not_supported_on_current_platform: "'codepage' option not supported on current platform.", - Concatenate_and_emit_output_to_single_file: "Concatenate and emit output to single file.", - Generates_corresponding_0_file: "Generates corresponding {0} file.", - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: "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: "Specifies the location where debugger should locate TypeScript files instead of source locations.", - Watch_input_files: "Watch input files.", - Redirect_output_structure_to_the_directory: "Redirect output structure to the directory.", - Do_not_emit_comments_to_output: "Do not emit comments to output.", - Skip_resolution_and_preprocessing: "Skip resolution and preprocessing.", - Specify_ECMAScript_target_version_0_default_or_1: "Specify ECMAScript target version: '{0}' (default), or '{1}'", - Specify_module_code_generation_0_or_1: "Specify module code generation: '{0}' or '{1}'", - Print_this_message: "Print this message.", - Print_the_compiler_s_version_0: "Print the compiler's version: {0}", - Allow_use_of_deprecated_0_keyword_when_referencing_an_external_module: "Allow use of deprecated '{0}' keyword when referencing an external module.", - Specify_locale_for_errors_and_messages_For_example_0_or_1: "Specify locale for errors and messages. For example '{0}' or '{1}'", - Syntax_0: "Syntax: {0}", - options: "options", - file1: "file", - Examples: "Examples:", - Options: "Options:", - Insert_command_line_options_and_files_from_a_file: "Insert command line options and files from a file.", - Version_0: "Version {0}", - Use_the_0_flag_to_see_options: "Use the '{0}' flag to see options.", - NL_Recompiling_0: "{NL}Recompiling ({0}):", - STRING: "STRING", - KIND: "KIND", - file2: "FILE", - VERSION: "VERSION", - LOCATION: "LOCATION", - DIRECTORY: "DIRECTORY", - NUMBER: "NUMBER", - Specify_the_codepage_to_use_when_opening_source_files: "Specify the codepage to use when opening source files.", - Additional_locations: "Additional locations:", - This_version_of_the_Javascript_runtime_does_not_support_the_0_function: "This version of the Javascript runtime does not support the '{0}' function.", - Unknown_rule: "Unknown rule.", - Invalid_line_number_0: "Invalid line number ({0})", - Warn_on_expressions_and_declarations_with_an_implied_any_type: "Warn on expressions and declarations with an implied 'any' type.", - Variable_0_implicitly_has_an_any_type: "Variable '{0}' implicitly has an 'any' type.", - Parameter_0_of_1_implicitly_has_an_any_type: "Parameter '{0}' of '{1}' implicitly has an 'any' type.", - Parameter_0_of_function_type_implicitly_has_an_any_type: "Parameter '{0}' of function type implicitly has an 'any' type.", - Member_0_of_object_type_implicitly_has_an_any_type: "Member '{0}' of object type implicitly has an 'any' type.", - new_expression_which_lacks_a_constructor_signature_implicitly_has_an_any_type: "'new' expression, which lacks a constructor signature, implicitly has an 'any' type.", - _0_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.", - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.", - Parameter_0_of_lambda_function_implicitly_has_an_any_type: "Parameter '{0}' of lambda function implicitly has an 'any' type.", - Constructor_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.", - Lambda_Function_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.", - Array_Literal_implicitly_has_an_any_type_from_widening: "Array Literal implicitly has an 'any' type from widening.", - _0_which_lacks_get_accessor_and_parameter_type_annotation_on_set_accessor_implicitly_has_an_any_type: "'{0}', which lacks 'get' accessor and parameter type annotation on 'set' accessor, implicitly has an 'any' type.", - Index_signature_of_object_type_implicitly_has_an_any_type: "Index signature of object type implicitly has an 'any' type.", - Object_literal_s_property_0_implicitly_has_an_any_type_from_widening: "Object literal's property '{0}' implicitly has an 'any' type from widening." - }; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (DiagnosticCategory) { - DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; - DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; - DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; - DiagnosticCategory[DiagnosticCategory["NoPrefix"] = 3] = "NoPrefix"; - })(TypeScript.DiagnosticCategory || (TypeScript.DiagnosticCategory = {})); - var DiagnosticCategory = TypeScript.DiagnosticCategory; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.diagnosticInformationMap = { - "error TS{0}: {1}": { "code": 0, "category": 3 /* NoPrefix */ }, - "warning TS{0}: {1}": { "code": 1, "category": 3 /* NoPrefix */ }, - "Unrecognized escape sequence.": { "code": 1000, "category": 1 /* Error */ }, - "Unexpected character {0}.": { "code": 1001, "category": 1 /* Error */ }, - "Missing close quote character.": { "code": 1002, "category": 1 /* Error */ }, - "Identifier expected.": { "code": 1003, "category": 1 /* Error */ }, - "'{0}' keyword expected.": { "code": 1004, "category": 1 /* Error */ }, - "'{0}' expected.": { "code": 1005, "category": 1 /* Error */ }, - "Identifier expected; '{0}' is a keyword.": { "code": 1006, "category": 1 /* Error */ }, - "Automatic semicolon insertion not allowed.": { "code": 1007, "category": 1 /* Error */ }, - "Unexpected token; '{0}' expected.": { "code": 1008, "category": 1 /* Error */ }, - "Trailing comma not allowed.": { "code": 1009, "category": 1 /* Error */ }, - "'*/' expected.": { "code": 1010, "category": 1 /* Error */ }, - "'public' or 'private' modifier must precede 'static'.": { "code": 1011, "category": 1 /* Error */ }, - "Unexpected token.": { "code": 1012, "category": 1 /* Error */ }, - "Catch clause parameter cannot have a type annotation.": { "code": 1013, "category": 1 /* Error */ }, - "A rest parameter must be last in a parameter list.": { "code": 1014, "category": 1 /* Error */ }, - "Parameter cannot have question mark and initializer.": { "code": 1015, "category": 1 /* Error */ }, - "A required parameter cannot follow an optional parameter.": { "code": 1016, "category": 1 /* Error */ }, - "Index signatures cannot have rest parameters.": { "code": 1017, "category": 1 /* Error */ }, - "Index signature parameter cannot have accessibility modifiers.": { "code": 1018, "category": 1 /* Error */ }, - "Index signature parameter cannot have a question mark.": { "code": 1019, "category": 1 /* Error */ }, - "Index signature parameter cannot have an initializer.": { "code": 1020, "category": 1 /* Error */ }, - "Index signature must have a type annotation.": { "code": 1021, "category": 1 /* Error */ }, - "Index signature parameter must have a type annotation.": { "code": 1022, "category": 1 /* Error */ }, - "Index signature parameter type must be 'string' or 'number'.": { "code": 1023, "category": 1 /* Error */ }, - "'extends' clause already seen.": { "code": 1024, "category": 1 /* Error */ }, - "'extends' clause must precede 'implements' clause.": { "code": 1025, "category": 1 /* Error */ }, - "Classes can only extend a single class.": { "code": 1026, "category": 1 /* Error */ }, - "'implements' clause already seen.": { "code": 1027, "category": 1 /* Error */ }, - "Accessibility modifier already seen.": { "code": 1028, "category": 1 /* Error */ }, - "'{0}' modifier must precede '{1}' modifier.": { "code": 1029, "category": 1 /* Error */ }, - "'{0}' modifier already seen.": { "code": 1030, "category": 1 /* Error */ }, - "'{0}' modifier cannot appear on a class element.": { "code": 1031, "category": 1 /* Error */ }, - "Interface declaration cannot have 'implements' clause.": { "code": 1032, "category": 1 /* Error */ }, - "'super' invocation cannot have type arguments.": { "code": 1034, "category": 1 /* Error */ }, - "Only ambient modules can use quoted names.": { "code": 1035, "category": 1 /* Error */ }, - "Statements are not allowed in ambient contexts.": { "code": 1036, "category": 1 /* Error */ }, - "A function implementation cannot be declared in an ambient context.": { "code": 1037, "category": 1 /* Error */ }, - "A 'declare' modifier cannot be used in an already ambient context.": { "code": 1038, "category": 1 /* Error */ }, - "Initializers are not allowed in ambient contexts.": { "code": 1039, "category": 1 /* Error */ }, - "'{0}' modifier cannot appear on a module element.": { "code": 1044, "category": 1 /* Error */ }, - "A 'declare' modifier cannot be used with an interface declaration.": { "code": 1045, "category": 1 /* Error */ }, - "A 'declare' modifier is required for a top level declaration in a .d.ts file.": { "code": 1046, "category": 1 /* Error */ }, - "A rest parameter cannot be optional.": { "code": 1047, "category": 1 /* Error */ }, - "A rest parameter cannot have an initializer.": { "code": 1048, "category": 1 /* Error */ }, - "'set' accessor must have exactly one parameter.": { "code": 1049, "category": 1 /* Error */ }, - "'set' accessor parameter cannot be optional.": { "code": 1051, "category": 1 /* Error */ }, - "'set' accessor parameter cannot have an initializer.": { "code": 1052, "category": 1 /* Error */ }, - "'set' accessor cannot have rest parameter.": { "code": 1053, "category": 1 /* Error */ }, - "'get' accessor cannot have parameters.": { "code": 1054, "category": 1 /* Error */ }, - "Modifiers cannot appear here.": { "code": 1055, "category": 1 /* Error */ }, - "Accessors are only available when targeting ECMAScript 5 and higher.": { "code": 1056, "category": 1 /* Error */ }, - "Enum member must have initializer.": { "code": 1061, "category": 1 /* Error */ }, - "Export assignment cannot be used in internal modules.": { "code": 1063, "category": 1 /* Error */ }, - "Ambient enum elements can only have integer literal initializers.": { "code": 1066, "category": 1 /* Error */ }, - "module, class, interface, enum, import or statement": { "code": 1067, "category": 3 /* NoPrefix */ }, - "constructor, function, accessor or variable": { "code": 1068, "category": 3 /* NoPrefix */ }, - "statement": { "code": 1069, "category": 3 /* NoPrefix */ }, - "case or default clause": { "code": 1070, "category": 3 /* NoPrefix */ }, - "identifier": { "code": 1071, "category": 3 /* NoPrefix */ }, - "call, construct, index, property or function signature": { "code": 1072, "category": 3 /* NoPrefix */ }, - "expression": { "code": 1073, "category": 3 /* NoPrefix */ }, - "type name": { "code": 1074, "category": 3 /* NoPrefix */ }, - "property or accessor": { "code": 1075, "category": 3 /* NoPrefix */ }, - "parameter": { "code": 1076, "category": 3 /* NoPrefix */ }, - "type": { "code": 1077, "category": 3 /* NoPrefix */ }, - "type parameter": { "code": 1078, "category": 3 /* NoPrefix */ }, - "A 'declare' modifier cannot be used with an import declaration.": { "code": 1079, "category": 1 /* Error */ }, - "Invalid 'reference' directive syntax.": { "code": 1084, "category": 1 /* Error */ }, - "Octal literals are not available when targeting ECMAScript 5 and higher.": { "code": 1085, "category": 1 /* Error */ }, - "Accessors are not allowed in ambient contexts.": { "code": 1086, "category": 1 /* Error */ }, - "'{0}' modifier cannot appear on a constructor declaration.": { "code": 1089, "category": 1 /* Error */ }, - "'{0}' modifier cannot appear on a parameter.": { "code": 1090, "category": 1 /* Error */ }, - "Only a single variable declaration is allowed in a 'for...in' statement.": { "code": 1091, "category": 1 /* Error */ }, - "Type parameters cannot appear on a constructor declaration.": { "code": 1092, "category": 1 /* Error */ }, - "Type annotation cannot appear on a constructor declaration.": { "code": 1093, "category": 1 /* Error */ }, - "Type parameters cannot appear on an accessor.": { "code": 1094, "category": 1 /* Error */ }, - "Type annotation cannot appear on a 'set' accessor.": { "code": 1095, "category": 1 /* Error */ }, - "Index signature must have exactly one parameter.": { "code": 1096, "category": 1 /* Error */ }, - "'{0}' list cannot be empty.": { "code": 1097, "category": 1 /* Error */ }, - "variable declaration": { "code": 1098, "category": 3 /* NoPrefix */ }, - "type argument": { "code": 1099, "category": 3 /* NoPrefix */ }, - "Invalid use of '{0}' in strict mode.": { "code": 1100, "category": 1 /* Error */ }, - "'with' statements are not allowed in strict mode.": { "code": 1101, "category": 1 /* Error */ }, - "'delete' cannot be called on an identifier in strict mode.": { "code": 1102, "category": 1 /* Error */ }, - "Invalid left-hand side in 'for...in' statement.": { "code": 1103, "category": 1 /* Error */ }, - "'continue' statement can only be used within an enclosing iteration statement.": { "code": 1104, "category": 1 /* Error */ }, - "'break' statement can only be used within an enclosing iteration or switch statement.": { "code": 1105, "category": 1 /* Error */ }, - "Jump target not found.": { "code": 1106, "category": 1 /* Error */ }, - "Jump target cannot cross function boundary.": { "code": 1107, "category": 1 /* Error */ }, - "'return' statement must be contained within a function body.": { "code": 1108, "category": 1 /* Error */ }, - "Expression expected.": { "code": 1109, "category": 1 /* Error */ }, - "Type expected.": { "code": 1110, "category": 1 /* Error */ }, - "Template literal cannot be used as an element name.": { "code": 1111, "category": 1 /* Error */ }, - "Duplicate identifier '{0}'.": { "code": 2000, "category": 1 /* Error */ }, - "The name '{0}' does not exist in the current scope.": { "code": 2001, "category": 1 /* Error */ }, - "The name '{0}' does not refer to a value.": { "code": 2002, "category": 1 /* Error */ }, - "'super' can only be used inside a class instance method.": { "code": 2003, "category": 1 /* Error */ }, - "The left-hand side of an assignment expression must be a variable, property or indexer.": { "code": 2004, "category": 1 /* Error */ }, - "Value of type '{0}' is not callable. Did you mean to include 'new'?": { "code": 2161, "category": 1 /* Error */ }, - "Value of type '{0}' is not callable.": { "code": 2006, "category": 1 /* Error */ }, - "Value of type '{0}' is not newable.": { "code": 2007, "category": 1 /* Error */ }, - "An index expression argument must be 'string', 'number', or 'any'.": { "code": 2008, "category": 1 /* Error */ }, - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": { "code": 2009, "category": 1 /* Error */ }, - "Type '{0}' is not assignable to type '{1}'.": { "code": 2011, "category": 1 /* Error */ }, - "Type '{0}' is not assignable to type '{1}':{NL}{2}": { "code": 2012, "category": 1 /* Error */ }, - "Expected var, class, interface, or module.": { "code": 2013, "category": 1 /* Error */ }, - "Getter '{0}' already declared.": { "code": 2015, "category": 1 /* Error */ }, - "Setter '{0}' already declared.": { "code": 2016, "category": 1 /* Error */ }, - "Exported class '{0}' extends private class '{1}'.": { "code": 2018, "category": 1 /* Error */ }, - "Exported class '{0}' implements private interface '{1}'.": { "code": 2019, "category": 1 /* Error */ }, - "Exported interface '{0}' extends private interface '{1}'.": { "code": 2020, "category": 1 /* Error */ }, - "Exported class '{0}' extends class from inaccessible module {1}.": { "code": 2021, "category": 1 /* Error */ }, - "Exported class '{0}' implements interface from inaccessible module {1}.": { "code": 2022, "category": 1 /* Error */ }, - "Exported interface '{0}' extends interface from inaccessible module {1}.": { "code": 2023, "category": 1 /* Error */ }, - "Public static property '{0}' of exported class has or is using private type '{1}'.": { "code": 2024, "category": 1 /* Error */ }, - "Public property '{0}' of exported class has or is using private type '{1}'.": { "code": 2025, "category": 1 /* Error */ }, - "Property '{0}' of exported interface has or is using private type '{1}'.": { "code": 2026, "category": 1 /* Error */ }, - "Exported variable '{0}' has or is using private type '{1}'.": { "code": 2027, "category": 1 /* Error */ }, - "Public static property '{0}' of exported class is using inaccessible module {1}.": { "code": 2028, "category": 1 /* Error */ }, - "Public property '{0}' of exported class is using inaccessible module {1}.": { "code": 2029, "category": 1 /* Error */ }, - "Property '{0}' of exported interface is using inaccessible module {1}.": { "code": 2030, "category": 1 /* Error */ }, - "Exported variable '{0}' is using inaccessible module {1}.": { "code": 2031, "category": 1 /* Error */ }, - "Parameter '{0}' of constructor from exported class has or is using private type '{1}'.": { "code": 2032, "category": 1 /* Error */ }, - "Parameter '{0}' of public static property setter from exported class has or is using private type '{1}'.": { "code": 2033, "category": 1 /* Error */ }, - "Parameter '{0}' of public property setter from exported class has or is using private type '{1}'.": { "code": 2034, "category": 1 /* Error */ }, - "Parameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": { "code": 2035, "category": 1 /* Error */ }, - "Parameter '{0}' of call signature from exported interface has or is using private type '{1}'.": { "code": 2036, "category": 1 /* Error */ }, - "Parameter '{0}' of public static method from exported class has or is using private type '{1}'.": { "code": 2037, "category": 1 /* Error */ }, - "Parameter '{0}' of public method from exported class has or is using private type '{1}'.": { "code": 2038, "category": 1 /* Error */ }, - "Parameter '{0}' of method from exported interface has or is using private type '{1}'.": { "code": 2039, "category": 1 /* Error */ }, - "Parameter '{0}' of exported function has or is using private type '{1}'.": { "code": 2040, "category": 1 /* Error */ }, - "Parameter '{0}' of constructor from exported class is using inaccessible module {1}.": { "code": 2041, "category": 1 /* Error */ }, - "Parameter '{0}' of public static property setter from exported class is using inaccessible module {1}.": { "code": 2042, "category": 1 /* Error */ }, - "Parameter '{0}' of public property setter from exported class is using inaccessible module {1}.": { "code": 2043, "category": 1 /* Error */ }, - "Parameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": { "code": 2044, "category": 1 /* Error */ }, - "Parameter '{0}' of call signature from exported interface is using inaccessible module {1}": { "code": 2045, "category": 1 /* Error */ }, - "Parameter '{0}' of public static method from exported class is using inaccessible module {1}.": { "code": 2046, "category": 1 /* Error */ }, - "Parameter '{0}' of public method from exported class is using inaccessible module {1}.": { "code": 2047, "category": 1 /* Error */ }, - "Parameter '{0}' of method from exported interface is using inaccessible module {1}.": { "code": 2048, "category": 1 /* Error */ }, - "Parameter '{0}' of exported function is using inaccessible module {1}.": { "code": 2049, "category": 1 /* Error */ }, - "Return type of public static property getter from exported class has or is using private type '{0}'.": { "code": 2050, "category": 1 /* Error */ }, - "Return type of public property getter from exported class has or is using private type '{0}'.": { "code": 2051, "category": 1 /* Error */ }, - "Return type of constructor signature from exported interface has or is using private type '{0}'.": { "code": 2052, "category": 1 /* Error */ }, - "Return type of call signature from exported interface has or is using private type '{0}'.": { "code": 2053, "category": 1 /* Error */ }, - "Return type of index signature from exported interface has or is using private type '{0}'.": { "code": 2054, "category": 1 /* Error */ }, - "Return type of public static method from exported class has or is using private type '{0}'.": { "code": 2055, "category": 1 /* Error */ }, - "Return type of public method from exported class has or is using private type '{0}'.": { "code": 2056, "category": 1 /* Error */ }, - "Return type of method from exported interface has or is using private type '{0}'.": { "code": 2057, "category": 1 /* Error */ }, - "Return type of exported function has or is using private type '{0}'.": { "code": 2058, "category": 1 /* Error */ }, - "Return type of public static property getter from exported class is using inaccessible module {0}.": { "code": 2059, "category": 1 /* Error */ }, - "Return type of public property getter from exported class is using inaccessible module {0}.": { "code": 2060, "category": 1 /* Error */ }, - "Return type of constructor signature from exported interface is using inaccessible module {0}.": { "code": 2061, "category": 1 /* Error */ }, - "Return type of call signature from exported interface is using inaccessible module {0}.": { "code": 2062, "category": 1 /* Error */ }, - "Return type of index signature from exported interface is using inaccessible module {0}.": { "code": 2063, "category": 1 /* Error */ }, - "Return type of public static method from exported class is using inaccessible module {0}.": { "code": 2064, "category": 1 /* Error */ }, - "Return type of public method from exported class is using inaccessible module {0}.": { "code": 2065, "category": 1 /* Error */ }, - "Return type of method from exported interface is using inaccessible module {0}.": { "code": 2066, "category": 1 /* Error */ }, - "Return type of exported function is using inaccessible module {0}.": { "code": 2067, "category": 1 /* Error */ }, - "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": { "code": 2068, "category": 1 /* Error */ }, - "A parameter list must follow a generic type argument list. '(' expected.": { "code": 2069, "category": 1 /* Error */ }, - "Multiple constructor implementations are not allowed.": { "code": 2070, "category": 1 /* Error */ }, - "Cannot find external module '{0}'.": { "code": 2071, "category": 1 /* Error */ }, - "Module cannot be aliased to a non-module type.": { "code": 2072, "category": 1 /* Error */ }, - "A class may only extend another class.": { "code": 2073, "category": 1 /* Error */ }, - "A class may only implement another class or interface.": { "code": 2074, "category": 1 /* Error */ }, - "An interface may only extend a class or another interface.": { "code": 2075, "category": 1 /* Error */ }, - "Unable to resolve type.": { "code": 2077, "category": 1 /* Error */ }, - "Unable to resolve type of '{0}'.": { "code": 2078, "category": 1 /* Error */ }, - "Unable to resolve type parameter constraint.": { "code": 2079, "category": 1 /* Error */ }, - "Type parameter constraint cannot be a primitive type.": { "code": 2080, "category": 1 /* Error */ }, - "Supplied parameters do not match any signature of call target.": { "code": 2081, "category": 1 /* Error */ }, - "Supplied parameters do not match any signature of call target:{NL}{0}": { "code": 2082, "category": 1 /* Error */ }, - "Cannot use 'new' with an expression whose type lacks a signature.": { "code": 2083, "category": 1 /* Error */ }, - "Only a void function can be called with the 'new' keyword.": { "code": 2084, "category": 1 /* Error */ }, - "Could not select overload for 'new' expression.": { "code": 2085, "category": 1 /* Error */ }, - "Type '{0}' does not satisfy the constraint '{1}'.": { "code": 2086, "category": 1 /* Error */ }, - "Could not select overload for 'call' expression.": { "code": 2087, "category": 1 /* Error */ }, - "Cannot invoke an expression whose type lacks a call signature.": { "code": 2088, "category": 1 /* Error */ }, - "Calls to 'super' are only valid inside a class.": { "code": 2089, "category": 1 /* Error */ }, - "Generic type '{0}' requires {1} type argument(s).": { "code": 2090, "category": 1 /* Error */ }, - "Type of array literal cannot be determined. Best common type could not be found for array elements.": { "code": 2092, "category": 1 /* Error */ }, - "Could not find enclosing symbol for dotted name '{0}'.": { "code": 2093, "category": 1 /* Error */ }, - "Property '{0}' does not exist on value of type '{1}'.": { "code": 2094, "category": 1 /* Error */ }, - "Cannot find name '{0}'.": { "code": 2095, "category": 1 /* Error */ }, - "'get' and 'set' accessor must have the same type.": { "code": 2096, "category": 1 /* Error */ }, - "'this' cannot be referenced in current location.": { "code": 2097, "category": 1 /* Error */ }, - "Static members cannot reference class type parameters.": { "code": 2099, "category": 1 /* Error */ }, - "Type '{0}' recursively references itself as a base type.": { "code": 2100, "category": 1 /* Error */ }, - "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.": { "code": 2102, "category": 1 /* Error */ }, - "'super' can only be referenced in a derived class.": { "code": 2103, "category": 1 /* Error */ }, - "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.": { "code": 2104, "category": 1 /* Error */ }, - "Constructors for derived classes must contain a 'super' call.": { "code": 2105, "category": 1 /* Error */ }, - "Super calls are not permitted outside constructors or in nested functions inside constructors.": { "code": 2106, "category": 1 /* Error */ }, - "'{0}.{1}' is inaccessible.": { "code": 2107, "category": 1 /* Error */ }, - "'this' cannot be referenced in a module body.": { "code": 2108, "category": 1 /* Error */ }, - "Invalid '+' expression - types not known to support the addition operator.": { "code": 2111, "category": 1 /* Error */ }, - "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": { "code": 2112, "category": 1 /* Error */ }, - "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.": { "code": 2113, "category": 1 /* Error */ }, - "An arithmetic operand must be of type 'any', 'number' or an enum type.": { "code": 2114, "category": 1 /* Error */ }, - "Variable declarations of a 'for' statement cannot use a type annotation.": { "code": 2115, "category": 1 /* Error */ }, - "Variable declarations of a 'for' statement must be of types 'string' or 'any'.": { "code": 2116, "category": 1 /* Error */ }, - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter.": { "code": 2117, "category": 1 /* Error */ }, - "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.": { "code": 2118, "category": 1 /* Error */ }, - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": { "code": 2119, "category": 1 /* Error */ }, - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": { "code": 2120, "category": 1 /* Error */ }, - "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.": { "code": 2121, "category": 1 /* Error */ }, - "Setters cannot return a value.": { "code": 2122, "category": 1 /* Error */ }, - "Tried to query type of uninitialized module '{0}'.": { "code": 2123, "category": 1 /* Error */ }, - "Tried to set variable type to uninitialized module type '{0}'.": { "code": 2124, "category": 1 /* Error */ }, - "Type '{0}' is not generic.": { "code": 2125, "category": 1 /* Error */ }, - "Getters must return a value.": { "code": 2126, "category": 1 /* Error */ }, - "Getter and setter accessors do not agree in visibility.": { "code": 2127, "category": 1 /* Error */ }, - "Invalid left-hand side of assignment expression.": { "code": 2130, "category": 1 /* Error */ }, - "Function declared a non-void return type, but has no return expression.": { "code": 2131, "category": 1 /* Error */ }, - "Cannot resolve return type reference.": { "code": 2132, "category": 1 /* Error */ }, - "Constructors cannot have a return type of 'void'.": { "code": 2133, "category": 1 /* Error */ }, - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": { "code": 2134, "category": 1 /* Error */ }, - "All symbols within a with block will be resolved to 'any'.": { "code": 2135, "category": 1 /* Error */ }, - "Import declarations in an internal module cannot reference an external module.": { "code": 2136, "category": 1 /* Error */ }, - "Class {0} declares interface {1} but does not implement it:{NL}{2}": { "code": 2137, "category": 1 /* Error */ }, - "Class {0} declares class {1} as an interface but does not implement it:{NL}{2}": { "code": 2138, "category": 1 /* Error */ }, - "The operand of an increment or decrement operator must be a variable, property or indexer.": { "code": 2139, "category": 1 /* Error */ }, - "'this' cannot be referenced in a static property initializer.": { "code": 2140, "category": 1 /* Error */ }, - "Class '{0}' cannot extend class '{1}':{NL}{2}": { "code": 2141, "category": 1 /* Error */ }, - "Interface '{0}' cannot extend class '{1}':{NL}{2}": { "code": 2142, "category": 1 /* Error */ }, - "Interface '{0}' cannot extend interface '{1}':{NL}{2}": { "code": 2143, "category": 1 /* Error */ }, - "Overload signature is not compatible with function definition.": { "code": 2148, "category": 1 /* Error */ }, - "Overload signature is not compatible with function definition:{NL}{0}": { "code": 2149, "category": 1 /* Error */ }, - "Overload signatures must all be public or private.": { "code": 2150, "category": 1 /* Error */ }, - "Overload signatures must all be exported or not exported.": { "code": 2151, "category": 1 /* Error */ }, - "Overload signatures must all be ambient or non-ambient.": { "code": 2152, "category": 1 /* Error */ }, - "Overload signatures must all be optional or required.": { "code": 2153, "category": 1 /* Error */ }, - "Specialized overload signature is not assignable to any non-specialized signature.": { "code": 2154, "category": 1 /* Error */ }, - "'this' cannot be referenced in constructor arguments.": { "code": 2155, "category": 1 /* Error */ }, - "Instance member cannot be accessed off a class.": { "code": 2157, "category": 1 /* Error */ }, - "Untyped function calls may not accept type arguments.": { "code": 2158, "category": 1 /* Error */ }, - "Non-generic functions may not accept type arguments.": { "code": 2159, "category": 1 /* Error */ }, - "A generic type may not reference itself with a wrapped form of its own type parameters.": { "code": 2160, "category": 1 /* Error */ }, - "A rest parameter must be of an array type.": { "code": 2162, "category": 1 /* Error */ }, - "Overload signature implementation cannot use specialized type.": { "code": 2163, "category": 1 /* Error */ }, - "Export assignments may only be used at the top-level of external modules.": { "code": 2164, "category": 1 /* Error */ }, - "Export assignments may only be made with variables, functions, classes, interfaces, enums and internal modules.": { "code": 2165, "category": 1 /* Error */ }, - "Only public methods of the base class are accessible via the 'super' keyword.": { "code": 2166, "category": 1 /* Error */ }, - "Numeric indexer type '{0}' must be assignable to string indexer type '{1}'.": { "code": 2167, "category": 1 /* Error */ }, - "Numeric indexer type '{0}' must be assignable to string indexer type '{1}':{NL}{2}": { "code": 2168, "category": 1 /* Error */ }, - "All numerically named properties must be assignable to numeric indexer type '{0}'.": { "code": 2169, "category": 1 /* Error */ }, - "All numerically named properties must be assignable to numeric indexer type '{0}':{NL}{1}": { "code": 2170, "category": 1 /* Error */ }, - "All named properties must be assignable to string indexer type '{0}'.": { "code": 2171, "category": 1 /* Error */ }, - "All named properties must be assignable to string indexer type '{0}':{NL}{1}": { "code": 2172, "category": 1 /* Error */ }, - "A parameter initializer is only allowed in a function or constructor implementation.": { "code": 2174, "category": 1 /* Error */ }, - "Function expression declared a non-void return type, but has no return expression.": { "code": 2176, "category": 1 /* Error */ }, - "Import declaration referencing identifier from internal module can only be made with variables, functions, classes, interfaces, enums and internal modules.": { "code": 2177, "category": 1 /* Error */ }, - "Module '{0}' has no exported member '{1}'.": { "code": 2178, "category": 1 /* Error */ }, - "Unable to resolve module reference '{0}'.": { "code": 2179, "category": 1 /* Error */ }, - "Could not find module '{0}' in module '{1}'.": { "code": 2180, "category": 1 /* Error */ }, - "Exported import declaration '{0}' is assigned value with type that has or is using private type '{1}'.": { "code": 2181, "category": 1 /* Error */ }, - "Exported import declaration '{0}' is assigned value with type that is using inaccessible module '{1}'.": { "code": 2182, "category": 1 /* Error */ }, - "Exported import declaration '{0}' is assigned type that has or is using private type '{1}'.": { "code": 2183, "category": 1 /* Error */ }, - "Exported import declaration '{0}' is assigned type that is using inaccessible module '{1}'.": { "code": 2184, "category": 1 /* Error */ }, - "Exported import declaration '{0}' is assigned container that is or is using inaccessible module '{1}'.": { "code": 2185, "category": 1 /* Error */ }, - "Type name '{0}' in extends clause does not reference constructor function for '{1}'.": { "code": 2186, "category": 1 /* Error */ }, - "Internal module reference '{0}' in import declaration does not reference module instance for '{1}'.": { "code": 2187, "category": 1 /* Error */ }, - "Module '{0}' cannot merge with previous declaration of '{1}' in a different file '{2}'.": { "code": 2188, "category": 1 /* Error */ }, - "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':{NL}{3}": { "code": 2189, "category": 1 /* Error */ }, - "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.": { "code": 2190, "category": 1 /* Error */ }, - "Ambient external module declaration cannot be reopened.": { "code": 2191, "category": 1 /* Error */ }, - "All declarations of merged declaration '{0}' must be exported or not exported.": { "code": 2192, "category": 1 /* Error */ }, - "'super' cannot be referenced in constructor arguments.": { "code": 2193, "category": 1 /* Error */ }, - "Return type of constructor signature must be assignable to the instance type of the class.": { "code": 2194, "category": 1 /* Error */ }, - "Ambient external module declaration must be defined in global context.": { "code": 2195, "category": 1 /* Error */ }, - "Ambient external module declaration cannot specify relative module name.": { "code": 2196, "category": 1 /* Error */ }, - "Import declaration in an ambient external module declaration cannot reference external module through relative external module name.": { "code": 2197, "category": 1 /* Error */ }, - "No best common type exists among return expressions.": { "code": 2198, "category": 1 /* Error */ }, - "Import declaration cannot refer to external module reference when --noResolve option is set.": { "code": 2199, "category": 1 /* Error */ }, - "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.": { "code": 2200, "category": 1 /* Error */ }, - "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.": { "code": 2205, "category": 1 /* Error */ }, - "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.": { "code": 2206, "category": 1 /* Error */ }, - "Expression resolves to '_super' that compiler uses to capture base class reference.": { "code": 2207, "category": 1 /* Error */ }, - "TypeParameter '{0}' of constructor signature from exported interface has or is using private type '{1}'.": { "code": 2208, "category": 1 /* Error */ }, - "TypeParameter '{0}' of call signature from exported interface has or is using private type '{1}'.": { "code": 2209, "category": 1 /* Error */ }, - "TypeParameter '{0}' of public static method from exported class has or is using private type '{1}'.": { "code": 2210, "category": 1 /* Error */ }, - "TypeParameter '{0}' of public method from exported class has or is using private type '{1}'.": { "code": 2211, "category": 1 /* Error */ }, - "TypeParameter '{0}' of method from exported interface has or is using private type '{1}'.": { "code": 2212, "category": 1 /* Error */ }, - "TypeParameter '{0}' of exported function has or is using private type '{1}'.": { "code": 2213, "category": 1 /* Error */ }, - "TypeParameter '{0}' of constructor signature from exported interface is using inaccessible module {1}.": { "code": 2214, "category": 1 /* Error */ }, - "TypeParameter '{0}' of call signature from exported interface is using inaccessible module {1}": { "code": 2215, "category": 1 /* Error */ }, - "TypeParameter '{0}' of public static method from exported class is using inaccessible module {1}.": { "code": 2216, "category": 1 /* Error */ }, - "TypeParameter '{0}' of public method from exported class is using inaccessible module {1}.": { "code": 2217, "category": 1 /* Error */ }, - "TypeParameter '{0}' of method from exported interface is using inaccessible module {1}.": { "code": 2218, "category": 1 /* Error */ }, - "TypeParameter '{0}' of exported function is using inaccessible module {1}.": { "code": 2219, "category": 1 /* Error */ }, - "TypeParameter '{0}' of exported class has or is using private type '{1}'.": { "code": 2220, "category": 1 /* Error */ }, - "TypeParameter '{0}' of exported interface has or is using private type '{1}'.": { "code": 2221, "category": 1 /* Error */ }, - "TypeParameter '{0}' of exported class is using inaccessible module {1}.": { "code": 2222, "category": 1 /* Error */ }, - "TypeParameter '{0}' of exported interface is using inaccessible module {1}.": { "code": 2223, "category": 1 /* Error */ }, - "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter.": { "code": 2224, "category": 1 /* Error */ }, - "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.": { "code": 2225, "category": 1 /* Error */ }, - "No best common type exists between '{0}' and '{1}'.": { "code": 2226, "category": 1 /* Error */ }, - "No best common type exists between '{0}', '{1}', and '{2}'.": { "code": 2227, "category": 1 /* Error */ }, - "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module.": { "code": 2228, "category": 1 /* Error */ }, - "Constraint of a type parameter cannot reference any type parameter from the same type parameter list.": { "code": 2229, "category": 1 /* Error */ }, - "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.": { "code": 2230, "category": 1 /* Error */ }, - "Parameter '{0}' cannot be referenced in its initializer.": { "code": 2231, "category": 1 /* Error */ }, - "Duplicate string index signature.": { "code": 2232, "category": 1 /* Error */ }, - "Duplicate number index signature.": { "code": 2233, "category": 1 /* Error */ }, - "All declarations of an interface must have identical type parameters.": { "code": 2234, "category": 1 /* Error */ }, - "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter.": { "code": 2235, "category": 1 /* Error */ }, - "Neither type '{0}' nor type '{1}' is assignable to the other.": { "code": 2236, "category": 1 /* Error */ }, - "Neither type '{0}' nor type '{1}' is assignable to the other:{NL}{2}": { "code": 2237, "category": 1 /* Error */ }, - "Duplicate function implementation.": { "code": 2237, "category": 1 /* Error */ }, - "Function implementation expected.": { "code": 2238, "category": 1 /* Error */ }, - "Function overload name must be '{0}'.": { "code": 2239, "category": 1 /* Error */ }, - "Constructor implementation expected.": { "code": 2240, "category": 1 /* Error */ }, - "Class name cannot be '{0}'.": { "code": 2241, "category": 1 /* Error */ }, - "Interface name cannot be '{0}'.": { "code": 2242, "category": 1 /* Error */ }, - "Enum name cannot be '{0}'.": { "code": 2243, "category": 1 /* Error */ }, - "A module cannot have multiple export assignments.": { "code": 2244, "category": 1 /* Error */ }, - "Export assignment not allowed in module with exported element.": { "code": 2245, "category": 1 /* Error */ }, - "A parameter property is only allowed in a constructor implementation.": { "code": 2246, "category": 1 /* Error */ }, - "Function overload must be static.": { "code": 2247, "category": 1 /* Error */ }, - "Function overload must not be static.": { "code": 2248, "category": 1 /* Error */ }, - "Type '{0}' is missing property '{1}' from type '{2}'.": { "code": 4000, "category": 3 /* NoPrefix */ }, - "Types of property '{0}' of types '{1}' and '{2}' are incompatible.": { "code": 4001, "category": 3 /* NoPrefix */ }, - "Types of property '{0}' of types '{1}' and '{2}' are incompatible:{NL}{3}": { "code": 4002, "category": 3 /* NoPrefix */ }, - "Property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": { "code": 4003, "category": 3 /* NoPrefix */ }, - "Property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": { "code": 4004, "category": 3 /* NoPrefix */ }, - "Types '{0}' and '{1}' define property '{2}' as private.": { "code": 4005, "category": 3 /* NoPrefix */ }, - "Call signatures of types '{0}' and '{1}' are incompatible.": { "code": 4006, "category": 3 /* NoPrefix */ }, - "Call signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": { "code": 4007, "category": 3 /* NoPrefix */ }, - "Type '{0}' requires a call signature, but type '{1}' lacks one.": { "code": 4008, "category": 3 /* NoPrefix */ }, - "Construct signatures of types '{0}' and '{1}' are incompatible.": { "code": 4009, "category": 3 /* NoPrefix */ }, - "Construct signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": { "code": 4010, "category": 3 /* NoPrefix */ }, - "Type '{0}' requires a construct signature, but type '{1}' lacks one.": { "code": 4011, "category": 3 /* NoPrefix */ }, - "Index signatures of types '{0}' and '{1}' are incompatible.": { "code": 4012, "category": 3 /* NoPrefix */ }, - "Index signatures of types '{0}' and '{1}' are incompatible:{NL}{2}": { "code": 4013, "category": 3 /* NoPrefix */ }, - "Call signature expects {0} or fewer parameters.": { "code": 4014, "category": 3 /* NoPrefix */ }, - "Could not apply type '{0}' to argument {1} which is of type '{2}'.": { "code": 4015, "category": 3 /* NoPrefix */ }, - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": { "code": 4016, "category": 3 /* NoPrefix */ }, - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": { "code": 4017, "category": 3 /* NoPrefix */ }, - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": { "code": 4018, "category": 3 /* NoPrefix */ }, - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": { "code": 4019, "category": 3 /* NoPrefix */ }, - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible.": { "code": 4020, "category": 3 /* NoPrefix */ }, - "Types of static property '{0}' of class '{1}' and class '{2}' are incompatible:{NL}{3}": { "code": 4021, "category": 3 /* NoPrefix */ }, - "Type reference cannot refer to container '{0}'.": { "code": 4022, "category": 1 /* Error */ }, - "Type reference must refer to type.": { "code": 4023, "category": 1 /* Error */ }, - "In enums with multiple declarations only one declaration can omit an initializer for the first enum element.": { "code": 4024, "category": 1 /* Error */ }, - " (+ {0} overload(s))": { "code": 4025, "category": 2 /* Message */ }, - "Variable declaration cannot have the same name as an import declaration.": { "code": 4026, "category": 1 /* Error */ }, - "Signature expected {0} type arguments, got {1} instead.": { "code": 4027, "category": 1 /* Error */ }, - "Property '{0}' defined as optional in type '{1}', but is required in type '{2}'.": { "code": 4028, "category": 3 /* NoPrefix */ }, - "Types '{0}' and '{1}' originating in infinitely expanding type reference do not refer to same named type.": { "code": 4029, "category": 3 /* NoPrefix */ }, - "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments.": { "code": 4030, "category": 3 /* NoPrefix */ }, - "Types '{0}' and '{1}' originating in infinitely expanding type reference have incompatible type arguments:{NL}{2}": { "code": 4031, "category": 3 /* NoPrefix */ }, - "Named properties '{0}' of types '{1}' and '{2}' are not identical.": { "code": 4032, "category": 3 /* NoPrefix */ }, - "Types of string indexer of types '{0}' and '{1}' are not identical.": { "code": 4033, "category": 3 /* NoPrefix */ }, - "Types of number indexer of types '{0}' and '{1}' are not identical.": { "code": 4034, "category": 3 /* NoPrefix */ }, - "Type of number indexer in type '{0}' is not assignable to string indexer type in type '{1}'.{NL}{2}": { "code": 4035, "category": 3 /* NoPrefix */ }, - "Type of property '{0}' in type '{1}' is not assignable to string indexer type in type '{2}'.{NL}{3}": { "code": 4036, "category": 3 /* NoPrefix */ }, - "Type of property '{0}' in type '{1}' is not assignable to number indexer type in type '{2}'.{NL}{3}": { "code": 4037, "category": 3 /* NoPrefix */ }, - "Static property '{0}' defined as private in type '{1}' is defined as public in type '{2}'.": { "code": 4038, "category": 3 /* NoPrefix */ }, - "Static property '{0}' defined as public in type '{1}' is defined as private in type '{2}'.": { "code": 4039, "category": 3 /* NoPrefix */ }, - "Types '{0}' and '{1}' define static property '{2}' as private.": { "code": 4040, "category": 3 /* NoPrefix */ }, - "Current host does not support '{0}' option.": { "code": 5001, "category": 1 /* Error */ }, - "ECMAScript target version '{0}' not supported. Specify a valid target version: '{1}' (default), or '{2}'": { "code": 5002, "category": 1 /* Error */ }, - "Argument for '{0}' option must be '{1}' or '{2}'": { "code": 5003, "category": 1 /* Error */ }, - "Could not find file: '{0}'.": { "code": 5004, "category": 1 /* Error */ }, - "A file cannot have a reference to itself.": { "code": 5006, "category": 1 /* Error */ }, - "Cannot resolve referenced file: '{0}'.": { "code": 5007, "category": 1 /* Error */ }, - "Cannot find the common subdirectory path for the input files.": { "code": 5009, "category": 1 /* Error */ }, - "Emit Error: {0}.": { "code": 5011, "category": 1 /* Error */ }, - "Cannot read file '{0}': {1}": { "code": 5012, "category": 1 /* Error */ }, - "Unsupported file encoding.": { "code": 5013, "category": 3 /* NoPrefix */ }, - "Locale must be of the form or -. For example '{0}' or '{1}'.": { "code": 5014, "category": 1 /* Error */ }, - "Unsupported locale: '{0}'.": { "code": 5015, "category": 1 /* Error */ }, - "Execution Failed.{NL}": { "code": 5016, "category": 1 /* Error */ }, - "Invalid call to 'up'": { "code": 5019, "category": 1 /* Error */ }, - "Invalid call to 'down'": { "code": 5020, "category": 1 /* Error */ }, - "Base64 value '{0}' finished with a continuation bit.": { "code": 5021, "category": 1 /* Error */ }, - "Unknown compiler option '{0}'": { "code": 5023, "category": 1 /* Error */ }, - "Expected {0} arguments to message, got {1} instead.": { "code": 5024, "category": 1 /* Error */ }, - "Expected the message '{0}' to have {1} arguments, but it had {2}": { "code": 5025, "category": 1 /* Error */ }, - "Could not delete file '{0}'": { "code": 5034, "category": 1 /* Error */ }, - "Could not create directory '{0}'": { "code": 5035, "category": 1 /* Error */ }, - "Error while executing file '{0}': ": { "code": 5036, "category": 1 /* Error */ }, - "Cannot compile external modules unless the '--module' flag is provided.": { "code": 5037, "category": 1 /* Error */ }, - "Option mapRoot cannot be specified without specifying sourcemap option.": { "code": 5038, "category": 1 /* Error */ }, - "Option sourceRoot cannot be specified without specifying sourcemap option.": { "code": 5039, "category": 1 /* Error */ }, - "Options mapRoot and sourceRoot cannot be specified without specifying sourcemap option.": { "code": 5040, "category": 1 /* Error */ }, - "Option '{0}' specified without '{1}'": { "code": 5041, "category": 1 /* Error */ }, - "'codepage' option not supported on current platform.": { "code": 5042, "category": 1 /* Error */ }, - "Concatenate and emit output to single file.": { "code": 6001, "category": 2 /* Message */ }, - "Generates corresponding {0} file.": { "code": 6002, "category": 2 /* Message */ }, - "Specifies the location where debugger should locate map files instead of generated locations.": { "code": 6003, "category": 2 /* Message */ }, - "Specifies the location where debugger should locate TypeScript files instead of source locations.": { "code": 6004, "category": 2 /* Message */ }, - "Watch input files.": { "code": 6005, "category": 2 /* Message */ }, - "Redirect output structure to the directory.": { "code": 6006, "category": 2 /* Message */ }, - "Do not emit comments to output.": { "code": 6009, "category": 2 /* Message */ }, - "Skip resolution and preprocessing.": { "code": 6010, "category": 2 /* Message */ }, - "Specify ECMAScript target version: '{0}' (default), or '{1}'": { "code": 6015, "category": 2 /* Message */ }, - "Specify module code generation: '{0}' or '{1}'": { "code": 6016, "category": 2 /* Message */ }, - "Print this message.": { "code": 6017, "category": 2 /* Message */ }, - "Print the compiler's version: {0}": { "code": 6019, "category": 2 /* Message */ }, - "Allow use of deprecated '{0}' keyword when referencing an external module.": { "code": 6021, "category": 2 /* Message */ }, - "Specify locale for errors and messages. For example '{0}' or '{1}'": { "code": 6022, "category": 2 /* Message */ }, - "Syntax: {0}": { "code": 6023, "category": 2 /* Message */ }, - "options": { "code": 6024, "category": 2 /* Message */ }, - "file1": { "code": 6025, "category": 2 /* Message */ }, - "Examples:": { "code": 6026, "category": 2 /* Message */ }, - "Options:": { "code": 6027, "category": 2 /* Message */ }, - "Insert command line options and files from a file.": { "code": 6030, "category": 2 /* Message */ }, - "Version {0}": { "code": 6029, "category": 2 /* Message */ }, - "Use the '{0}' flag to see options.": { "code": 6031, "category": 2 /* Message */ }, - "{NL}Recompiling ({0}):": { "code": 6032, "category": 2 /* Message */ }, - "STRING": { "code": 6033, "category": 2 /* Message */ }, - "KIND": { "code": 6034, "category": 2 /* Message */ }, - "file2": { "code": 6035, "category": 2 /* Message */ }, - "VERSION": { "code": 6036, "category": 2 /* Message */ }, - "LOCATION": { "code": 6037, "category": 2 /* Message */ }, - "DIRECTORY": { "code": 6038, "category": 2 /* Message */ }, - "NUMBER": { "code": 6039, "category": 2 /* Message */ }, - "Specify the codepage to use when opening source files.": { "code": 6040, "category": 2 /* Message */ }, - "Additional locations:": { "code": 6041, "category": 2 /* Message */ }, - "This version of the Javascript runtime does not support the '{0}' function.": { "code": 7000, "category": 1 /* Error */ }, - "Unknown rule.": { "code": 7002, "category": 1 /* Error */ }, - "Invalid line number ({0})": { "code": 7003, "category": 1 /* Error */ }, - "Warn on expressions and declarations with an implied 'any' type.": { "code": 7004, "category": 2 /* Message */ }, - "Variable '{0}' implicitly has an 'any' type.": { "code": 7005, "category": 1 /* Error */ }, - "Parameter '{0}' of '{1}' implicitly has an 'any' type.": { "code": 7006, "category": 1 /* Error */ }, - "Parameter '{0}' of function type implicitly has an 'any' type.": { "code": 7007, "category": 1 /* Error */ }, - "Member '{0}' of object type implicitly has an 'any' type.": { "code": 7008, "category": 1 /* Error */ }, - "'new' expression, which lacks a constructor signature, implicitly has an 'any' type.": { "code": 7009, "category": 1 /* Error */ }, - "'{0}', which lacks return-type annotation, implicitly has an 'any' return type.": { "code": 7010, "category": 1 /* Error */ }, - "Function expression, which lacks return-type annotation, implicitly has an 'any' return type.": { "code": 7011, "category": 1 /* Error */ }, - "Parameter '{0}' of lambda function implicitly has an 'any' type.": { "code": 7012, "category": 1 /* Error */ }, - "Constructor signature, which lacks return-type annotation, implicitly has an 'any' return type.": { "code": 7013, "category": 1 /* Error */ }, - "Lambda Function, which lacks return-type annotation, implicitly has an 'any' return type.": { "code": 7014, "category": 1 /* Error */ }, - "Array Literal implicitly has an 'any' type from widening.": { "code": 7015, "category": 1 /* Error */ }, - "'{0}', which lacks 'get' accessor and parameter type annotation on 'set' accessor, implicitly has an 'any' type.": { "code": 7016, "category": 1 /* Error */ }, - "Index signature of object type implicitly has an 'any' type.": { "code": 7017, "category": 1 /* Error */ }, - "Object literal's property '{0}' implicitly has an 'any' type from widening.": { "code": 7018, "category": 1 /* Error */ } - }; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ArrayUtilities = (function () { - function ArrayUtilities() { - } - ArrayUtilities.sequenceEquals = function (array1, array2, equals) { - if (array1 === array2) { - return true; - } - if (!array1 || !array2) { - return false; - } - if (array1.length !== array2.length) { - return false; - } - for (var i = 0, n = array1.length; i < n; i++) { - if (!equals(array1[i], array2[i])) { - return false; - } - } - return true; - }; - ArrayUtilities.contains = function (array, value) { - for (var i = 0; i < array.length; i++) { - if (array[i] === value) { - return true; - } - } - return false; - }; - ArrayUtilities.distinct = function (array, equalsFn) { - var result = []; - for (var i = 0, n = array.length; i < n; i++) { - var current = array[i]; - for (var j = 0; j < result.length; j++) { - if (equalsFn(result[j], current)) { - break; - } - } - if (j === result.length) { - result.push(current); - } - } - return result; - }; - ArrayUtilities.last = function (array) { - if (array.length === 0) { - throw TypeScript.Errors.argumentOutOfRange('array'); - } - return array[array.length - 1]; - }; - ArrayUtilities.lastOrDefault = function (array, predicate) { - for (var i = array.length - 1; i >= 0; i--) { - var v = array[i]; - if (predicate(v, i)) { - return v; - } - } - return undefined; - }; - ArrayUtilities.firstOrDefault = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - var value = array[i]; - if (func(value, i)) { - return value; - } - } - return undefined; - }; - ArrayUtilities.first = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - var value = array[i]; - if (!func || func(value, i)) { - return value; - } - } - throw TypeScript.Errors.invalidOperation(); - }; - ArrayUtilities.sum = function (array, func) { - var result = 0; - for (var i = 0, n = array.length; i < n; i++) { - result += func(array[i]); - } - return result; - }; - ArrayUtilities.select = function (values, func) { - var result = new Array(values.length); - for (var i = 0; i < values.length; i++) { - result[i] = func(values[i]); - } - return result; - }; - ArrayUtilities.where = function (values, func) { - var result = new Array(); - for (var i = 0; i < values.length; i++) { - if (func(values[i])) { - result.push(values[i]); - } - } - return result; - }; - ArrayUtilities.any = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - if (func(array[i])) { - return true; - } - } - return false; - }; - ArrayUtilities.all = function (array, func) { - for (var i = 0, n = array.length; i < n; i++) { - if (!func(array[i])) { - return false; - } - } - return true; - }; - ArrayUtilities.binarySearch = function (array, value) { - var low = 0; - var high = array.length - 1; - while (low <= high) { - var middle = low + ((high - low) >> 1); - var midValue = array[middle]; - if (midValue === value) { - return middle; - } - else if (midValue > value) { - high = middle - 1; - } - else { - low = middle + 1; - } - } - return ~low; - }; - ArrayUtilities.createArray = function (length, defaultValue) { - var result = new Array(length); - for (var i = 0; i < length; i++) { - result[i] = defaultValue; - } - return result; - }; - ArrayUtilities.grow = function (array, length, defaultValue) { - var count = length - array.length; - for (var i = 0; i < count; i++) { - array.push(defaultValue); - } - }; - ArrayUtilities.copy = function (sourceArray, sourceIndex, destinationArray, destinationIndex, length) { - for (var i = 0; i < length; i++) { - destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i]; - } - }; - ArrayUtilities.indexOf = function (array, predicate) { - for (var i = 0, n = array.length; i < n; i++) { - if (predicate(array[i])) { - return i; - } - } - return -1; - }; - return ArrayUtilities; - })(); - TypeScript.ArrayUtilities = ArrayUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (AssertionLevel) { - AssertionLevel[AssertionLevel["None"] = 0] = "None"; - AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal"; - AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; - AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; - })(TypeScript.AssertionLevel || (TypeScript.AssertionLevel = {})); - var AssertionLevel = TypeScript.AssertionLevel; - var Debug = (function () { - function Debug() { - } - Debug.shouldAssert = function (level) { - return this.currentAssertionLevel >= level; - }; - Debug.assert = function (expression, message, verboseDebugInfo) { - if (!expression) { - var verboseDebugString = ""; - if (verboseDebugInfo) { - verboseDebugString = "\r\nVerbose Debug Information:" + verboseDebugInfo(); - } - message = message || ""; - throw new Error("Debug Failure. False expression: " + message + verboseDebugString); - } - }; - Debug.fail = function (message) { - Debug.assert(false, message); - }; - Debug.currentAssertionLevel = 0 /* None */; - return Debug; - })(); - TypeScript.Debug = Debug; -})(TypeScript || (TypeScript = {})); -var __extends = this.__extends || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - __.prototype = b.prototype; - d.prototype = new __(); -}; -var TypeScript; -(function (TypeScript) { - var Location = (function () { - function Location(fileName, lineMap, start, length) { - this._fileName = fileName; - this._lineMap = lineMap; - this._start = start; - this._length = length; - } - Location.prototype.fileName = function () { - return this._fileName; - }; - Location.prototype.lineMap = function () { - return this._lineMap; - }; - Location.prototype.line = function () { - return this._lineMap ? this._lineMap.getLineNumberFromPosition(this.start()) : 0; - }; - Location.prototype.character = function () { - return this._lineMap ? this._lineMap.getLineAndCharacterFromPosition(this.start()).character() : 0; - }; - Location.prototype.start = function () { - return this._start; - }; - Location.prototype.length = function () { - return this._length; - }; - Location.equals = function (location1, location2) { - return location1._fileName === location2._fileName && location1._start === location2._start && location1._length === location2._length; - }; - return Location; - })(); - TypeScript.Location = Location; - var Diagnostic = (function (_super) { - __extends(Diagnostic, _super); - function Diagnostic(fileName, lineMap, start, length, diagnosticKey, _arguments, additionalLocations) { - _super.call(this, fileName, lineMap, start, length); - this._diagnosticKey = diagnosticKey; - this._arguments = (_arguments && _arguments.length > 0) ? _arguments : undefined; - this._additionalLocations = (additionalLocations && additionalLocations.length > 0) ? additionalLocations : undefined; - } - Diagnostic.prototype.toJSON = function (key) { - var result = {}; - result.start = this.start(); - result.length = this.length(); - result.diagnosticCode = this._diagnosticKey; - var _arguments = this.arguments(); - if (_arguments && _arguments.length > 0) { - result.arguments = _arguments; - } - return result; - }; - Diagnostic.prototype.diagnosticKey = function () { - return this._diagnosticKey; - }; - Diagnostic.prototype.arguments = function () { - return this._arguments; - }; - Diagnostic.prototype.text = function () { - return TypeScript.getLocalizedText(this._diagnosticKey, this._arguments); - }; - Diagnostic.prototype.message = function () { - return TypeScript.getDiagnosticMessage(this._diagnosticKey, this._arguments); - }; - Diagnostic.prototype.additionalLocations = function () { - return this._additionalLocations || []; - }; - Diagnostic.equals = function (diagnostic1, diagnostic2) { - return Location.equals(diagnostic1, diagnostic2) && diagnostic1._diagnosticKey === diagnostic2._diagnosticKey && TypeScript.ArrayUtilities.sequenceEquals(diagnostic1._arguments, diagnostic2._arguments, function (v1, v2) { return v1 === v2; }); - }; - Diagnostic.prototype.info = function () { - return getDiagnosticInfoFromKey(this.diagnosticKey()); - }; - return Diagnostic; - })(Location); - TypeScript.Diagnostic = Diagnostic; - function newLine() { - return "\r\n"; - } - TypeScript.newLine = newLine; - function getLargestIndex(diagnostic) { - var largest = -1; - var regex = /\{(\d+)\}/g; - var match; - while (match = regex.exec(diagnostic)) { - var val = parseInt(match[1]); - if (!isNaN(val) && val > largest) { - largest = val; - } - } - return largest; - } - function getDiagnosticInfoFromKey(diagnosticKey) { - var result = TypeScript.diagnosticInformationMap[diagnosticKey]; - TypeScript.Debug.assert(result); - return result; - } - function getLocalizedText(diagnosticKey, args) { - var diagnosticMessageText = diagnosticKey; - TypeScript.Debug.assert(diagnosticMessageText !== undefined && diagnosticMessageText !== null); - var actualCount = args ? args.length : 0; - var expectedCount = 1 + getLargestIndex(diagnosticKey); - if (expectedCount !== actualCount) { - throw new Error(getLocalizedText(TypeScript.DiagnosticCode.Expected_0_arguments_to_message_got_1_instead, [expectedCount, actualCount])); - } - var valueCount = 1 + getLargestIndex(diagnosticMessageText); - if (valueCount !== expectedCount) { - throw new Error(getLocalizedText(TypeScript.DiagnosticCode.Expected_the_message_0_to_have_1_arguments_but_it_had_2, [diagnosticMessageText, expectedCount, valueCount])); - } - diagnosticMessageText = diagnosticMessageText.replace(/{(\d+)}/g, function (match, num) { - return typeof args[num] !== 'undefined' ? args[num] : match; - }); - diagnosticMessageText = diagnosticMessageText.replace(/{(NL)}/g, function (match) { - return TypeScript.newLine(); - }); - return diagnosticMessageText; - } - TypeScript.getLocalizedText = getLocalizedText; - function getDiagnosticMessage(diagnosticKey, args) { - var diagnostic = getDiagnosticInfoFromKey(diagnosticKey); - var diagnosticMessageText = getLocalizedText(diagnosticKey, args); - var message; - if (diagnostic.category === 1 /* Error */) { - message = getLocalizedText(TypeScript.DiagnosticCode.error_TS_0_1, [diagnostic.code, diagnosticMessageText]); - } - else if (diagnostic.category === 0 /* Warning */) { - message = getLocalizedText(TypeScript.DiagnosticCode.warning_TS_0_1, [diagnostic.code, diagnosticMessageText]); - } - else { - message = diagnosticMessageText; - } - return message; - } - TypeScript.getDiagnosticMessage = getDiagnosticMessage; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Errors = (function () { - function Errors() { - } - Errors.argument = function (argument, message) { - return new Error("Invalid argument: " + argument + ". " + message); - }; - Errors.argumentOutOfRange = function (argument) { - return new Error("Argument out of range: " + argument); - }; - Errors.argumentNull = function (argument) { - return new Error("Argument null: " + argument); - }; - Errors.abstract = function () { - return new Error("Operation not implemented properly by subclass."); - }; - Errors.notYetImplemented = function () { - return new Error("Not yet implemented."); - }; - Errors.invalidOperation = function (message) { - return new Error("Invalid operation: " + message); - }; - return Errors; - })(); - TypeScript.Errors = Errors; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var IntegerUtilities; - (function (IntegerUtilities) { - function integerDivide(numerator, denominator) { - return (numerator / denominator) >> 0; - } - IntegerUtilities.integerDivide = integerDivide; - function integerMultiplyLow32Bits(n1, n2) { - var resultLow32 = (((n1 & 0xffff0000) * n2) >>> 0) + (((n1 & 0x0000ffff) * n2) >>> 0) >>> 0; - return resultLow32; - } - IntegerUtilities.integerMultiplyLow32Bits = integerMultiplyLow32Bits; - function isInteger(text) { - return /^[0-9]+$/.test(text); - } - IntegerUtilities.isInteger = isInteger; - function isHexInteger(text) { - return /^0(x|X)[0-9a-fA-F]+$/.test(text); - } - IntegerUtilities.isHexInteger = isHexInteger; - })(IntegerUtilities = TypeScript.IntegerUtilities || (TypeScript.IntegerUtilities = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var LineMap = (function () { - function LineMap(_computeLineStarts, length) { - this._computeLineStarts = _computeLineStarts; - this.length = length; - this._lineStarts = undefined; - } - LineMap.prototype.toJSON = function (key) { - return { lineStarts: this.lineStarts(), length: this.length }; - }; - LineMap.prototype.equals = function (other) { - return this.length === other.length && TypeScript.ArrayUtilities.sequenceEquals(this.lineStarts(), other.lineStarts(), function (v1, v2) { return v1 === v2; }); - }; - LineMap.prototype.lineStarts = function () { - if (!this._lineStarts) { - this._lineStarts = this._computeLineStarts(); - } - return this._lineStarts; - }; - LineMap.prototype.lineCount = function () { - return this.lineStarts().length; - }; - LineMap.prototype.getPosition = function (line, character) { - return this.lineStarts()[line] + character; - }; - LineMap.prototype.getLineNumberFromPosition = function (position) { - if (position < 0 || position > this.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - if (position === this.length) { - return this.lineCount() - 1; - } - var lineNumber = TypeScript.ArrayUtilities.binarySearch(this.lineStarts(), position); - if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; - } - return lineNumber; - }; - LineMap.prototype.getLineStartPosition = function (lineNumber) { - return this.lineStarts()[lineNumber]; - }; - LineMap.prototype.fillLineAndCharacterFromPosition = function (position, lineAndCharacter) { - if (position < 0 || position > this.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - var lineNumber = this.getLineNumberFromPosition(position); - lineAndCharacter.line = lineNumber; - lineAndCharacter.character = position - this.lineStarts()[lineNumber]; - }; - LineMap.prototype.getLineAndCharacterFromPosition = function (position) { - if (position < 0 || position > this.length) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - var lineNumber = this.getLineNumberFromPosition(position); - return new TypeScript.LineAndCharacter(lineNumber, position - this.lineStarts()[lineNumber]); - }; - LineMap.empty = new LineMap(function () { return [0]; }, 0); - return LineMap; - })(); - TypeScript.LineMap = LineMap; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var LineAndCharacter = (function () { - function LineAndCharacter(line, character) { - this._line = 0; - this._character = 0; - if (line < 0) { - throw TypeScript.Errors.argumentOutOfRange("line"); - } - if (character < 0) { - throw TypeScript.Errors.argumentOutOfRange("character"); - } - this._line = line; - this._character = character; - } - LineAndCharacter.prototype.line = function () { - return this._line; - }; - LineAndCharacter.prototype.character = function () { - return this._character; - }; - return LineAndCharacter; - })(); - TypeScript.LineAndCharacter = LineAndCharacter; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var StringUtilities = (function () { - function StringUtilities() { - } - StringUtilities.isString = function (value) { - return Object.prototype.toString.apply(value, []) === '[object String]'; - }; - StringUtilities.endsWith = function (string, value) { - return string.substring(string.length - value.length, string.length) === value; - }; - StringUtilities.startsWith = function (string, value) { - return string.substr(0, value.length) === value; - }; - StringUtilities.repeat = function (value, count) { - return Array(count + 1).join(value); - }; - return StringUtilities; - })(); - TypeScript.StringUtilities = StringUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (CharacterCodes) { - CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; - CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; - CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed"; - CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn"; - CharacterCodes[CharacterCodes["lineSeparator"] = 0x2028] = "lineSeparator"; - CharacterCodes[CharacterCodes["paragraphSeparator"] = 0x2029] = "paragraphSeparator"; - CharacterCodes[CharacterCodes["nextLine"] = 0x0085] = "nextLine"; - CharacterCodes[CharacterCodes["space"] = 0x0020] = "space"; - CharacterCodes[CharacterCodes["nonBreakingSpace"] = 0x00A0] = "nonBreakingSpace"; - CharacterCodes[CharacterCodes["enQuad"] = 0x2000] = "enQuad"; - CharacterCodes[CharacterCodes["emQuad"] = 0x2001] = "emQuad"; - CharacterCodes[CharacterCodes["enSpace"] = 0x2002] = "enSpace"; - CharacterCodes[CharacterCodes["emSpace"] = 0x2003] = "emSpace"; - CharacterCodes[CharacterCodes["threePerEmSpace"] = 0x2004] = "threePerEmSpace"; - CharacterCodes[CharacterCodes["fourPerEmSpace"] = 0x2005] = "fourPerEmSpace"; - CharacterCodes[CharacterCodes["sixPerEmSpace"] = 0x2006] = "sixPerEmSpace"; - CharacterCodes[CharacterCodes["figureSpace"] = 0x2007] = "figureSpace"; - CharacterCodes[CharacterCodes["punctuationSpace"] = 0x2008] = "punctuationSpace"; - CharacterCodes[CharacterCodes["thinSpace"] = 0x2009] = "thinSpace"; - CharacterCodes[CharacterCodes["hairSpace"] = 0x200A] = "hairSpace"; - CharacterCodes[CharacterCodes["zeroWidthSpace"] = 0x200B] = "zeroWidthSpace"; - CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 0x202F] = "narrowNoBreakSpace"; - CharacterCodes[CharacterCodes["ideographicSpace"] = 0x3000] = "ideographicSpace"; - CharacterCodes[CharacterCodes["_"] = 95] = "_"; - CharacterCodes[CharacterCodes["$"] = 36] = "$"; - CharacterCodes[CharacterCodes["_0"] = 48] = "_0"; - CharacterCodes[CharacterCodes["_1"] = 49] = "_1"; - CharacterCodes[CharacterCodes["_2"] = 50] = "_2"; - CharacterCodes[CharacterCodes["_3"] = 51] = "_3"; - CharacterCodes[CharacterCodes["_4"] = 52] = "_4"; - CharacterCodes[CharacterCodes["_5"] = 53] = "_5"; - CharacterCodes[CharacterCodes["_6"] = 54] = "_6"; - CharacterCodes[CharacterCodes["_7"] = 55] = "_7"; - CharacterCodes[CharacterCodes["_8"] = 56] = "_8"; - CharacterCodes[CharacterCodes["_9"] = 57] = "_9"; - CharacterCodes[CharacterCodes["a"] = 97] = "a"; - CharacterCodes[CharacterCodes["b"] = 98] = "b"; - CharacterCodes[CharacterCodes["c"] = 99] = "c"; - CharacterCodes[CharacterCodes["d"] = 100] = "d"; - CharacterCodes[CharacterCodes["e"] = 101] = "e"; - CharacterCodes[CharacterCodes["f"] = 102] = "f"; - CharacterCodes[CharacterCodes["g"] = 103] = "g"; - CharacterCodes[CharacterCodes["h"] = 104] = "h"; - CharacterCodes[CharacterCodes["i"] = 105] = "i"; - CharacterCodes[CharacterCodes["j"] = 106] = "j"; - CharacterCodes[CharacterCodes["k"] = 107] = "k"; - CharacterCodes[CharacterCodes["l"] = 108] = "l"; - CharacterCodes[CharacterCodes["m"] = 109] = "m"; - CharacterCodes[CharacterCodes["n"] = 110] = "n"; - CharacterCodes[CharacterCodes["o"] = 111] = "o"; - CharacterCodes[CharacterCodes["p"] = 112] = "p"; - CharacterCodes[CharacterCodes["q"] = 113] = "q"; - CharacterCodes[CharacterCodes["r"] = 114] = "r"; - CharacterCodes[CharacterCodes["s"] = 115] = "s"; - CharacterCodes[CharacterCodes["t"] = 116] = "t"; - CharacterCodes[CharacterCodes["u"] = 117] = "u"; - CharacterCodes[CharacterCodes["v"] = 118] = "v"; - CharacterCodes[CharacterCodes["w"] = 119] = "w"; - CharacterCodes[CharacterCodes["x"] = 120] = "x"; - CharacterCodes[CharacterCodes["y"] = 121] = "y"; - CharacterCodes[CharacterCodes["z"] = 122] = "z"; - CharacterCodes[CharacterCodes["A"] = 65] = "A"; - CharacterCodes[CharacterCodes["B"] = 66] = "B"; - CharacterCodes[CharacterCodes["C"] = 67] = "C"; - CharacterCodes[CharacterCodes["D"] = 68] = "D"; - CharacterCodes[CharacterCodes["E"] = 69] = "E"; - CharacterCodes[CharacterCodes["F"] = 70] = "F"; - CharacterCodes[CharacterCodes["G"] = 71] = "G"; - CharacterCodes[CharacterCodes["H"] = 72] = "H"; - CharacterCodes[CharacterCodes["I"] = 73] = "I"; - CharacterCodes[CharacterCodes["J"] = 74] = "J"; - CharacterCodes[CharacterCodes["K"] = 75] = "K"; - CharacterCodes[CharacterCodes["L"] = 76] = "L"; - CharacterCodes[CharacterCodes["M"] = 77] = "M"; - CharacterCodes[CharacterCodes["N"] = 78] = "N"; - CharacterCodes[CharacterCodes["O"] = 79] = "O"; - CharacterCodes[CharacterCodes["P"] = 80] = "P"; - CharacterCodes[CharacterCodes["Q"] = 81] = "Q"; - CharacterCodes[CharacterCodes["R"] = 82] = "R"; - CharacterCodes[CharacterCodes["S"] = 83] = "S"; - CharacterCodes[CharacterCodes["T"] = 84] = "T"; - CharacterCodes[CharacterCodes["U"] = 85] = "U"; - CharacterCodes[CharacterCodes["V"] = 86] = "V"; - CharacterCodes[CharacterCodes["W"] = 87] = "W"; - CharacterCodes[CharacterCodes["X"] = 88] = "X"; - CharacterCodes[CharacterCodes["Y"] = 89] = "Y"; - CharacterCodes[CharacterCodes["Z"] = 90] = "Z"; - CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand"; - CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk"; - CharacterCodes[CharacterCodes["at"] = 64] = "at"; - CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash"; - CharacterCodes[CharacterCodes["backtick"] = 96] = "backtick"; - CharacterCodes[CharacterCodes["bar"] = 124] = "bar"; - CharacterCodes[CharacterCodes["caret"] = 94] = "caret"; - CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace"; - CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket"; - CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen"; - CharacterCodes[CharacterCodes["colon"] = 58] = "colon"; - CharacterCodes[CharacterCodes["comma"] = 44] = "comma"; - CharacterCodes[CharacterCodes["dot"] = 46] = "dot"; - CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote"; - CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; - CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; - CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; - CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; - CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; - CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; - CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket"; - CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen"; - CharacterCodes[CharacterCodes["percent"] = 37] = "percent"; - CharacterCodes[CharacterCodes["plus"] = 43] = "plus"; - CharacterCodes[CharacterCodes["question"] = 63] = "question"; - CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon"; - CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote"; - CharacterCodes[CharacterCodes["slash"] = 47] = "slash"; - CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde"; - CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace"; - CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed"; - CharacterCodes[CharacterCodes["byteOrderMark"] = 0xFEFF] = "byteOrderMark"; - CharacterCodes[CharacterCodes["tab"] = 9] = "tab"; - CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab"; - })(TypeScript.CharacterCodes || (TypeScript.CharacterCodes = {})); - var CharacterCodes = TypeScript.CharacterCodes; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ScriptSnapshot; - (function (ScriptSnapshot) { - var StringScriptSnapshot = (function () { - function StringScriptSnapshot(text) { - this.text = text; - this._lineStartPositions = undefined; - } - StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); - }; - StringScriptSnapshot.prototype.getLength = function () { - return this.text.length; - }; - StringScriptSnapshot.prototype.getLineStartPositions = function () { - if (!this._lineStartPositions) { - this._lineStartPositions = TypeScript.TextUtilities.parseLineStarts(this.text); - } - return this._lineStartPositions; - }; - StringScriptSnapshot.prototype.getChangeRange = function (oldSnapshot) { - throw TypeScript.Errors.notYetImplemented(); - }; - return StringScriptSnapshot; - })(); - function fromString(text) { - return new StringScriptSnapshot(text); - } - ScriptSnapshot.fromString = fromString; - })(ScriptSnapshot = TypeScript.ScriptSnapshot || (TypeScript.ScriptSnapshot = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var LineMap1; - (function (LineMap1) { - function fromSimpleText(text) { - return new TypeScript.LineMap(function () { return TypeScript.TextUtilities.parseLineStarts({ charCodeAt: function (index) { return text.charCodeAt(index); }, length: text.length() }); }, text.length()); - } - LineMap1.fromSimpleText = fromSimpleText; - function fromScriptSnapshot(scriptSnapshot) { - return new TypeScript.LineMap(function () { return scriptSnapshot.getLineStartPositions(); }, scriptSnapshot.getLength()); - } - LineMap1.fromScriptSnapshot = fromScriptSnapshot; - function fromString(text) { - return new TypeScript.LineMap(function () { return TypeScript.TextUtilities.parseLineStarts(text); }, text.length); - } - LineMap1.fromString = fromString; - })(LineMap1 = TypeScript.LineMap1 || (TypeScript.LineMap1 = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SimpleText; - (function (SimpleText) { - var SimpleStringText = (function () { - function SimpleStringText(value) { - this.value = value; - this._lineMap = undefined; - } - SimpleStringText.prototype.length = function () { - return this.value.length; - }; - SimpleStringText.prototype.substr = function (start, length) { - var val = this.value; - return start === 0 && length == val.length ? val : val.substr(start, length); - }; - SimpleStringText.prototype.charCodeAt = function (index) { - return this.value.charCodeAt(index); - }; - SimpleStringText.prototype.lineMap = function () { - if (!this._lineMap) { - this._lineMap = TypeScript.LineMap1.fromString(this.value); - } - return this._lineMap; - }; - return SimpleStringText; - })(); - var SimpleScriptSnapshotText = (function () { - function SimpleScriptSnapshotText(scriptSnapshot) { - this.scriptSnapshot = scriptSnapshot; - this._lineMap = undefined; - } - SimpleScriptSnapshotText.prototype.charCodeAt = function (index) { - return this.scriptSnapshot.getText(index, index + 1).charCodeAt(0); - }; - SimpleScriptSnapshotText.prototype.length = function () { - return this.scriptSnapshot.getLength(); - }; - SimpleScriptSnapshotText.prototype.substr = function (start, length) { - return this.scriptSnapshot.getText(start, start + length); - }; - SimpleScriptSnapshotText.prototype.lineMap = function () { - var _this = this; - if (!this._lineMap) { - this._lineMap = new TypeScript.LineMap(function () { return _this.scriptSnapshot.getLineStartPositions(); }, this.length()); - } - return this._lineMap; - }; - return SimpleScriptSnapshotText; - })(); - function fromString(value) { - return new SimpleStringText(value); - } - SimpleText.fromString = fromString; - function fromScriptSnapshot(scriptSnapshot) { - return new SimpleScriptSnapshotText(scriptSnapshot); - } - SimpleText.fromScriptSnapshot = fromScriptSnapshot; - })(SimpleText = TypeScript.SimpleText || (TypeScript.SimpleText = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var TextUtilities; - (function (TextUtilities) { - function parseLineStarts(text) { - var length = text.length; - if (0 === length) { - var result = new Array(); - result.push(0); - return result; - } - var position = 0; - var index = 0; - var arrayBuilder = new Array(); - var lineNumber = 0; - while (index < length) { - var c = text.charCodeAt(index); - var lineBreakLength; - if (c > 13 /* carriageReturn */ && c <= 127) { - index++; - continue; - } - else if (c === 13 /* carriageReturn */ && index + 1 < length && text.charCodeAt(index + 1) === 10 /* lineFeed */) { - lineBreakLength = 2; - } - else if (c === 10 /* lineFeed */) { - lineBreakLength = 1; - } - else { - lineBreakLength = TextUtilities.getLengthOfLineBreak(text, index); - } - if (0 === lineBreakLength) { - index++; - } - else { - arrayBuilder.push(position); - index += lineBreakLength; - position = index; - lineNumber++; - } - } - arrayBuilder.push(position); - return arrayBuilder; - } - TextUtilities.parseLineStarts = parseLineStarts; - function getLengthOfLineBreakSlow(text, index, c) { - if (c === 13 /* carriageReturn */) { - var next = index + 1; - return (next < text.length) && 10 /* lineFeed */ === text.charCodeAt(next) ? 2 : 1; - } - else if (isAnyLineBreakCharacter(c)) { - return 1; - } - else { - return 0; - } - } - TextUtilities.getLengthOfLineBreakSlow = getLengthOfLineBreakSlow; - function getLengthOfLineBreak(text, index) { - var c = text.charCodeAt(index); - if (c > 13 /* carriageReturn */ && c <= 127) { - return 0; - } - return getLengthOfLineBreakSlow(text, index, c); - } - TextUtilities.getLengthOfLineBreak = getLengthOfLineBreak; - function isAnyLineBreakCharacter(c) { - return c === 10 /* lineFeed */ || c === 13 /* carriageReturn */ || c === 133 /* nextLine */ || c === 8232 /* lineSeparator */ || c === 8233 /* paragraphSeparator */; - } - TextUtilities.isAnyLineBreakCharacter = isAnyLineBreakCharacter; - })(TextUtilities = TypeScript.TextUtilities || (TypeScript.TextUtilities = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { +var ts; +(function (ts) { var TextSpan = (function () { function TextSpan(start, length) { - if (start < 0) { - TypeScript.Errors.argument("start"); - } - if (length < 0) { - TypeScript.Errors.argument("length"); - } + ts.Debug.assert(start >= 0, "start"); + ts.Debug.assert(length >= 0, "length"); this._start = start; this._length = length; } @@ -17645,21 +16213,16 @@ var TypeScript; return undefined; }; TextSpan.fromBounds = function (start, end) { - TypeScript.Debug.assert(start >= 0); - TypeScript.Debug.assert(end - start >= 0); + ts.Debug.assert(start >= 0); + ts.Debug.assert(end - start >= 0); return new TextSpan(start, end - start); }; return TextSpan; })(); - TypeScript.TextSpan = TextSpan; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { + ts.TextSpan = TextSpan; var TextChangeRange = (function () { function TextChangeRange(span, newLength) { - if (newLength < 0) { - throw TypeScript.Errors.argumentOutOfRange("newLength"); - } + ts.Debug.assert(newLength >= 0, "newLength"); this._span = span; this._newLength = newLength; } @@ -17670,7 +16233,7 @@ var TypeScript; return this._newLength; }; TextChangeRange.prototype.newSpan = function () { - return new TypeScript.TextSpan(this.span().start(), this.newLength()); + return new TextSpan(this.span().start(), this.newLength()); }; TextChangeRange.prototype.isUnchanged = function () { return this.span().isEmpty() && this.newLength() === 0; @@ -17698,10417 +16261,13 @@ var TypeScript; oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); } - return new TextChangeRange(TypeScript.TextSpan.fromBounds(oldStartN, oldEndN), newEndN - oldStartN); + return new TextChangeRange(TextSpan.fromBounds(oldStartN, oldEndN), newEndN - oldStartN); }; - TextChangeRange.unchanged = new TextChangeRange(new TypeScript.TextSpan(0, 0), 0); + TextChangeRange.unchanged = new TextChangeRange(new TextSpan(0, 0), 0); return TextChangeRange; })(); - TypeScript.TextChangeRange = TextChangeRange; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var CharacterInfo; - (function (CharacterInfo) { - function isDecimalDigit(c) { - return c >= 48 /* _0 */ && c <= 57 /* _9 */; - } - CharacterInfo.isDecimalDigit = isDecimalDigit; - function isOctalDigit(c) { - return c >= 48 /* _0 */ && c <= 55 /* _7 */; - } - CharacterInfo.isOctalDigit = isOctalDigit; - function isHexDigit(c) { - return CharacterInfo.isDecimalDigit(c) || (c >= 65 /* A */ && c <= 70 /* F */) || (c >= 97 /* a */ && c <= 102 /* f */); - } - CharacterInfo.isHexDigit = isHexDigit; - function hexValue(c) { - return CharacterInfo.isDecimalDigit(c) ? (c - 48 /* _0 */) : (c >= 65 /* A */ && c <= 70 /* F */) ? c - 65 /* A */ + 10 : c - 97 /* a */ + 10; - } - CharacterInfo.hexValue = hexValue; - function isWhitespace(ch) { - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - return true; - } - return false; - } - CharacterInfo.isWhitespace = isWhitespace; - function isLineTerminator(ch) { - switch (ch) { - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - return true; - } - return false; - } - CharacterInfo.isLineTerminator = isLineTerminator; - })(CharacterInfo = TypeScript.CharacterInfo || (TypeScript.CharacterInfo = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxConstants) { - SyntaxConstants[SyntaxConstants["None"] = 0] = "None"; - SyntaxConstants[SyntaxConstants["NodeDataComputed"] = 0x00000001] = "NodeDataComputed"; - SyntaxConstants[SyntaxConstants["NodeIncrementallyUnusableMask"] = 0x00000002] = "NodeIncrementallyUnusableMask"; - SyntaxConstants[SyntaxConstants["NodeParsedInStrictModeMask"] = 0x00000004] = "NodeParsedInStrictModeMask"; - SyntaxConstants[SyntaxConstants["NodeFullWidthShift"] = 3] = "NodeFullWidthShift"; - })(TypeScript.SyntaxConstants || (TypeScript.SyntaxConstants = {})); - var SyntaxConstants = TypeScript.SyntaxConstants; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var FormattingOptions = (function () { - function FormattingOptions(useTabs, spacesPerTab, indentSpaces, newLineCharacter) { - this.useTabs = useTabs; - this.spacesPerTab = spacesPerTab; - this.indentSpaces = indentSpaces; - this.newLineCharacter = newLineCharacter; - } - FormattingOptions.defaultOptions = new FormattingOptions(false, 4, 4, "\r\n"); - return FormattingOptions; - })(); - TypeScript.FormattingOptions = FormattingOptions; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - (function (SyntaxKind) { - SyntaxKind[SyntaxKind["None"] = 0] = "None"; - SyntaxKind[SyntaxKind["List"] = 1] = "List"; - SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 2] = "WhitespaceTrivia"; - SyntaxKind[SyntaxKind["NewLineTrivia"] = 3] = "NewLineTrivia"; - SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 4] = "MultiLineCommentTrivia"; - SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 5] = "SingleLineCommentTrivia"; - SyntaxKind[SyntaxKind["SkippedTokenTrivia"] = 6] = "SkippedTokenTrivia"; - SyntaxKind[SyntaxKind["ErrorToken"] = 7] = "ErrorToken"; - SyntaxKind[SyntaxKind["EndOfFileToken"] = 8] = "EndOfFileToken"; - SyntaxKind[SyntaxKind["IdentifierName"] = 9] = "IdentifierName"; - SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 10] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["NumericLiteral"] = 11] = "NumericLiteral"; - SyntaxKind[SyntaxKind["StringLiteral"] = 12] = "StringLiteral"; - SyntaxKind[SyntaxKind["NoSubstitutionTemplateToken"] = 13] = "NoSubstitutionTemplateToken"; - SyntaxKind[SyntaxKind["TemplateStartToken"] = 14] = "TemplateStartToken"; - SyntaxKind[SyntaxKind["TemplateMiddleToken"] = 15] = "TemplateMiddleToken"; - SyntaxKind[SyntaxKind["TemplateEndToken"] = 16] = "TemplateEndToken"; - SyntaxKind[SyntaxKind["BreakKeyword"] = 17] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 18] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 19] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 20] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 21] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 22] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 23] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 24] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 25] = "ElseKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 26] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 27] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 28] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 29] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 30] = "IfKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 31] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 32] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 33] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 34] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 35] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 36] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 37] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 38] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 39] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 40] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 41] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 42] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 43] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 44] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 45] = "WithKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 46] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 47] = "ConstKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 48] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 49] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 50] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 51] = "ImportKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 52] = "SuperKeyword"; - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 53] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 54] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 55] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 56] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 57] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 58] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 59] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 60] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 61] = "YieldKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 62] = "AnyKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 63] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 64] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 65] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 66] = "GetKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 67] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 68] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 69] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 70] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 71] = "StringKeyword"; - SyntaxKind[SyntaxKind["OpenBraceToken"] = 72] = "OpenBraceToken"; - SyntaxKind[SyntaxKind["CloseBraceToken"] = 73] = "CloseBraceToken"; - SyntaxKind[SyntaxKind["OpenParenToken"] = 74] = "OpenParenToken"; - SyntaxKind[SyntaxKind["CloseParenToken"] = 75] = "CloseParenToken"; - SyntaxKind[SyntaxKind["OpenBracketToken"] = 76] = "OpenBracketToken"; - SyntaxKind[SyntaxKind["CloseBracketToken"] = 77] = "CloseBracketToken"; - SyntaxKind[SyntaxKind["DotToken"] = 78] = "DotToken"; - SyntaxKind[SyntaxKind["DotDotDotToken"] = 79] = "DotDotDotToken"; - SyntaxKind[SyntaxKind["SemicolonToken"] = 80] = "SemicolonToken"; - SyntaxKind[SyntaxKind["CommaToken"] = 81] = "CommaToken"; - SyntaxKind[SyntaxKind["LessThanToken"] = 82] = "LessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 83] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 84] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 85] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 86] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 87] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 88] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 89] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 90] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 91] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 92] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 93] = "AsteriskToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 94] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 95] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 96] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 97] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 98] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 99] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 100] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 101] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 102] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 103] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 104] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 105] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 106] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 107] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 108] = "ColonToken"; - SyntaxKind[SyntaxKind["EqualsToken"] = 109] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 110] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 111] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 112] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 113] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 114] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 115] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 116] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 117] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 118] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 119] = "CaretEqualsToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 120] = "SlashToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 121] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["SourceUnit"] = 122] = "SourceUnit"; - SyntaxKind[SyntaxKind["QualifiedName"] = 123] = "QualifiedName"; - SyntaxKind[SyntaxKind["ObjectType"] = 124] = "ObjectType"; - SyntaxKind[SyntaxKind["FunctionType"] = 125] = "FunctionType"; - SyntaxKind[SyntaxKind["ArrayType"] = 126] = "ArrayType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 127] = "ConstructorType"; - SyntaxKind[SyntaxKind["GenericType"] = 128] = "GenericType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 129] = "TypeQuery"; - SyntaxKind[SyntaxKind["TupleType"] = 130] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 131] = "UnionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 132] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 133] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 134] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 135] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 136] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 137] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 138] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 139] = "ExportAssignment"; - SyntaxKind[SyntaxKind["MemberFunctionDeclaration"] = 140] = "MemberFunctionDeclaration"; - SyntaxKind[SyntaxKind["MemberVariableDeclaration"] = 141] = "MemberVariableDeclaration"; - SyntaxKind[SyntaxKind["ConstructorDeclaration"] = 142] = "ConstructorDeclaration"; - SyntaxKind[SyntaxKind["IndexMemberDeclaration"] = 143] = "IndexMemberDeclaration"; - SyntaxKind[SyntaxKind["GetAccessor"] = 144] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 145] = "SetAccessor"; - SyntaxKind[SyntaxKind["PropertySignature"] = 146] = "PropertySignature"; - SyntaxKind[SyntaxKind["CallSignature"] = 147] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 148] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 149] = "IndexSignature"; - SyntaxKind[SyntaxKind["MethodSignature"] = 150] = "MethodSignature"; - SyntaxKind[SyntaxKind["Block"] = 151] = "Block"; - SyntaxKind[SyntaxKind["IfStatement"] = 152] = "IfStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 153] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 154] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 155] = "ReturnStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 156] = "SwitchStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 157] = "BreakStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 158] = "ContinueStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 159] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 160] = "ForInStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 161] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 162] = "ThrowStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 163] = "WhileStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 164] = "TryStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 165] = "LabeledStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 166] = "DoStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 167] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 168] = "WithStatement"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 169] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 170] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 171] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 172] = "VoidExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 173] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 174] = "BinaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 175] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["MemberAccessExpression"] = 176] = "MemberAccessExpression"; - SyntaxKind[SyntaxKind["InvocationExpression"] = 177] = "InvocationExpression"; - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 178] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 179] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectCreationExpression"] = 180] = "ObjectCreationExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 181] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["ParenthesizedArrowFunctionExpression"] = 182] = "ParenthesizedArrowFunctionExpression"; - SyntaxKind[SyntaxKind["SimpleArrowFunctionExpression"] = 183] = "SimpleArrowFunctionExpression"; - SyntaxKind[SyntaxKind["CastExpression"] = 184] = "CastExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 185] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 186] = "FunctionExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 187] = "OmittedExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 188] = "TemplateExpression"; - SyntaxKind[SyntaxKind["TemplateAccessExpression"] = 189] = "TemplateAccessExpression"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 190] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarator"] = 191] = "VariableDeclarator"; - SyntaxKind[SyntaxKind["ArgumentList"] = 192] = "ArgumentList"; - SyntaxKind[SyntaxKind["ParameterList"] = 193] = "ParameterList"; - SyntaxKind[SyntaxKind["TypeArgumentList"] = 194] = "TypeArgumentList"; - SyntaxKind[SyntaxKind["TypeParameterList"] = 195] = "TypeParameterList"; - SyntaxKind[SyntaxKind["HeritageClause"] = 196] = "HeritageClause"; - SyntaxKind[SyntaxKind["EqualsValueClause"] = 197] = "EqualsValueClause"; - SyntaxKind[SyntaxKind["CaseSwitchClause"] = 198] = "CaseSwitchClause"; - SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 199] = "DefaultSwitchClause"; - SyntaxKind[SyntaxKind["ElseClause"] = 200] = "ElseClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 201] = "CatchClause"; - SyntaxKind[SyntaxKind["FinallyClause"] = 202] = "FinallyClause"; - SyntaxKind[SyntaxKind["TemplateClause"] = 203] = "TemplateClause"; - SyntaxKind[SyntaxKind["TypeParameter"] = 204] = "TypeParameter"; - SyntaxKind[SyntaxKind["Constraint"] = 205] = "Constraint"; - SyntaxKind[SyntaxKind["SimplePropertyAssignment"] = 206] = "SimplePropertyAssignment"; - SyntaxKind[SyntaxKind["FunctionPropertyAssignment"] = 207] = "FunctionPropertyAssignment"; - SyntaxKind[SyntaxKind["Parameter"] = 208] = "Parameter"; - SyntaxKind[SyntaxKind["EnumElement"] = 209] = "EnumElement"; - SyntaxKind[SyntaxKind["TypeAnnotation"] = 210] = "TypeAnnotation"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 211] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 212] = "ModuleNameModuleReference"; - SyntaxKind[SyntaxKind["FirstStandardKeyword"] = SyntaxKind.BreakKeyword] = "FirstStandardKeyword"; - SyntaxKind[SyntaxKind["LastStandardKeyword"] = SyntaxKind.WithKeyword] = "LastStandardKeyword"; - SyntaxKind[SyntaxKind["FirstFutureReservedKeyword"] = SyntaxKind.ClassKeyword] = "FirstFutureReservedKeyword"; - SyntaxKind[SyntaxKind["LastFutureReservedKeyword"] = SyntaxKind.SuperKeyword] = "LastFutureReservedKeyword"; - SyntaxKind[SyntaxKind["FirstFutureReservedStrictKeyword"] = SyntaxKind.ImplementsKeyword] = "FirstFutureReservedStrictKeyword"; - SyntaxKind[SyntaxKind["LastFutureReservedStrictKeyword"] = SyntaxKind.YieldKeyword] = "LastFutureReservedStrictKeyword"; - SyntaxKind[SyntaxKind["FirstTypeScriptKeyword"] = SyntaxKind.AnyKeyword] = "FirstTypeScriptKeyword"; - SyntaxKind[SyntaxKind["LastTypeScriptKeyword"] = SyntaxKind.StringKeyword] = "LastTypeScriptKeyword"; - SyntaxKind[SyntaxKind["FirstKeyword"] = SyntaxKind.FirstStandardKeyword] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = SyntaxKind.LastTypeScriptKeyword] = "LastKeyword"; - SyntaxKind[SyntaxKind["FirstToken"] = SyntaxKind.ErrorToken] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = SyntaxKind.SlashEqualsToken] = "LastToken"; - SyntaxKind[SyntaxKind["FirstPunctuation"] = SyntaxKind.OpenBraceToken] = "FirstPunctuation"; - SyntaxKind[SyntaxKind["LastPunctuation"] = SyntaxKind.SlashEqualsToken] = "LastPunctuation"; - SyntaxKind[SyntaxKind["FirstFixedWidth"] = SyntaxKind.FirstKeyword] = "FirstFixedWidth"; - SyntaxKind[SyntaxKind["LastFixedWidth"] = SyntaxKind.LastPunctuation] = "LastFixedWidth"; - SyntaxKind[SyntaxKind["FirstTrivia"] = SyntaxKind.WhitespaceTrivia] = "FirstTrivia"; - SyntaxKind[SyntaxKind["LastTrivia"] = SyntaxKind.SkippedTokenTrivia] = "LastTrivia"; - SyntaxKind[SyntaxKind["FirstNode"] = SyntaxKind.SourceUnit] = "FirstNode"; - SyntaxKind[SyntaxKind["LastNode"] = SyntaxKind.ModuleNameModuleReference] = "LastNode"; - })(TypeScript.SyntaxKind || (TypeScript.SyntaxKind = {})); - var SyntaxKind = TypeScript.SyntaxKind; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxFacts; - (function (SyntaxFacts) { - var textToKeywordKind = { - "any": 62 /* AnyKeyword */, - "boolean": 63 /* BooleanKeyword */, - "break": 17 /* BreakKeyword */, - "case": 18 /* CaseKeyword */, - "catch": 19 /* CatchKeyword */, - "class": 46 /* ClassKeyword */, - "continue": 20 /* ContinueKeyword */, - "const": 47 /* ConstKeyword */, - "constructor": 64 /* ConstructorKeyword */, - "debugger": 21 /* DebuggerKeyword */, - "declare": 65 /* DeclareKeyword */, - "default": 22 /* DefaultKeyword */, - "delete": 23 /* DeleteKeyword */, - "do": 24 /* DoKeyword */, - "else": 25 /* ElseKeyword */, - "enum": 48 /* EnumKeyword */, - "export": 49 /* ExportKeyword */, - "extends": 50 /* ExtendsKeyword */, - "false": 26 /* FalseKeyword */, - "finally": 27 /* FinallyKeyword */, - "for": 28 /* ForKeyword */, - "function": 29 /* FunctionKeyword */, - "get": 66 /* GetKeyword */, - "if": 30 /* IfKeyword */, - "implements": 53 /* ImplementsKeyword */, - "import": 51 /* ImportKeyword */, - "in": 31 /* InKeyword */, - "instanceof": 32 /* InstanceOfKeyword */, - "interface": 54 /* InterfaceKeyword */, - "let": 55 /* LetKeyword */, - "module": 67 /* ModuleKeyword */, - "new": 33 /* NewKeyword */, - "null": 34 /* NullKeyword */, - "number": 69 /* NumberKeyword */, - "package": 56 /* PackageKeyword */, - "private": 57 /* PrivateKeyword */, - "protected": 58 /* ProtectedKeyword */, - "public": 59 /* PublicKeyword */, - "require": 68 /* RequireKeyword */, - "return": 35 /* ReturnKeyword */, - "set": 70 /* SetKeyword */, - "static": 60 /* StaticKeyword */, - "string": 71 /* StringKeyword */, - "super": 52 /* SuperKeyword */, - "switch": 36 /* SwitchKeyword */, - "this": 37 /* ThisKeyword */, - "throw": 38 /* ThrowKeyword */, - "true": 39 /* TrueKeyword */, - "try": 40 /* TryKeyword */, - "typeof": 41 /* TypeOfKeyword */, - "var": 42 /* VarKeyword */, - "void": 43 /* VoidKeyword */, - "while": 44 /* WhileKeyword */, - "with": 45 /* WithKeyword */, - "yield": 61 /* YieldKeyword */, - "{": 72 /* OpenBraceToken */, - "}": 73 /* CloseBraceToken */, - "(": 74 /* OpenParenToken */, - ")": 75 /* CloseParenToken */, - "[": 76 /* OpenBracketToken */, - "]": 77 /* CloseBracketToken */, - ".": 78 /* DotToken */, - "...": 79 /* DotDotDotToken */, - ";": 80 /* SemicolonToken */, - ",": 81 /* CommaToken */, - "<": 82 /* LessThanToken */, - ">": 83 /* GreaterThanToken */, - "<=": 84 /* LessThanEqualsToken */, - ">=": 85 /* GreaterThanEqualsToken */, - "==": 86 /* EqualsEqualsToken */, - "=>": 87 /* EqualsGreaterThanToken */, - "!=": 88 /* ExclamationEqualsToken */, - "===": 89 /* EqualsEqualsEqualsToken */, - "!==": 90 /* ExclamationEqualsEqualsToken */, - "+": 91 /* PlusToken */, - "-": 92 /* MinusToken */, - "*": 93 /* AsteriskToken */, - "%": 94 /* PercentToken */, - "++": 95 /* PlusPlusToken */, - "--": 96 /* MinusMinusToken */, - "<<": 97 /* LessThanLessThanToken */, - ">>": 98 /* GreaterThanGreaterThanToken */, - ">>>": 99 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 100 /* AmpersandToken */, - "|": 101 /* BarToken */, - "^": 102 /* CaretToken */, - "!": 103 /* ExclamationToken */, - "~": 104 /* TildeToken */, - "&&": 105 /* AmpersandAmpersandToken */, - "||": 106 /* BarBarToken */, - "?": 107 /* QuestionToken */, - ":": 108 /* ColonToken */, - "=": 109 /* EqualsToken */, - "+=": 110 /* PlusEqualsToken */, - "-=": 111 /* MinusEqualsToken */, - "*=": 112 /* AsteriskEqualsToken */, - "%=": 113 /* PercentEqualsToken */, - "<<=": 114 /* LessThanLessThanEqualsToken */, - ">>=": 115 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 117 /* AmpersandEqualsToken */, - "|=": 118 /* BarEqualsToken */, - "^=": 119 /* CaretEqualsToken */, - "/": 120 /* SlashToken */, - "/=": 121 /* SlashEqualsToken */ - }; - var kindToText = new Array(); - for (var name in textToKeywordKind) { - if (textToKeywordKind.hasOwnProperty(name)) { - kindToText[textToKeywordKind[name]] = name; - } - } - kindToText[64 /* ConstructorKeyword */] = "constructor"; - function getTokenKind(text) { - if (textToKeywordKind.hasOwnProperty(text)) { - return textToKeywordKind[text]; - } - return 0 /* None */; - } - SyntaxFacts.getTokenKind = getTokenKind; - function getText(kind) { - var result = kindToText[kind]; - return result; - } - SyntaxFacts.getText = getText; - function isAnyKeyword(kind) { - return kind >= TypeScript.SyntaxKind.FirstKeyword && kind <= TypeScript.SyntaxKind.LastKeyword; - } - SyntaxFacts.isAnyKeyword = isAnyKeyword; - function isAnyPunctuation(kind) { - return kind >= TypeScript.SyntaxKind.FirstPunctuation && kind <= TypeScript.SyntaxKind.LastPunctuation; - } - SyntaxFacts.isAnyPunctuation = isAnyPunctuation; - function isPrefixUnaryExpressionOperatorToken(tokenKind) { - switch (tokenKind) { - case 91 /* PlusToken */: - case 92 /* MinusToken */: - case 104 /* TildeToken */: - case 103 /* ExclamationToken */: - case 95 /* PlusPlusToken */: - case 96 /* MinusMinusToken */: - return true; - default: - return false; - } - } - SyntaxFacts.isPrefixUnaryExpressionOperatorToken = isPrefixUnaryExpressionOperatorToken; - function isBinaryExpressionOperatorToken(tokenKind) { - switch (tokenKind) { - case 93 /* AsteriskToken */: - case 120 /* SlashToken */: - case 94 /* PercentToken */: - case 91 /* PlusToken */: - case 92 /* MinusToken */: - case 97 /* LessThanLessThanToken */: - case 98 /* GreaterThanGreaterThanToken */: - case 99 /* GreaterThanGreaterThanGreaterThanToken */: - case 82 /* LessThanToken */: - case 83 /* GreaterThanToken */: - case 84 /* LessThanEqualsToken */: - case 85 /* GreaterThanEqualsToken */: - case 32 /* InstanceOfKeyword */: - case 31 /* InKeyword */: - case 86 /* EqualsEqualsToken */: - case 88 /* ExclamationEqualsToken */: - case 89 /* EqualsEqualsEqualsToken */: - case 90 /* ExclamationEqualsEqualsToken */: - case 100 /* AmpersandToken */: - case 102 /* CaretToken */: - case 101 /* BarToken */: - case 105 /* AmpersandAmpersandToken */: - case 106 /* BarBarToken */: - case 118 /* BarEqualsToken */: - case 117 /* AmpersandEqualsToken */: - case 119 /* CaretEqualsToken */: - case 114 /* LessThanLessThanEqualsToken */: - case 115 /* GreaterThanGreaterThanEqualsToken */: - case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 110 /* PlusEqualsToken */: - case 111 /* MinusEqualsToken */: - case 112 /* AsteriskEqualsToken */: - case 121 /* SlashEqualsToken */: - case 113 /* PercentEqualsToken */: - case 109 /* EqualsToken */: - case 81 /* CommaToken */: - return true; - default: - return false; - } - } - SyntaxFacts.isBinaryExpressionOperatorToken = isBinaryExpressionOperatorToken; - function isAssignmentOperatorToken(tokenKind) { - switch (tokenKind) { - case 118 /* BarEqualsToken */: - case 117 /* AmpersandEqualsToken */: - case 119 /* CaretEqualsToken */: - case 114 /* LessThanLessThanEqualsToken */: - case 115 /* GreaterThanGreaterThanEqualsToken */: - case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 110 /* PlusEqualsToken */: - case 111 /* MinusEqualsToken */: - case 112 /* AsteriskEqualsToken */: - case 121 /* SlashEqualsToken */: - case 113 /* PercentEqualsToken */: - case 109 /* EqualsToken */: - return true; - default: - return false; - } - } - SyntaxFacts.isAssignmentOperatorToken = isAssignmentOperatorToken; - function isType(kind) { - switch (kind) { - case 126 /* ArrayType */: - case 62 /* AnyKeyword */: - case 69 /* NumberKeyword */: - case 63 /* BooleanKeyword */: - case 71 /* StringKeyword */: - case 43 /* VoidKeyword */: - case 125 /* FunctionType */: - case 124 /* ObjectType */: - case 127 /* ConstructorType */: - case 129 /* TypeQuery */: - case 128 /* GenericType */: - case 123 /* QualifiedName */: - case 9 /* IdentifierName */: - return true; - } - return false; - } - SyntaxFacts.isType = isType; - })(SyntaxFacts = TypeScript.SyntaxFacts || (TypeScript.SyntaxFacts = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Scanner; - (function (Scanner) { - TypeScript.Debug.assert(TypeScript.SyntaxKind.LastToken <= 127); - var ScannerConstants; - (function (ScannerConstants) { - ScannerConstants[ScannerConstants["LargeTokenFullStartShift"] = 4] = "LargeTokenFullStartShift"; - ScannerConstants[ScannerConstants["LargeTokenFullWidthShift"] = 7] = "LargeTokenFullWidthShift"; - ScannerConstants[ScannerConstants["LargeTokenLeadingTriviaBitMask"] = 0x01] = "LargeTokenLeadingTriviaBitMask"; - ScannerConstants[ScannerConstants["LargeTokenLeadingCommentBitMask"] = 0x02] = "LargeTokenLeadingCommentBitMask"; - ScannerConstants[ScannerConstants["LargeTokenTrailingTriviaBitMask"] = 0x04] = "LargeTokenTrailingTriviaBitMask"; - ScannerConstants[ScannerConstants["LargeTokenTrailingCommentBitMask"] = 0x08] = "LargeTokenTrailingCommentBitMask"; - ScannerConstants[ScannerConstants["LargeTokenTriviaBitMask"] = 0x0F] = "LargeTokenTriviaBitMask"; - ScannerConstants[ScannerConstants["FixedWidthTokenFullStartShift"] = 7] = "FixedWidthTokenFullStartShift"; - ScannerConstants[ScannerConstants["FixedWidthTokenMaxFullStart"] = 0x7FFFFF] = "FixedWidthTokenMaxFullStart"; - ScannerConstants[ScannerConstants["SmallTokenFullWidthShift"] = 7] = "SmallTokenFullWidthShift"; - ScannerConstants[ScannerConstants["SmallTokenFullStartShift"] = 12] = "SmallTokenFullStartShift"; - ScannerConstants[ScannerConstants["SmallTokenMaxFullStart"] = 0x3FFFF] = "SmallTokenMaxFullStart"; - ScannerConstants[ScannerConstants["SmallTokenMaxFullWidth"] = 0x1F] = "SmallTokenMaxFullWidth"; - ScannerConstants[ScannerConstants["SmallTokenFullWidthMask"] = 0x1F] = "SmallTokenFullWidthMask"; - ScannerConstants[ScannerConstants["KindMask"] = 0x7F] = "KindMask"; - ScannerConstants[ScannerConstants["IsVariableWidthMask"] = 0x80] = "IsVariableWidthMask"; - })(ScannerConstants || (ScannerConstants = {})); - TypeScript.Debug.assert(largeTokenUnpackFullStart(largeTokenPackFullStartAndInfo(1 << 26, 3)) === (1 << 26)); - TypeScript.Debug.assert(largeTokenUnpackFullStart(largeTokenPackFullStartAndInfo(3 << 25, 1)) === (3 << 25)); - TypeScript.Debug.assert(largeTokenUnpackFullStart(largeTokenPackFullStartAndInfo(10 << 23, 2)) === (10 << 23)); - function fixedWidthTokenPackData(fullStart, kind) { - return (fullStart << 7 /* FixedWidthTokenFullStartShift */) | kind; - } - function fixedWidthTokenUnpackFullStart(packedData) { - return packedData >> 7 /* FixedWidthTokenFullStartShift */; - } - function smallTokenPackData(fullStart, fullWidth, kind) { - return (fullStart << 12 /* SmallTokenFullStartShift */) | (fullWidth << 7 /* SmallTokenFullWidthShift */) | kind; - } - function smallTokenUnpackFullWidth(packedData) { - return (packedData >> 7 /* SmallTokenFullWidthShift */) & 31 /* SmallTokenFullWidthMask */; - } - function smallTokenUnpackFullStart(packedData) { - return packedData >> 12 /* SmallTokenFullStartShift */; - } - function largeTokenPackFullStartAndInfo(fullStart, triviaInfo) { - return (fullStart << 4 /* LargeTokenFullStartShift */) | triviaInfo; - } - function largeTokenUnpackFullWidth(packedFullWidthAndKind) { - return packedFullWidthAndKind >> 7 /* LargeTokenFullWidthShift */; - } - function largeTokenUnpackFullStart(packedFullStartAndInfo) { - return packedFullStartAndInfo >> 4 /* LargeTokenFullStartShift */; - } - function largeTokenUnpackHasLeadingTrivia(packed) { - return (packed & 1 /* LargeTokenLeadingTriviaBitMask */) !== 0; - } - function largeTokenUnpackHasTrailingTrivia(packed) { - return (packed & 4 /* LargeTokenTrailingTriviaBitMask */) !== 0; - } - function largeTokenUnpackHasLeadingComment(packed) { - return (packed & 2 /* LargeTokenLeadingCommentBitMask */) !== 0; - } - function largeTokenUnpackHasTrailingComment(packed) { - return (packed & 8 /* LargeTokenTrailingCommentBitMask */) !== 0; - } - function largeTokenUnpackTriviaInfo(packed) { - return packed & 15 /* LargeTokenTriviaBitMask */; - } - var isKeywordStartCharacter = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, 0); - var isIdentifierStartCharacter = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - var isIdentifierPartCharacter = TypeScript.ArrayUtilities.createArray(127 /* maxAsciiCharacter */, false); - for (var character = 0; character < 127 /* maxAsciiCharacter */; character++) { - if ((character >= 97 /* a */ && character <= 122 /* z */) || (character >= 65 /* A */ && character <= 90 /* Z */) || character === 95 /* _ */ || character === 36 /* $ */) { - isIdentifierStartCharacter[character] = true; - isIdentifierPartCharacter[character] = true; - } - else if (character >= 48 /* _0 */ && character <= 57 /* _9 */) { - isIdentifierPartCharacter[character] = true; - } - } - for (var keywordKind = TypeScript.SyntaxKind.FirstKeyword; keywordKind <= TypeScript.SyntaxKind.LastKeyword; keywordKind++) { - var keyword = TypeScript.SyntaxFacts.getText(keywordKind); - isKeywordStartCharacter[keyword.charCodeAt(0)] = 1; - } - function isContextualToken(token) { - switch (token.kind()) { - case 10 /* RegularExpressionLiteral */: - case 98 /* GreaterThanGreaterThanToken */: - case 99 /* GreaterThanGreaterThanGreaterThanToken */: - case 85 /* GreaterThanEqualsToken */: - case 115 /* GreaterThanGreaterThanEqualsToken */: - case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - return true; - case 15 /* TemplateMiddleToken */: - case 16 /* TemplateEndToken */: - return true; - default: - return token.isKeywordConvertedToIdentifier(); - } - } - Scanner.isContextualToken = isContextualToken; - var lastTokenInfo = { leadingTriviaWidth: -1, width: -1 }; - var lastTokenInfoTokenID = -1; - var triviaScanner = createScannerInternal(2 /* Latest */, TypeScript.SimpleText.fromString(""), function () { - }); - function fillSizeInfo(token, text) { - if (lastTokenInfoTokenID !== TypeScript.syntaxID(token)) { - triviaScanner.fillTokenInfo(token, text, lastTokenInfo); - lastTokenInfoTokenID = TypeScript.syntaxID(token); - } - } - function fullText(token, text) { - return text.substr(token.fullStart(), token.fullWidth()); - } - function leadingTrivia(token, text) { - if (!token.hasLeadingTrivia()) { - return TypeScript.Syntax.emptyTriviaList; - } - return triviaScanner.scanTrivia(token, text, false); - } - function trailingTrivia(token, text) { - if (!token.hasTrailingTrivia()) { - return TypeScript.Syntax.emptyTriviaList; - } - return triviaScanner.scanTrivia(token, text, true); - } - function leadingTriviaWidth(token, text) { - if (!token.hasLeadingTrivia()) { - return 0; - } - fillSizeInfo(token, text); - return lastTokenInfo.leadingTriviaWidth; - } - function trailingTriviaWidth(token, text) { - if (!token.hasTrailingTrivia()) { - return 0; - } - fillSizeInfo(token, text); - return token.fullWidth() - lastTokenInfo.leadingTriviaWidth - lastTokenInfo.width; - } - function tokenIsIncrementallyUnusable(token) { - return false; - } - var FixedWidthTokenWithNoTrivia = (function () { - function FixedWidthTokenWithNoTrivia(_packedData) { - this._packedData = _packedData; - } - FixedWidthTokenWithNoTrivia.prototype.setFullStart = function (fullStart) { - this._packedData = fixedWidthTokenPackData(fullStart, this.kind()); - }; - FixedWidthTokenWithNoTrivia.prototype.childCount = function () { - return 0; - }; - FixedWidthTokenWithNoTrivia.prototype.childAt = function (index) { - throw TypeScript.Errors.invalidOperation(); - }; - FixedWidthTokenWithNoTrivia.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - FixedWidthTokenWithNoTrivia.prototype.isIncrementallyUnusable = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.isKeywordConvertedToIdentifier = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasSkippedToken = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.fullText = function () { - return TypeScript.SyntaxFacts.getText(this.kind()); - }; - FixedWidthTokenWithNoTrivia.prototype.text = function () { - return this.fullText(); - }; - FixedWidthTokenWithNoTrivia.prototype.leadingTrivia = function () { - return TypeScript.Syntax.emptyTriviaList; - }; - FixedWidthTokenWithNoTrivia.prototype.trailingTrivia = function () { - return TypeScript.Syntax.emptyTriviaList; - }; - FixedWidthTokenWithNoTrivia.prototype.leadingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithNoTrivia.prototype.trailingTriviaWidth = function () { - return 0; - }; - FixedWidthTokenWithNoTrivia.prototype.kind = function () { - return this._packedData & 127 /* KindMask */; - }; - FixedWidthTokenWithNoTrivia.prototype.fullWidth = function () { - return fixedWidthTokenLength(this._packedData & 127 /* KindMask */); - }; - FixedWidthTokenWithNoTrivia.prototype.fullStart = function () { - return fixedWidthTokenUnpackFullStart(this._packedData); - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingTrivia = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasTrailingTrivia = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasLeadingComment = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.hasTrailingComment = function () { - return false; - }; - FixedWidthTokenWithNoTrivia.prototype.clone = function () { - return new FixedWidthTokenWithNoTrivia(this._packedData); - }; - return FixedWidthTokenWithNoTrivia; - })(); - var LargeScannerToken = (function () { - function LargeScannerToken(_packedFullStartAndInfo, _packedFullWidthAndKind, cachedText) { - this._packedFullStartAndInfo = _packedFullStartAndInfo; - this._packedFullWidthAndKind = _packedFullWidthAndKind; - if (cachedText !== undefined) { - this.cachedText = cachedText; - } - } - LargeScannerToken.prototype.setFullStart = function (fullStart) { - this._packedFullStartAndInfo = largeTokenPackFullStartAndInfo(fullStart, largeTokenUnpackTriviaInfo(this._packedFullStartAndInfo)); - }; - LargeScannerToken.prototype.childCount = function () { - return 0; - }; - LargeScannerToken.prototype.childAt = function (index) { - throw TypeScript.Errors.invalidOperation(); - }; - LargeScannerToken.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - LargeScannerToken.prototype.syntaxTreeText = function (text) { - var result = text || TypeScript.syntaxTree(this).text; - TypeScript.Debug.assert(result); - return result; - }; - LargeScannerToken.prototype.isIncrementallyUnusable = function () { - return tokenIsIncrementallyUnusable(this); - }; - LargeScannerToken.prototype.isKeywordConvertedToIdentifier = function () { - return false; - }; - LargeScannerToken.prototype.hasSkippedToken = function () { - return false; - }; - LargeScannerToken.prototype.fullText = function (text) { - return fullText(this, this.syntaxTreeText(text)); - }; - LargeScannerToken.prototype.text = function () { - var cachedText = this.cachedText; - return cachedText !== undefined ? cachedText : TypeScript.SyntaxFacts.getText(this.kind()); - }; - LargeScannerToken.prototype.leadingTrivia = function (text) { - return leadingTrivia(this, this.syntaxTreeText(text)); - }; - LargeScannerToken.prototype.trailingTrivia = function (text) { - return trailingTrivia(this, this.syntaxTreeText(text)); - }; - LargeScannerToken.prototype.leadingTriviaWidth = function (text) { - return leadingTriviaWidth(this, this.syntaxTreeText(text)); - }; - LargeScannerToken.prototype.trailingTriviaWidth = function (text) { - return trailingTriviaWidth(this, this.syntaxTreeText(text)); - }; - LargeScannerToken.prototype.kind = function () { - return this._packedFullWidthAndKind & 127 /* KindMask */; - }; - LargeScannerToken.prototype.fullWidth = function () { - return largeTokenUnpackFullWidth(this._packedFullWidthAndKind); - }; - LargeScannerToken.prototype.fullStart = function () { - return largeTokenUnpackFullStart(this._packedFullStartAndInfo); - }; - LargeScannerToken.prototype.hasLeadingTrivia = function () { - return largeTokenUnpackHasLeadingTrivia(this._packedFullStartAndInfo); - }; - LargeScannerToken.prototype.hasTrailingTrivia = function () { - return largeTokenUnpackHasTrailingTrivia(this._packedFullStartAndInfo); - }; - LargeScannerToken.prototype.hasLeadingComment = function () { - return largeTokenUnpackHasLeadingComment(this._packedFullStartAndInfo); - }; - LargeScannerToken.prototype.hasTrailingComment = function () { - return largeTokenUnpackHasTrailingComment(this._packedFullStartAndInfo); - }; - LargeScannerToken.prototype.clone = function () { - return new LargeScannerToken(this._packedFullStartAndInfo, this._packedFullWidthAndKind, this.cachedText); - }; - return LargeScannerToken; - })(); - function createScanner(languageVersion, text, reportDiagnostic) { - var scanner = createScannerInternal(languageVersion, text, reportDiagnostic); - return { - setIndex: scanner.setIndex, - scan: scanner.scan - }; - } - Scanner.createScanner = createScanner; - function createScannerInternal(languageVersion, text, reportDiagnostic) { - var str; - var index; - var start; - var end; - function setIndex(_index) { - index = _index; - } - function reset(_text, _start, _end) { - TypeScript.Debug.assert(_start <= _text.length(), "Token's start was not within the bounds of text: " + _start + " - [0, " + _text.length() + ")"); - TypeScript.Debug.assert(_end <= _text.length(), "Token's end was not within the bounds of text: " + _end + " - [0, " + _text.length() + ")"); - if (!str || text !== _text) { - text = _text; - str = _text.substr(0, _text.length()); - } - start = _start; - end = _end; - index = _start; - } - function scan(allowContextualToken) { - var fullStart = index; - var leadingTriviaInfo = scanTriviaInfo(false); - var start = index; - var kindAndIsVariableWidth = scanSyntaxKind(allowContextualToken); - var end = index; - var trailingTriviaInfo = scanTriviaInfo(true); - var fullWidth = index - fullStart; - var kind = kindAndIsVariableWidth & 127 /* KindMask */; - var isFixedWidth = kind >= TypeScript.SyntaxKind.FirstFixedWidth && kind <= TypeScript.SyntaxKind.LastFixedWidth && ((kindAndIsVariableWidth & 128 /* IsVariableWidthMask */) === 0); - if (isFixedWidth && leadingTriviaInfo === 0 && trailingTriviaInfo === 0 && fullStart <= 8388607 /* FixedWidthTokenMaxFullStart */ && (kindAndIsVariableWidth & 128 /* IsVariableWidthMask */) === 0) { - return new FixedWidthTokenWithNoTrivia((fullStart << 7 /* FixedWidthTokenFullStartShift */) | kind); - } - else { - var packedFullStartAndTriviaInfo = (fullStart << 4 /* LargeTokenFullStartShift */) | leadingTriviaInfo | (trailingTriviaInfo << 2); - var packedFullWidthAndKind = (fullWidth << 7 /* LargeTokenFullWidthShift */) | kind; - var cachedText = isFixedWidth ? undefined : text.substr(start, end - start); - return new LargeScannerToken(packedFullStartAndTriviaInfo, packedFullWidthAndKind, cachedText); - } - } - function scanTrivia(parent, text, isTrailing) { - var tokenFullStart = parent.fullStart(); - var tokenStart = tokenFullStart + leadingTriviaWidth(parent, text); - if (isTrailing) { - reset(text, tokenStart + parent.text().length, tokenFullStart + parent.fullWidth()); - } - else { - reset(text, tokenFullStart, tokenStart); - } - var trivia = []; - while (true) { - if (index < end) { - var ch = str.charCodeAt(index); - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - trivia.push(scanWhitespaceTrivia()); - continue; - case 47 /* slash */: - var ch2 = str.charCodeAt(index + 1); - if (ch2 === 47 /* slash */) { - trivia.push(scanSingleLineCommentTrivia()); - continue; - } - if (ch2 === 42 /* asterisk */) { - trivia.push(scanMultiLineCommentTrivia()); - continue; - } - throw TypeScript.Errors.invalidOperation(); - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - trivia.push(scanLineTerminatorSequenceTrivia(ch)); - if (!isTrailing) { - continue; - } - break; - default: - throw TypeScript.Errors.invalidOperation(); - } - } - var triviaList = TypeScript.Syntax.triviaList(trivia); - triviaList.parent = parent; - return triviaList; - } - } - function scanTriviaInfo(isTrailing) { - var result = 0; - var _end = end; - while (index < _end) { - var ch = str.charCodeAt(index); - switch (ch) { - case 9 /* tab */: - case 32 /* space */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - index++; - result |= 1; - continue; - case 13 /* carriageReturn */: - if ((index + 1) < end && str.charCodeAt(index + 1) === 10 /* lineFeed */) { - index++; - } - case 10 /* lineFeed */: - index++; - result |= 1; - if (isTrailing) { - return result; - } - continue; - case 47 /* slash */: - if ((index + 1) < _end) { - var ch2 = str.charCodeAt(index + 1); - if (ch2 === 47 /* slash */) { - result |= 3; - skipSingleLineCommentTrivia(); - continue; - } - if (ch2 === 42 /* asterisk */) { - result |= 3; - skipMultiLineCommentTrivia(); - continue; - } - } - return result; - default: - if (ch > 127 /* maxAsciiCharacter */ && slowScanTriviaInfo(ch)) { - result |= 1; - continue; - } - return result; - } - } - return result; - } - function slowScanTriviaInfo(ch) { - switch (ch) { - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - case 65279 /* byteOrderMark */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - index++; - return true; - default: - return false; - } - } - function isNewLineCharacter(ch) { - switch (ch) { - case 13 /* carriageReturn */: - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - return true; - default: - return false; - } - } - function scanWhitespaceTrivia() { - var absoluteStartIndex = index; - while (true) { - var ch = str.charCodeAt(index); - switch (ch) { - case 32 /* space */: - case 160 /* nonBreakingSpace */: - case 8192 /* enQuad */: - case 8193 /* emQuad */: - case 8194 /* enSpace */: - case 8195 /* emSpace */: - case 8196 /* threePerEmSpace */: - case 8197 /* fourPerEmSpace */: - case 8198 /* sixPerEmSpace */: - case 8199 /* figureSpace */: - case 8200 /* punctuationSpace */: - case 8201 /* thinSpace */: - case 8202 /* hairSpace */: - case 8203 /* zeroWidthSpace */: - case 8239 /* narrowNoBreakSpace */: - case 12288 /* ideographicSpace */: - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 65279 /* byteOrderMark */: - index++; - continue; - } - break; - } - return createTrivia(2 /* WhitespaceTrivia */, absoluteStartIndex); - } - function createTrivia(kind, absoluteStartIndex) { - var fullWidth = index - absoluteStartIndex; - return TypeScript.Syntax.deferredTrivia(kind, text, absoluteStartIndex, fullWidth); - } - function scanSingleLineCommentTrivia() { - var absoluteStartIndex = index; - skipSingleLineCommentTrivia(); - return createTrivia(5 /* SingleLineCommentTrivia */, absoluteStartIndex); - } - function skipSingleLineCommentTrivia() { - index += 2; - while (index < end) { - if (isNewLineCharacter(str.charCodeAt(index))) { - return; - } - index++; - } - } - function scanMultiLineCommentTrivia() { - var absoluteStartIndex = index; - skipMultiLineCommentTrivia(); - return createTrivia(4 /* MultiLineCommentTrivia */, absoluteStartIndex); - } - function skipMultiLineCommentTrivia() { - index += 2; - while (true) { - if (index === end) { - reportDiagnostic(end, 0, TypeScript.DiagnosticCode._0_expected, ["*/"]); - return; - } - if ((index + 1) < end && str.charCodeAt(index) === 42 /* asterisk */ && str.charCodeAt(index + 1) === 47 /* slash */) { - index += 2; - return; - } - index++; - } - } - function scanLineTerminatorSequenceTrivia(ch) { - var absoluteStartIndex = index; - skipLineTerminatorSequence(ch); - return createTrivia(3 /* NewLineTrivia */, absoluteStartIndex); - } - function skipLineTerminatorSequence(ch) { - index++; - if (ch === 13 /* carriageReturn */ && str.charCodeAt(index) === 10 /* lineFeed */) { - index++; - } - } - function scanSyntaxKind(allowContextualToken) { - if (index >= end) { - return 8 /* EndOfFileToken */; - } - var character = str.charCodeAt(index); - index++; - switch (character) { - case 33 /* exclamation */: return scanExclamationToken(); - case 34 /* doubleQuote */: return scanStringLiteral(character); - case 37 /* percent */: return scanPercentToken(); - case 38 /* ampersand */: return scanAmpersandToken(); - case 39 /* singleQuote */: return scanStringLiteral(character); - case 40 /* openParen */: return 74 /* OpenParenToken */; - case 41 /* closeParen */: return 75 /* CloseParenToken */; - case 42 /* asterisk */: return scanAsteriskToken(); - case 43 /* plus */: return scanPlusToken(); - case 44 /* comma */: return 81 /* CommaToken */; - case 45 /* minus */: return scanMinusToken(); - case 46 /* dot */: return scanDotToken(); - case 47 /* slash */: return scanSlashToken(allowContextualToken); - case 48 /* _0 */: - case 49 /* _1 */: - case 50 /* _2 */: - case 51 /* _3 */: - case 52 /* _4 */: - case 53 /* _5 */: - case 54 /* _6 */: - case 55 /* _7 */: - case 56 /* _8 */: - case 57 /* _9 */: - return scanNumericLiteral(character); - case 58 /* colon */: return 108 /* ColonToken */; - case 59 /* semicolon */: return 80 /* SemicolonToken */; - case 60 /* lessThan */: return scanLessThanToken(); - case 61 /* equals */: return scanEqualsToken(); - case 62 /* greaterThan */: return scanGreaterThanToken(allowContextualToken); - case 63 /* question */: return 107 /* QuestionToken */; - case 91 /* openBracket */: return 76 /* OpenBracketToken */; - case 93 /* closeBracket */: return 77 /* CloseBracketToken */; - case 94 /* caret */: return scanCaretToken(); - case 96 /* backtick */: return scanTemplateToken(character); - case 123 /* openBrace */: return 72 /* OpenBraceToken */; - case 124 /* bar */: return scanBarToken(); - case 125 /* closeBrace */: return scanCloseBraceToken(allowContextualToken, character); - case 126 /* tilde */: return 104 /* TildeToken */; - } - if (isIdentifierStartCharacter[character]) { - var result = tryFastScanIdentifierOrKeyword(character); - if (result !== 0 /* None */) { - return result; - } - } - index--; - if (isIdentifierStart(peekCharOrUnicodeEscape())) { - return slowScanIdentifierOrKeyword(); - } - var text = String.fromCharCode(character); - var messageText = getErrorMessageText(text); - reportDiagnostic(index, 1, TypeScript.DiagnosticCode.Unexpected_character_0, [messageText]); - index++; - return 7 /* ErrorToken */; - } - function isIdentifierStart(interpretedChar) { - if (isIdentifierStartCharacter[interpretedChar]) { - return true; - } - return interpretedChar > 127 /* maxAsciiCharacter */ && TypeScript.Unicode.isIdentifierStart(interpretedChar, languageVersion); - } - function isIdentifierPart(interpretedChar) { - if (isIdentifierPartCharacter[interpretedChar]) { - return true; - } - return interpretedChar > 127 /* maxAsciiCharacter */ && TypeScript.Unicode.isIdentifierPart(interpretedChar, languageVersion); - } - function tryFastScanIdentifierOrKeyword(firstCharacter) { - var startIndex = index; - var character = firstCharacter; - while (index < end) { - character = str.charCodeAt(index); - if (!isIdentifierPartCharacter[character]) { - break; - } - index++; - } - if (index < end && (character === 92 /* backslash */ || character > 127 /* maxAsciiCharacter */)) { - index = startIndex; - return 0 /* None */; - } - else { - if (isKeywordStartCharacter[firstCharacter]) { - return TypeScript.ScannerUtilities.identifierKind(str, startIndex - 1, index - startIndex + 1); - } - else { - return 9 /* IdentifierName */; - } - } - } - function slowScanIdentifierOrKeyword() { - var startIndex = index; - do { - scanCharOrUnicodeEscape(); - } while (isIdentifierPart(peekCharOrUnicodeEscape())); - var length = index - startIndex; - var text = str.substr(startIndex, length); - var valueText = TypeScript.massageEscapes(text); - var keywordKind = TypeScript.SyntaxFacts.getTokenKind(valueText); - if (keywordKind >= TypeScript.SyntaxKind.FirstKeyword && keywordKind <= TypeScript.SyntaxKind.LastKeyword) { - return keywordKind | 128 /* IsVariableWidthMask */; - } - return 9 /* IdentifierName */; - } - function scanNumericLiteral(ch) { - if (isHexNumericLiteral(ch)) { - scanHexNumericLiteral(); - } - else if (isOctalNumericLiteral(ch)) { - scanOctalNumericLiteral(); - } - else { - scanDecimalNumericLiteral(); - } - return 11 /* NumericLiteral */; - } - function isOctalNumericLiteral(ch) { - return ch === 48 /* _0 */ && TypeScript.CharacterInfo.isOctalDigit(str.charCodeAt(index)); - } - function scanOctalNumericLiteral() { - var start = index - 1; - while (TypeScript.CharacterInfo.isOctalDigit(str.charCodeAt(index))) { - index++; - } - if (languageVersion >= 1 /* ES5 */) { - reportDiagnostic(start, index - start, TypeScript.DiagnosticCode.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher, undefined); - } - } - function scanDecimalDigits() { - while (TypeScript.CharacterInfo.isDecimalDigit(str.charCodeAt(index))) { - index++; - } - } - function scanDecimalNumericLiteral() { - scanDecimalDigits(); - if (str.charCodeAt(index) === 46 /* dot */) { - index++; - } - scanDecimalNumericLiteralAfterDot(); - } - function scanDecimalNumericLiteralAfterDot() { - scanDecimalDigits(); - var ch = str.charCodeAt(index); - if (ch === 101 /* e */ || ch === 69 /* E */) { - var nextChar1 = str.charCodeAt(index + 1); - if (TypeScript.CharacterInfo.isDecimalDigit(nextChar1)) { - index++; - scanDecimalDigits(); - } - else if (nextChar1 === 45 /* minus */ || nextChar1 === 43 /* plus */) { - var nextChar2 = str.charCodeAt(index + 2); - if (TypeScript.CharacterInfo.isDecimalDigit(nextChar2)) { - index += 2; - scanDecimalDigits(); - } - } - } - } - function scanHexNumericLiteral() { - index++; - while (TypeScript.CharacterInfo.isHexDigit(str.charCodeAt(index))) { - index++; - } - } - function isHexNumericLiteral(ch) { - if (ch === 48 /* _0 */) { - var ch = str.charCodeAt(index); - if (ch === 120 /* x */ || ch === 88 /* X */) { - return TypeScript.CharacterInfo.isHexDigit(str.charCodeAt(index + 1)); - } - } - return false; - } - function scanLessThanToken() { - var ch0 = str.charCodeAt(index); - if (ch0 === 61 /* equals */) { - index++; - return 84 /* LessThanEqualsToken */; - } - else if (ch0 === 60 /* lessThan */) { - index++; - if (str.charCodeAt(index) === 61 /* equals */) { - index++; - return 114 /* LessThanLessThanEqualsToken */; - } - else { - return 97 /* LessThanLessThanToken */; - } - } - else { - return 82 /* LessThanToken */; - } - } - function scanGreaterThanToken(allowContextualToken) { - if (allowContextualToken) { - var ch0 = str.charCodeAt(index); - if (ch0 === 62 /* greaterThan */) { - index++; - var ch1 = str.charCodeAt(index); - if (ch1 === 62 /* greaterThan */) { - index++; - var ch2 = str.charCodeAt(index); - if (ch2 === 61 /* equals */) { - index++; - return 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */; - } - else { - return 99 /* GreaterThanGreaterThanGreaterThanToken */; - } - } - else if (ch1 === 61 /* equals */) { - index++; - return 115 /* GreaterThanGreaterThanEqualsToken */; - } - else { - return 98 /* GreaterThanGreaterThanToken */; - } - } - else if (ch0 === 61 /* equals */) { - index++; - return 85 /* GreaterThanEqualsToken */; - } - } - return 83 /* GreaterThanToken */; - } - function scanBarToken() { - var ch = str.charCodeAt(index); - if (ch === 61 /* equals */) { - index++; - return 118 /* BarEqualsToken */; - } - else if (ch === 124 /* bar */) { - index++; - return 106 /* BarBarToken */; - } - else { - return 101 /* BarToken */; - } - } - function scanCaretToken() { - if (str.charCodeAt(index) === 61 /* equals */) { - index++; - return 119 /* CaretEqualsToken */; - } - else { - return 102 /* CaretToken */; - } - } - function scanCloseBraceToken(allowContextualToken, startChar) { - return allowContextualToken ? scanTemplateToken(startChar) : 73 /* CloseBraceToken */; - } - function scanTemplateToken(startChar) { - var startedWithBacktick = startChar === 96 /* backtick */; - while (true) { - if (index === end) { - reportDiagnostic(end, 0, TypeScript.DiagnosticCode._0_expected, ["`"]); - break; - } - var ch = str.charCodeAt(index); - index++; - if (ch === 96 /* backtick */) { - break; - } - if (ch === 36 /* $ */ && index < end && str.charCodeAt(index) === 123 /* openBrace */) { - index++; - return startedWithBacktick ? 14 /* TemplateStartToken */ : 15 /* TemplateMiddleToken */; - } - } - return startedWithBacktick ? 13 /* NoSubstitutionTemplateToken */ : 16 /* TemplateEndToken */; - } - function scanAmpersandToken() { - var character = str.charCodeAt(index); - if (character === 61 /* equals */) { - index++; - return 117 /* AmpersandEqualsToken */; - } - else if (character === 38 /* ampersand */) { - index++; - return 105 /* AmpersandAmpersandToken */; - } - else { - return 100 /* AmpersandToken */; - } - } - function scanPercentToken() { - if (str.charCodeAt(index) === 61 /* equals */) { - index++; - return 113 /* PercentEqualsToken */; - } - else { - return 94 /* PercentToken */; - } - } - function scanMinusToken() { - var character = str.charCodeAt(index); - if (character === 61 /* equals */) { - index++; - return 111 /* MinusEqualsToken */; - } - else if (character === 45 /* minus */) { - index++; - return 96 /* MinusMinusToken */; - } - else { - return 92 /* MinusToken */; - } - } - function scanPlusToken() { - var character = str.charCodeAt(index); - if (character === 61 /* equals */) { - index++; - return 110 /* PlusEqualsToken */; - } - else if (character === 43 /* plus */) { - index++; - return 95 /* PlusPlusToken */; - } - else { - return 91 /* PlusToken */; - } - } - function scanAsteriskToken() { - if (str.charCodeAt(index) === 61 /* equals */) { - index++; - return 112 /* AsteriskEqualsToken */; - } - else { - return 93 /* AsteriskToken */; - } - } - function scanEqualsToken() { - var character = str.charCodeAt(index); - if (character === 61 /* equals */) { - index++; - if (str.charCodeAt(index) === 61 /* equals */) { - index++; - return 89 /* EqualsEqualsEqualsToken */; - } - else { - return 86 /* EqualsEqualsToken */; - } - } - else if (character === 62 /* greaterThan */) { - index++; - return 87 /* EqualsGreaterThanToken */; - } - else { - return 109 /* EqualsToken */; - } - } - function scanDotToken() { - var nextChar = str.charCodeAt(index); - if (TypeScript.CharacterInfo.isDecimalDigit(nextChar)) { - scanDecimalNumericLiteralAfterDot(); - return 11 /* NumericLiteral */; - } - if (nextChar === 46 /* dot */ && str.charCodeAt(index + 1) === 46 /* dot */) { - index += 2; - return 79 /* DotDotDotToken */; - } - else { - return 78 /* DotToken */; - } - } - function scanSlashToken(allowContextualToken) { - if (allowContextualToken) { - var result = tryScanRegularExpressionToken(); - if (result !== 0 /* None */) { - return result; - } - } - if (str.charCodeAt(index) === 61 /* equals */) { - index++; - return 121 /* SlashEqualsToken */; - } - else { - return 120 /* SlashToken */; - } - } - function tryScanRegularExpressionToken() { - var startIndex = index; - var inEscape = false; - var inCharacterClass = false; - while (true) { - var ch = str.charCodeAt(index); - if (isNaN(ch) || isNewLineCharacter(ch)) { - index = startIndex; - return 0 /* None */; - } - index++; - if (inEscape) { - inEscape = false; - continue; - } - switch (ch) { - case 92 /* backslash */: - inEscape = true; - continue; - case 91 /* openBracket */: - inCharacterClass = true; - continue; - case 93 /* closeBracket */: - inCharacterClass = false; - continue; - case 47 /* slash */: - if (inCharacterClass) { - continue; - } - break; - default: - continue; - } - break; - } - while (isIdentifierPartCharacter[str.charCodeAt(index)]) { - index++; - } - return 10 /* RegularExpressionLiteral */; - } - function scanExclamationToken() { - if (str.charCodeAt(index) === 61 /* equals */) { - index++; - if (str.charCodeAt(index) === 61 /* equals */) { - index++; - return 90 /* ExclamationEqualsEqualsToken */; - } - else { - return 88 /* ExclamationEqualsToken */; - } - } - else { - return 103 /* ExclamationToken */; - } - } - function getErrorMessageText(text) { - if (text === "\\") { - return '"\\"'; - } - return JSON.stringify(text); - } - function skipEscapeSequence() { - var rewindPoint = index; - index++; - var ch = str.charCodeAt(index); - if (isNaN(ch)) { - return; - } - index++; - switch (ch) { - case 120 /* x */: - case 117 /* u */: - index = rewindPoint; - var value = scanUnicodeOrHexEscape(true); - break; - case 13 /* carriageReturn */: - if (str.charCodeAt(index) === 10 /* lineFeed */) { - index++; - } - break; - default: - break; - } - } - function scanStringLiteral(quoteCharacter) { - while (true) { - var ch = str.charCodeAt(index); - if (ch === 92 /* backslash */) { - skipEscapeSequence(); - } - else if (ch === quoteCharacter) { - index++; - break; - } - else if (isNaN(ch) || isNewLineCharacter(ch)) { - reportDiagnostic(Math.min(index, end), 1, TypeScript.DiagnosticCode.Missing_close_quote_character, undefined); - break; - } - else { - index++; - } - } - return 12 /* StringLiteral */; - } - function isUnicodeEscape(character) { - return character === 92 /* backslash */ && str.charCodeAt(index + 1) === 117 /* u */; - } - function peekCharOrUnicodeEscape() { - var character = str.charCodeAt(index); - if (isUnicodeEscape(character)) { - return peekUnicodeOrHexEscape(); - } - else { - return character; - } - } - function peekUnicodeOrHexEscape() { - var startIndex = index; - var ch = scanUnicodeOrHexEscape(false); - index = startIndex; - return ch; - } - function scanCharOrUnicodeEscape() { - if (str.charCodeAt(index) === 92 /* backslash */ && str.charCodeAt(index + 1) === 117 /* u */) { - scanUnicodeOrHexEscape(true); - } - else { - index++; - } - } - function scanUnicodeOrHexEscape(report) { - var start = index; - var character = str.charCodeAt(index); - index++; - character = str.charCodeAt(index); - var intChar = 0; - index++; - var count = character === 117 /* u */ ? 4 : 2; - for (var i = 0; i < count; i++) { - var ch2 = str.charCodeAt(index); - if (!TypeScript.CharacterInfo.isHexDigit(ch2)) { - if (report) { - reportDiagnostic(start, index - start, TypeScript.DiagnosticCode.Unrecognized_escape_sequence, undefined); - } - break; - } - intChar = (intChar << 4) + TypeScript.CharacterInfo.hexValue(ch2); - index++; - } - return intChar; - } - function fillTokenInfo(token, text, tokenInfo) { - var fullStart = token.fullStart(); - var fullEnd = fullStart + token.fullWidth(); - reset(text, fullStart, fullEnd); - scanTriviaInfo(false); - var start = index; - scanSyntaxKind(isContextualToken(token)); - var end = index; - tokenInfo.leadingTriviaWidth = start - fullStart; - tokenInfo.width = end - start; - } - reset(text, 0, text.length()); - return { - setIndex: setIndex, - scan: scan, - fillTokenInfo: fillTokenInfo, - scanTrivia: scanTrivia - }; - } - function isValidIdentifier(text, languageVersion) { - var hadError = false; - var scanner = createScanner(languageVersion, text, function () { return hadError = true; }); - var token = scanner.scan(false); - return !hadError && TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token) && TypeScript.width(token) === text.length(); - } - Scanner.isValidIdentifier = isValidIdentifier; - function createParserSource(fileName, text, languageVersion) { - var _absolutePosition = 0; - var _tokenDiagnostics = []; - var rewindPointPool = []; - var rewindPointPoolCount = 0; - var lastDiagnostic = undefined; - var reportDiagnostic = function (position, fullWidth, diagnosticKey, args) { - lastDiagnostic = new TypeScript.Diagnostic(fileName, text.lineMap(), position, fullWidth, diagnosticKey, args); - }; - var slidingWindow = new TypeScript.SlidingWindow(fetchNextItem, TypeScript.ArrayUtilities.createArray(1024, undefined), undefined); - var scanner = createScanner(languageVersion, text, reportDiagnostic); - function release() { - slidingWindow = undefined; - scanner = undefined; - _tokenDiagnostics = []; - rewindPointPool = []; - lastDiagnostic = undefined; - reportDiagnostic = undefined; - } - function currentNode() { - return undefined; - } - function consumeNode(node) { - throw TypeScript.Errors.invalidOperation(); - } - function absolutePosition() { - return _absolutePosition; - } - function tokenDiagnostics() { - return _tokenDiagnostics; - } - function getOrCreateRewindPoint() { - if (rewindPointPoolCount === 0) { - return {}; - } - rewindPointPoolCount--; - var result = rewindPointPool[rewindPointPoolCount]; - rewindPointPool[rewindPointPoolCount] = undefined; - return result; - } - function getRewindPoint() { - var slidingWindowIndex = slidingWindow.getAndPinAbsoluteIndex(); - var rewindPoint = getOrCreateRewindPoint(); - rewindPoint.slidingWindowIndex = slidingWindowIndex; - rewindPoint.absolutePosition = _absolutePosition; - return rewindPoint; - } - function rewind(rewindPoint) { - slidingWindow.rewindToPinnedIndex(rewindPoint.slidingWindowIndex); - _absolutePosition = rewindPoint.absolutePosition; - } - function releaseRewindPoint(rewindPoint) { - slidingWindow.releaseAndUnpinAbsoluteIndex(rewindPoint.absoluteIndex); - rewindPointPool[rewindPointPoolCount] = rewindPoint; - rewindPointPoolCount++; - } - function fetchNextItem(allowContextualToken) { - var token = scanner.scan(allowContextualToken); - if (lastDiagnostic === undefined) { - return token; - } - _tokenDiagnostics.push(lastDiagnostic); - lastDiagnostic = undefined; - return TypeScript.Syntax.realizeToken(token, text); - } - function peekToken(n) { - return slidingWindow.peekItemN(n); - } - function consumeToken(token) { - _absolutePosition += token.fullWidth(); - slidingWindow.moveToNextItem(); - } - function currentToken() { - return slidingWindow.currentItem(false); - } - function removeDiagnosticsOnOrAfterPosition(position) { - var tokenDiagnosticsLength = _tokenDiagnostics.length; - while (tokenDiagnosticsLength > 0) { - var diagnostic = _tokenDiagnostics[tokenDiagnosticsLength - 1]; - if (diagnostic.start() >= position) { - tokenDiagnosticsLength--; - _tokenDiagnostics.pop(); - } - else { - break; - } - } - } - function resetToPosition(absolutePosition) { - TypeScript.Debug.assert(absolutePosition <= text.length(), "Trying to set the position outside the bounds of the text!"); - _absolutePosition = absolutePosition; - removeDiagnosticsOnOrAfterPosition(absolutePosition); - slidingWindow.disgardAllItemsFromCurrentIndexOnwards(); - scanner.setIndex(absolutePosition); - } - function currentContextualToken() { - resetToPosition(_absolutePosition); - var token = slidingWindow.currentItem(true); - return token; - } - return { - text: text, - fileName: fileName, - languageVersion: languageVersion, - currentNode: currentNode, - currentToken: currentToken, - currentContextualToken: currentContextualToken, - peekToken: peekToken, - consumeNode: consumeNode, - consumeToken: consumeToken, - getRewindPoint: getRewindPoint, - rewind: rewind, - releaseRewindPoint: releaseRewindPoint, - tokenDiagnostics: tokenDiagnostics, - release: release, - absolutePosition: absolutePosition, - resetToPosition: resetToPosition - }; - } - Scanner.createParserSource = createParserSource; - function fixedWidthTokenLength(kind) { - switch (kind) { - case 17 /* BreakKeyword */: return 5; - case 18 /* CaseKeyword */: return 4; - case 19 /* CatchKeyword */: return 5; - case 20 /* ContinueKeyword */: return 8; - case 21 /* DebuggerKeyword */: return 8; - case 22 /* DefaultKeyword */: return 7; - case 23 /* DeleteKeyword */: return 6; - case 24 /* DoKeyword */: return 2; - case 25 /* ElseKeyword */: return 4; - case 26 /* FalseKeyword */: return 5; - case 27 /* FinallyKeyword */: return 7; - case 28 /* ForKeyword */: return 3; - case 29 /* FunctionKeyword */: return 8; - case 30 /* IfKeyword */: return 2; - case 31 /* InKeyword */: return 2; - case 32 /* InstanceOfKeyword */: return 10; - case 33 /* NewKeyword */: return 3; - case 34 /* NullKeyword */: return 4; - case 35 /* ReturnKeyword */: return 6; - case 36 /* SwitchKeyword */: return 6; - case 37 /* ThisKeyword */: return 4; - case 38 /* ThrowKeyword */: return 5; - case 39 /* TrueKeyword */: return 4; - case 40 /* TryKeyword */: return 3; - case 41 /* TypeOfKeyword */: return 6; - case 42 /* VarKeyword */: return 3; - case 43 /* VoidKeyword */: return 4; - case 44 /* WhileKeyword */: return 5; - case 45 /* WithKeyword */: return 4; - case 46 /* ClassKeyword */: return 5; - case 47 /* ConstKeyword */: return 5; - case 48 /* EnumKeyword */: return 4; - case 49 /* ExportKeyword */: return 6; - case 50 /* ExtendsKeyword */: return 7; - case 51 /* ImportKeyword */: return 6; - case 52 /* SuperKeyword */: return 5; - case 53 /* ImplementsKeyword */: return 10; - case 54 /* InterfaceKeyword */: return 9; - case 55 /* LetKeyword */: return 3; - case 56 /* PackageKeyword */: return 7; - case 57 /* PrivateKeyword */: return 7; - case 58 /* ProtectedKeyword */: return 9; - case 59 /* PublicKeyword */: return 6; - case 60 /* StaticKeyword */: return 6; - case 61 /* YieldKeyword */: return 5; - case 62 /* AnyKeyword */: return 3; - case 63 /* BooleanKeyword */: return 7; - case 64 /* ConstructorKeyword */: return 11; - case 65 /* DeclareKeyword */: return 7; - case 66 /* GetKeyword */: return 3; - case 67 /* ModuleKeyword */: return 6; - case 68 /* RequireKeyword */: return 7; - case 69 /* NumberKeyword */: return 6; - case 70 /* SetKeyword */: return 3; - case 71 /* StringKeyword */: return 6; - case 72 /* OpenBraceToken */: return 1; - case 73 /* CloseBraceToken */: return 1; - case 74 /* OpenParenToken */: return 1; - case 75 /* CloseParenToken */: return 1; - case 76 /* OpenBracketToken */: return 1; - case 77 /* CloseBracketToken */: return 1; - case 78 /* DotToken */: return 1; - case 79 /* DotDotDotToken */: return 3; - case 80 /* SemicolonToken */: return 1; - case 81 /* CommaToken */: return 1; - case 82 /* LessThanToken */: return 1; - case 83 /* GreaterThanToken */: return 1; - case 84 /* LessThanEqualsToken */: return 2; - case 85 /* GreaterThanEqualsToken */: return 2; - case 86 /* EqualsEqualsToken */: return 2; - case 87 /* EqualsGreaterThanToken */: return 2; - case 88 /* ExclamationEqualsToken */: return 2; - case 89 /* EqualsEqualsEqualsToken */: return 3; - case 90 /* ExclamationEqualsEqualsToken */: return 3; - case 91 /* PlusToken */: return 1; - case 92 /* MinusToken */: return 1; - case 93 /* AsteriskToken */: return 1; - case 94 /* PercentToken */: return 1; - case 95 /* PlusPlusToken */: return 2; - case 96 /* MinusMinusToken */: return 2; - case 97 /* LessThanLessThanToken */: return 2; - case 98 /* GreaterThanGreaterThanToken */: return 2; - case 99 /* GreaterThanGreaterThanGreaterThanToken */: return 3; - case 100 /* AmpersandToken */: return 1; - case 101 /* BarToken */: return 1; - case 102 /* CaretToken */: return 1; - case 103 /* ExclamationToken */: return 1; - case 104 /* TildeToken */: return 1; - case 105 /* AmpersandAmpersandToken */: return 2; - case 106 /* BarBarToken */: return 2; - case 107 /* QuestionToken */: return 1; - case 108 /* ColonToken */: return 1; - case 109 /* EqualsToken */: return 1; - case 110 /* PlusEqualsToken */: return 2; - case 111 /* MinusEqualsToken */: return 2; - case 112 /* AsteriskEqualsToken */: return 2; - case 113 /* PercentEqualsToken */: return 2; - case 114 /* LessThanLessThanEqualsToken */: return 3; - case 115 /* GreaterThanGreaterThanEqualsToken */: return 3; - case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 4; - case 117 /* AmpersandEqualsToken */: return 2; - case 118 /* BarEqualsToken */: return 2; - case 119 /* CaretEqualsToken */: return 2; - case 120 /* SlashToken */: return 1; - case 121 /* SlashEqualsToken */: return 2; - default: throw new Error(); - } - } - })(Scanner = TypeScript.Scanner || (TypeScript.Scanner = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ScannerUtilities; - (function (ScannerUtilities) { - function fixedWidthTokenLength(kind) { - switch (kind) { - case 17 /* BreakKeyword */: return 5; - case 18 /* CaseKeyword */: return 4; - case 19 /* CatchKeyword */: return 5; - case 20 /* ContinueKeyword */: return 8; - case 21 /* DebuggerKeyword */: return 8; - case 22 /* DefaultKeyword */: return 7; - case 23 /* DeleteKeyword */: return 6; - case 24 /* DoKeyword */: return 2; - case 25 /* ElseKeyword */: return 4; - case 26 /* FalseKeyword */: return 5; - case 27 /* FinallyKeyword */: return 7; - case 28 /* ForKeyword */: return 3; - case 29 /* FunctionKeyword */: return 8; - case 30 /* IfKeyword */: return 2; - case 31 /* InKeyword */: return 2; - case 32 /* InstanceOfKeyword */: return 10; - case 33 /* NewKeyword */: return 3; - case 34 /* NullKeyword */: return 4; - case 35 /* ReturnKeyword */: return 6; - case 36 /* SwitchKeyword */: return 6; - case 37 /* ThisKeyword */: return 4; - case 38 /* ThrowKeyword */: return 5; - case 39 /* TrueKeyword */: return 4; - case 40 /* TryKeyword */: return 3; - case 41 /* TypeOfKeyword */: return 6; - case 42 /* VarKeyword */: return 3; - case 43 /* VoidKeyword */: return 4; - case 44 /* WhileKeyword */: return 5; - case 45 /* WithKeyword */: return 4; - case 46 /* ClassKeyword */: return 5; - case 47 /* ConstKeyword */: return 5; - case 48 /* EnumKeyword */: return 4; - case 49 /* ExportKeyword */: return 6; - case 50 /* ExtendsKeyword */: return 7; - case 51 /* ImportKeyword */: return 6; - case 52 /* SuperKeyword */: return 5; - case 53 /* ImplementsKeyword */: return 10; - case 54 /* InterfaceKeyword */: return 9; - case 55 /* LetKeyword */: return 3; - case 56 /* PackageKeyword */: return 7; - case 57 /* PrivateKeyword */: return 7; - case 58 /* ProtectedKeyword */: return 9; - case 59 /* PublicKeyword */: return 6; - case 60 /* StaticKeyword */: return 6; - case 61 /* YieldKeyword */: return 5; - case 62 /* AnyKeyword */: return 3; - case 63 /* BooleanKeyword */: return 7; - case 64 /* ConstructorKeyword */: return 11; - case 65 /* DeclareKeyword */: return 7; - case 66 /* GetKeyword */: return 3; - case 67 /* ModuleKeyword */: return 6; - case 68 /* RequireKeyword */: return 7; - case 69 /* NumberKeyword */: return 6; - case 70 /* SetKeyword */: return 3; - case 71 /* StringKeyword */: return 6; - case 72 /* OpenBraceToken */: return 1; - case 73 /* CloseBraceToken */: return 1; - case 74 /* OpenParenToken */: return 1; - case 75 /* CloseParenToken */: return 1; - case 76 /* OpenBracketToken */: return 1; - case 77 /* CloseBracketToken */: return 1; - case 78 /* DotToken */: return 1; - case 79 /* DotDotDotToken */: return 3; - case 80 /* SemicolonToken */: return 1; - case 81 /* CommaToken */: return 1; - case 82 /* LessThanToken */: return 1; - case 83 /* GreaterThanToken */: return 1; - case 84 /* LessThanEqualsToken */: return 2; - case 85 /* GreaterThanEqualsToken */: return 2; - case 86 /* EqualsEqualsToken */: return 2; - case 87 /* EqualsGreaterThanToken */: return 2; - case 88 /* ExclamationEqualsToken */: return 2; - case 89 /* EqualsEqualsEqualsToken */: return 3; - case 90 /* ExclamationEqualsEqualsToken */: return 3; - case 91 /* PlusToken */: return 1; - case 92 /* MinusToken */: return 1; - case 93 /* AsteriskToken */: return 1; - case 94 /* PercentToken */: return 1; - case 95 /* PlusPlusToken */: return 2; - case 96 /* MinusMinusToken */: return 2; - case 97 /* LessThanLessThanToken */: return 2; - case 98 /* GreaterThanGreaterThanToken */: return 2; - case 99 /* GreaterThanGreaterThanGreaterThanToken */: return 3; - case 100 /* AmpersandToken */: return 1; - case 101 /* BarToken */: return 1; - case 102 /* CaretToken */: return 1; - case 103 /* ExclamationToken */: return 1; - case 104 /* TildeToken */: return 1; - case 105 /* AmpersandAmpersandToken */: return 2; - case 106 /* BarBarToken */: return 2; - case 107 /* QuestionToken */: return 1; - case 108 /* ColonToken */: return 1; - case 109 /* EqualsToken */: return 1; - case 110 /* PlusEqualsToken */: return 2; - case 111 /* MinusEqualsToken */: return 2; - case 112 /* AsteriskEqualsToken */: return 2; - case 113 /* PercentEqualsToken */: return 2; - case 114 /* LessThanLessThanEqualsToken */: return 3; - case 115 /* GreaterThanGreaterThanEqualsToken */: return 3; - case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 4; - case 117 /* AmpersandEqualsToken */: return 2; - case 118 /* BarEqualsToken */: return 2; - case 119 /* CaretEqualsToken */: return 2; - case 120 /* SlashToken */: return 1; - case 121 /* SlashEqualsToken */: return 2; - default: throw new Error(); - } - } - ScannerUtilities.fixedWidthTokenLength = fixedWidthTokenLength; - function identifierKind(str, start, length) { - switch (length) { - case 2: - switch (str.charCodeAt(start)) { - case 100 /* d */: return (str.charCodeAt(start + 1) === 111 /* o */) ? 24 /* DoKeyword */ : 9 /* IdentifierName */; - case 105 /* i */: - switch (str.charCodeAt(start + 1)) { - case 102 /* f */: return 30 /* IfKeyword */; - case 110 /* n */: return 31 /* InKeyword */; - default: return 9 /* IdentifierName */; - } - default: return 9 /* IdentifierName */; - } - case 3: - switch (str.charCodeAt(start)) { - case 97 /* a */: return (str.charCodeAt(start + 1) === 110 /* n */ && str.charCodeAt(start + 2) === 121 /* y */) ? 62 /* AnyKeyword */ : 9 /* IdentifierName */; - case 102 /* f */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 114 /* r */) ? 28 /* ForKeyword */ : 9 /* IdentifierName */; - case 103 /* g */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */) ? 66 /* GetKeyword */ : 9 /* IdentifierName */; - case 108 /* l */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */) ? 55 /* LetKeyword */ : 9 /* IdentifierName */; - case 110 /* n */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 119 /* w */) ? 33 /* NewKeyword */ : 9 /* IdentifierName */; - case 115 /* s */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */) ? 70 /* SetKeyword */ : 9 /* IdentifierName */; - case 116 /* t */: return (str.charCodeAt(start + 1) === 114 /* r */ && str.charCodeAt(start + 2) === 121 /* y */) ? 40 /* TryKeyword */ : 9 /* IdentifierName */; - case 118 /* v */: return (str.charCodeAt(start + 1) === 97 /* a */ && str.charCodeAt(start + 2) === 114 /* r */) ? 42 /* VarKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 4: - switch (str.charCodeAt(start)) { - case 99 /* c */: return (str.charCodeAt(start + 1) === 97 /* a */ && str.charCodeAt(start + 2) === 115 /* s */ && str.charCodeAt(start + 3) === 101 /* e */) ? 18 /* CaseKeyword */ : 9 /* IdentifierName */; - case 101 /* e */: - switch (str.charCodeAt(start + 1)) { - case 108 /* l */: return (str.charCodeAt(start + 2) === 115 /* s */ && str.charCodeAt(start + 3) === 101 /* e */) ? 25 /* ElseKeyword */ : 9 /* IdentifierName */; - case 110 /* n */: return (str.charCodeAt(start + 2) === 117 /* u */ && str.charCodeAt(start + 3) === 109 /* m */) ? 48 /* EnumKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 110 /* n */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 108 /* l */ && str.charCodeAt(start + 3) === 108 /* l */) ? 34 /* NullKeyword */ : 9 /* IdentifierName */; - case 116 /* t */: - switch (str.charCodeAt(start + 1)) { - case 104 /* h */: return (str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 115 /* s */) ? 37 /* ThisKeyword */ : 9 /* IdentifierName */; - case 114 /* r */: return (str.charCodeAt(start + 2) === 117 /* u */ && str.charCodeAt(start + 3) === 101 /* e */) ? 39 /* TrueKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 118 /* v */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 100 /* d */) ? 43 /* VoidKeyword */ : 9 /* IdentifierName */; - case 119 /* w */: return (str.charCodeAt(start + 1) === 105 /* i */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 104 /* h */) ? 45 /* WithKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 5: - switch (str.charCodeAt(start)) { - case 98 /* b */: return (str.charCodeAt(start + 1) === 114 /* r */ && str.charCodeAt(start + 2) === 101 /* e */ && str.charCodeAt(start + 3) === 97 /* a */ && str.charCodeAt(start + 4) === 107 /* k */) ? 17 /* BreakKeyword */ : 9 /* IdentifierName */; - case 99 /* c */: - switch (str.charCodeAt(start + 1)) { - case 97 /* a */: return (str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 99 /* c */ && str.charCodeAt(start + 4) === 104 /* h */) ? 19 /* CatchKeyword */ : 9 /* IdentifierName */; - case 108 /* l */: return (str.charCodeAt(start + 2) === 97 /* a */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 115 /* s */) ? 46 /* ClassKeyword */ : 9 /* IdentifierName */; - case 111 /* o */: return (str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 116 /* t */) ? 47 /* ConstKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 102 /* f */: return (str.charCodeAt(start + 1) === 97 /* a */ && str.charCodeAt(start + 2) === 108 /* l */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 101 /* e */) ? 26 /* FalseKeyword */ : 9 /* IdentifierName */; - case 115 /* s */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 114 /* r */) ? 52 /* SuperKeyword */ : 9 /* IdentifierName */; - case 116 /* t */: return (str.charCodeAt(start + 1) === 104 /* h */ && str.charCodeAt(start + 2) === 114 /* r */ && str.charCodeAt(start + 3) === 111 /* o */ && str.charCodeAt(start + 4) === 119 /* w */) ? 38 /* ThrowKeyword */ : 9 /* IdentifierName */; - case 119 /* w */: return (str.charCodeAt(start + 1) === 104 /* h */ && str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 101 /* e */) ? 44 /* WhileKeyword */ : 9 /* IdentifierName */; - case 121 /* y */: return (str.charCodeAt(start + 1) === 105 /* i */ && str.charCodeAt(start + 2) === 101 /* e */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 100 /* d */) ? 61 /* YieldKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 6: - switch (str.charCodeAt(start)) { - case 100 /* d */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 108 /* l */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 116 /* t */ && str.charCodeAt(start + 5) === 101 /* e */) ? 23 /* DeleteKeyword */ : 9 /* IdentifierName */; - case 101 /* e */: return (str.charCodeAt(start + 1) === 120 /* x */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 111 /* o */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 116 /* t */) ? 49 /* ExportKeyword */ : 9 /* IdentifierName */; - case 105 /* i */: return (str.charCodeAt(start + 1) === 109 /* m */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 111 /* o */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 116 /* t */) ? 51 /* ImportKeyword */ : 9 /* IdentifierName */; - case 109 /* m */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 100 /* d */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 108 /* l */ && str.charCodeAt(start + 5) === 101 /* e */) ? 67 /* ModuleKeyword */ : 9 /* IdentifierName */; - case 110 /* n */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 109 /* m */ && str.charCodeAt(start + 3) === 98 /* b */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 114 /* r */) ? 69 /* NumberKeyword */ : 9 /* IdentifierName */; - case 112 /* p */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 98 /* b */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 99 /* c */) ? 59 /* PublicKeyword */ : 9 /* IdentifierName */; - case 114 /* r */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 110 /* n */) ? 35 /* ReturnKeyword */ : 9 /* IdentifierName */; - case 115 /* s */: - switch (str.charCodeAt(start + 1)) { - case 116 /* t */: - switch (str.charCodeAt(start + 2)) { - case 97 /* a */: return (str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 99 /* c */) ? 60 /* StaticKeyword */ : 9 /* IdentifierName */; - case 114 /* r */: return (str.charCodeAt(start + 3) === 105 /* i */ && str.charCodeAt(start + 4) === 110 /* n */ && str.charCodeAt(start + 5) === 103 /* g */) ? 71 /* StringKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 119 /* w */: return (str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 99 /* c */ && str.charCodeAt(start + 5) === 104 /* h */) ? 36 /* SwitchKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 116 /* t */: return (str.charCodeAt(start + 1) === 121 /* y */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 111 /* o */ && str.charCodeAt(start + 5) === 102 /* f */) ? 41 /* TypeOfKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 7: - switch (str.charCodeAt(start)) { - case 98 /* b */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 111 /* o */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 97 /* a */ && str.charCodeAt(start + 6) === 110 /* n */) ? 63 /* BooleanKeyword */ : 9 /* IdentifierName */; - case 100 /* d */: - switch (str.charCodeAt(start + 1)) { - case 101 /* e */: - switch (str.charCodeAt(start + 2)) { - case 99 /* c */: return (str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 114 /* r */ && str.charCodeAt(start + 6) === 101 /* e */) ? 65 /* DeclareKeyword */ : 9 /* IdentifierName */; - case 102 /* f */: return (str.charCodeAt(start + 3) === 97 /* a */ && str.charCodeAt(start + 4) === 117 /* u */ && str.charCodeAt(start + 5) === 108 /* l */ && str.charCodeAt(start + 6) === 116 /* t */) ? 22 /* DefaultKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - default: return 9 /* IdentifierName */; - } - case 101 /* e */: return (str.charCodeAt(start + 1) === 120 /* x */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 110 /* n */ && str.charCodeAt(start + 5) === 100 /* d */ && str.charCodeAt(start + 6) === 115 /* s */) ? 50 /* ExtendsKeyword */ : 9 /* IdentifierName */; - case 102 /* f */: return (str.charCodeAt(start + 1) === 105 /* i */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 97 /* a */ && str.charCodeAt(start + 4) === 108 /* l */ && str.charCodeAt(start + 5) === 108 /* l */ && str.charCodeAt(start + 6) === 121 /* y */) ? 27 /* FinallyKeyword */ : 9 /* IdentifierName */; - case 112 /* p */: - switch (str.charCodeAt(start + 1)) { - case 97 /* a */: return (str.charCodeAt(start + 2) === 99 /* c */ && str.charCodeAt(start + 3) === 107 /* k */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 103 /* g */ && str.charCodeAt(start + 6) === 101 /* e */) ? 56 /* PackageKeyword */ : 9 /* IdentifierName */; - case 114 /* r */: return (str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 118 /* v */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 116 /* t */ && str.charCodeAt(start + 6) === 101 /* e */) ? 57 /* PrivateKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 114 /* r */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 113 /* q */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 114 /* r */ && str.charCodeAt(start + 6) === 101 /* e */) ? 68 /* RequireKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 8: - switch (str.charCodeAt(start)) { - case 99 /* c */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 110 /* n */ && str.charCodeAt(start + 6) === 117 /* u */ && str.charCodeAt(start + 7) === 101 /* e */) ? 20 /* ContinueKeyword */ : 9 /* IdentifierName */; - case 100 /* d */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 98 /* b */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 103 /* g */ && str.charCodeAt(start + 5) === 103 /* g */ && str.charCodeAt(start + 6) === 101 /* e */ && str.charCodeAt(start + 7) === 114 /* r */) ? 21 /* DebuggerKeyword */ : 9 /* IdentifierName */; - case 102 /* f */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 99 /* c */ && str.charCodeAt(start + 4) === 116 /* t */ && str.charCodeAt(start + 5) === 105 /* i */ && str.charCodeAt(start + 6) === 111 /* o */ && str.charCodeAt(start + 7) === 110 /* n */) ? 29 /* FunctionKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 9: - switch (str.charCodeAt(start)) { - case 105 /* i */: return (str.charCodeAt(start + 1) === 110 /* n */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 102 /* f */ && str.charCodeAt(start + 6) === 97 /* a */ && str.charCodeAt(start + 7) === 99 /* c */ && str.charCodeAt(start + 8) === 101 /* e */) ? 54 /* InterfaceKeyword */ : 9 /* IdentifierName */; - case 112 /* p */: return (str.charCodeAt(start + 1) === 114 /* r */ && str.charCodeAt(start + 2) === 111 /* o */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 99 /* c */ && str.charCodeAt(start + 6) === 116 /* t */ && str.charCodeAt(start + 7) === 101 /* e */ && str.charCodeAt(start + 8) === 100 /* d */) ? 58 /* ProtectedKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - case 10: - switch (str.charCodeAt(start)) { - case 105 /* i */: - switch (str.charCodeAt(start + 1)) { - case 109 /* m */: return (str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 109 /* m */ && str.charCodeAt(start + 6) === 101 /* e */ && str.charCodeAt(start + 7) === 110 /* n */ && str.charCodeAt(start + 8) === 116 /* t */ && str.charCodeAt(start + 9) === 115 /* s */) ? 53 /* ImplementsKeyword */ : 9 /* IdentifierName */; - case 110 /* n */: return (str.charCodeAt(start + 2) === 115 /* s */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 110 /* n */ && str.charCodeAt(start + 6) === 99 /* c */ && str.charCodeAt(start + 7) === 101 /* e */ && str.charCodeAt(start + 8) === 111 /* o */ && str.charCodeAt(start + 9) === 102 /* f */) ? 32 /* InstanceOfKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - default: return 9 /* IdentifierName */; - } - case 11: return (str.charCodeAt(start) === 99 /* c */ && str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 116 /* t */ && str.charCodeAt(start + 5) === 114 /* r */ && str.charCodeAt(start + 6) === 117 /* u */ && str.charCodeAt(start + 7) === 99 /* c */ && str.charCodeAt(start + 8) === 116 /* t */ && str.charCodeAt(start + 9) === 111 /* o */ && str.charCodeAt(start + 10) === 114 /* r */) ? 64 /* ConstructorKeyword */ : 9 /* IdentifierName */; - default: return 9 /* IdentifierName */; - } - } - ScannerUtilities.identifierKind = identifierKind; - })(ScannerUtilities = TypeScript.ScannerUtilities || (TypeScript.ScannerUtilities = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SlidingWindow = (function () { - function SlidingWindow(fetchNextItem, window, defaultValue, sourceLength) { - if (sourceLength === void 0) { sourceLength = -1; } - this.fetchNextItem = fetchNextItem; - this.window = window; - this.defaultValue = defaultValue; - this.sourceLength = sourceLength; - this.windowCount = 0; - this.windowAbsoluteStartIndex = 0; - this.currentRelativeItemIndex = 0; - this._pinCount = 0; - this.firstPinnedAbsoluteIndex = -1; - } - SlidingWindow.prototype.addMoreItemsToWindow = function (argument) { - var sourceLength = this.sourceLength; - if (sourceLength >= 0 && this.absoluteIndex() >= sourceLength) { - return false; - } - if (this.windowCount >= this.window.length) { - this.tryShiftOrGrowWindow(); - } - var item = this.fetchNextItem(argument); - this.window[this.windowCount] = item; - this.windowCount++; - return true; - }; - SlidingWindow.prototype.tryShiftOrGrowWindow = function () { - var currentIndexIsPastWindowHalfwayPoint = this.currentRelativeItemIndex > (this.window.length >>> 1); - var isAllowedToShift = this.firstPinnedAbsoluteIndex === -1 || this.firstPinnedAbsoluteIndex > this.windowAbsoluteStartIndex; - if (currentIndexIsPastWindowHalfwayPoint && isAllowedToShift) { - var shiftStartIndex = this.firstPinnedAbsoluteIndex === -1 ? this.currentRelativeItemIndex : this.firstPinnedAbsoluteIndex - this.windowAbsoluteStartIndex; - var shiftCount = this.windowCount - shiftStartIndex; - if (shiftCount > 0) { - TypeScript.ArrayUtilities.copy(this.window, shiftStartIndex, this.window, 0, shiftCount); - } - this.windowAbsoluteStartIndex += shiftStartIndex; - this.windowCount -= shiftStartIndex; - this.currentRelativeItemIndex -= shiftStartIndex; - } - else { - TypeScript.ArrayUtilities.grow(this.window, this.window.length * 2, this.defaultValue); - } - }; - SlidingWindow.prototype.absoluteIndex = function () { - return this.windowAbsoluteStartIndex + this.currentRelativeItemIndex; - }; - SlidingWindow.prototype.isAtEndOfSource = function () { - return this.absoluteIndex() >= this.sourceLength; - }; - SlidingWindow.prototype.getAndPinAbsoluteIndex = function () { - var absoluteIndex = this.absoluteIndex(); - var pinCount = this._pinCount++; - if (pinCount === 0) { - this.firstPinnedAbsoluteIndex = absoluteIndex; - } - return absoluteIndex; - }; - SlidingWindow.prototype.releaseAndUnpinAbsoluteIndex = function (absoluteIndex) { - this._pinCount--; - if (this._pinCount === 0) { - this.firstPinnedAbsoluteIndex = -1; - } - }; - SlidingWindow.prototype.rewindToPinnedIndex = function (absoluteIndex) { - var relativeIndex = absoluteIndex - this.windowAbsoluteStartIndex; - this.currentRelativeItemIndex = relativeIndex; - }; - SlidingWindow.prototype.currentItem = function (argument) { - if (this.currentRelativeItemIndex >= this.windowCount) { - if (!this.addMoreItemsToWindow(argument)) { - return this.defaultValue; - } - } - return this.window[this.currentRelativeItemIndex]; - }; - SlidingWindow.prototype.peekItemN = function (n) { - while (this.currentRelativeItemIndex + n >= this.windowCount) { - if (!this.addMoreItemsToWindow(undefined)) { - return this.defaultValue; - } - } - return this.window[this.currentRelativeItemIndex + n]; - }; - SlidingWindow.prototype.moveToNextItem = function () { - this.currentRelativeItemIndex++; - }; - SlidingWindow.prototype.disgardAllItemsFromCurrentIndexOnwards = function () { - this.windowCount = this.currentRelativeItemIndex; - }; - return SlidingWindow; - })(); - TypeScript.SlidingWindow = SlidingWindow; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Syntax; - (function (Syntax) { - Syntax._nextSyntaxID = 1; - function nodeHasSkippedOrMissingTokens(node) { - for (var i = 0; i < TypeScript.childCount(node); i++) { - var child = TypeScript.childAt(node, i); - if (TypeScript.isToken(child)) { - var token = child; - if (token.hasSkippedToken() || (TypeScript.width(token) === 0 && token.kind() !== 8 /* EndOfFileToken */)) { - return true; - } - } - } - return false; - } - Syntax.nodeHasSkippedOrMissingTokens = nodeHasSkippedOrMissingTokens; - function isUnterminatedStringLiteral(token) { - if (token && token.kind() === 12 /* StringLiteral */) { - var text = token.text(); - return text.length < 2 || text.charCodeAt(text.length - 1) !== text.charCodeAt(0); - } - return false; - } - Syntax.isUnterminatedStringLiteral = isUnterminatedStringLiteral; - function isUnterminatedMultilineCommentTrivia(trivia) { - if (trivia && trivia.kind() === 4 /* MultiLineCommentTrivia */) { - var text = trivia.fullText(); - return text.length < 4 || text.substring(text.length - 2) !== "*/"; - } - return false; - } - Syntax.isUnterminatedMultilineCommentTrivia = isUnterminatedMultilineCommentTrivia; - function isEntirelyInsideCommentTrivia(trivia, fullStart, position) { - if (trivia && trivia.isComment() && position > fullStart) { - var end = fullStart + trivia.fullWidth(); - if (position < end) { - return true; - } - else if (position === end) { - return trivia.kind() === 5 /* SingleLineCommentTrivia */ || isUnterminatedMultilineCommentTrivia(trivia); - } - } - return false; - } - Syntax.isEntirelyInsideCommentTrivia = isEntirelyInsideCommentTrivia; - function isEntirelyInsideComment(sourceUnit, position) { - var positionedToken = TypeScript.findToken(sourceUnit, position); - var fullStart = positionedToken.fullStart(); - var triviaList = undefined; - var lastTriviaBeforeToken = undefined; - if (positionedToken.kind() === 8 /* EndOfFileToken */) { - if (positionedToken.hasLeadingTrivia()) { - triviaList = positionedToken.leadingTrivia(); - } - else { - positionedToken = TypeScript.previousToken(positionedToken); - if (positionedToken) { - if (positionedToken && positionedToken.hasTrailingTrivia()) { - triviaList = positionedToken.trailingTrivia(); - fullStart = TypeScript.end(positionedToken); - } - } - } - } - else { - if (position <= (fullStart + positionedToken.leadingTriviaWidth())) { - triviaList = positionedToken.leadingTrivia(); - } - else if (position >= (fullStart + TypeScript.width(positionedToken))) { - triviaList = positionedToken.trailingTrivia(); - fullStart = TypeScript.end(positionedToken); - } - } - if (triviaList) { - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - if (position <= fullStart) { - break; - } - else if (position <= fullStart + trivia.fullWidth() && trivia.isComment()) { - lastTriviaBeforeToken = trivia; - break; - } - fullStart += trivia.fullWidth(); - } - } - return lastTriviaBeforeToken && isEntirelyInsideCommentTrivia(lastTriviaBeforeToken, fullStart, position); - } - Syntax.isEntirelyInsideComment = isEntirelyInsideComment; - function isEntirelyInStringOrRegularExpressionLiteral(sourceUnit, position) { - var positionedToken = TypeScript.findToken(sourceUnit, position); - if (positionedToken) { - if (positionedToken.kind() === 8 /* EndOfFileToken */) { - positionedToken = TypeScript.previousToken(positionedToken); - return positionedToken && positionedToken.trailingTriviaWidth() === 0 && isUnterminatedStringLiteral(positionedToken); - } - else if (position > TypeScript.start(positionedToken)) { - return (position < TypeScript.end(positionedToken) && (positionedToken.kind() === 12 /* StringLiteral */ || positionedToken.kind() === 10 /* RegularExpressionLiteral */)) || (position <= TypeScript.end(positionedToken) && isUnterminatedStringLiteral(positionedToken)); - } - } - return false; - } - Syntax.isEntirelyInStringOrRegularExpressionLiteral = isEntirelyInStringOrRegularExpressionLiteral; - function getAncestorOfKind(positionedToken, kind) { - while (positionedToken && positionedToken.parent) { - if (positionedToken.parent.kind() === kind) { - return positionedToken.parent; - } - positionedToken = positionedToken.parent; - } - return undefined; - } - Syntax.getAncestorOfKind = getAncestorOfKind; - function hasAncestorOfKind(positionedToken, kind) { - return !!getAncestorOfKind(positionedToken, kind); - } - Syntax.hasAncestorOfKind = hasAncestorOfKind; - function isIntegerLiteral(expression) { - if (expression) { - switch (expression.kind()) { - case 169 /* PrefixUnaryExpression */: - var prefixExpr = expression; - if (prefixExpr.operatorToken.kind() == 91 /* PlusToken */ || prefixExpr.operatorToken.kind() === 92 /* MinusToken */) { - expression = prefixExpr.operand; - return TypeScript.isToken(expression) && TypeScript.IntegerUtilities.isInteger(expression.text()); - } - return false; - case 11 /* NumericLiteral */: - var text = expression.text(); - return TypeScript.IntegerUtilities.isInteger(text) || TypeScript.IntegerUtilities.isHexInteger(text); - } - } - return false; - } - Syntax.isIntegerLiteral = isIntegerLiteral; - function containingNode(element) { - var current = element.parent; - while (current && !TypeScript.isNode(current)) { - current = current.parent; - } - return current; - } - Syntax.containingNode = containingNode; - function findTokenOnLeft(sourceUnit, position) { - var positionedToken = TypeScript.findToken(sourceUnit, position); - var _start = TypeScript.start(positionedToken); - if (position > _start) { - return positionedToken; - } - if (positionedToken.fullStart() === 0) { - return undefined; - } - return TypeScript.previousToken(positionedToken); - } - Syntax.findTokenOnLeft = findTokenOnLeft; - function findCompleteTokenOnLeft(sourceUnit, position) { - var positionedToken = TypeScript.findToken(sourceUnit, position); - if (TypeScript.width(positionedToken) > 0 && position >= TypeScript.end(positionedToken)) { - return positionedToken; - } - return TypeScript.previousToken(positionedToken); - } - Syntax.findCompleteTokenOnLeft = findCompleteTokenOnLeft; - function firstTokenInLineContainingPosition(syntaxTree, position) { - var current = TypeScript.findToken(syntaxTree.sourceUnit(), position); - while (true) { - if (isFirstTokenInLine(current, syntaxTree.lineMap())) { - break; - } - current = TypeScript.previousToken(current); - } - return current; - } - Syntax.firstTokenInLineContainingPosition = firstTokenInLineContainingPosition; - function isFirstTokenInLine(token, lineMap) { - var _previousToken = TypeScript.previousToken(token); - if (_previousToken === undefined) { - return true; - } - return lineMap.getLineNumberFromPosition(TypeScript.end(_previousToken)) !== lineMap.getLineNumberFromPosition(TypeScript.start(token)); - } - })(Syntax = TypeScript.Syntax || (TypeScript.Syntax = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function syntaxTree(element) { - if (element) { - while (element) { - if (element.kind() === 122 /* SourceUnit */) { - return element.syntaxTree; - } - element = element.parent; - } - } - return undefined; - } - TypeScript.syntaxTree = syntaxTree; - function parsedInStrictMode(node) { - var info = node.__data; - if (info === undefined) { - return false; - } - return (info & 4 /* NodeParsedInStrictModeMask */) !== 0; - } - TypeScript.parsedInStrictMode = parsedInStrictMode; - function previousToken(token) { - var start = token.fullStart(); - if (start === 0) { - return undefined; - } - return findToken(syntaxTree(token).sourceUnit(), start - 1); - } - TypeScript.previousToken = previousToken; - function findToken(sourceUnit, position) { - if (position < 0) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - var token = findTokenWorker(sourceUnit, 0, position); - if (token) { - TypeScript.Debug.assert(token.fullWidth() > 0); - return token; - } - if (position === fullWidth(sourceUnit)) { - return sourceUnit.endOfFileToken; - } - if (position > fullWidth(sourceUnit)) { - throw TypeScript.Errors.argumentOutOfRange("position"); - } - throw TypeScript.Errors.invalidOperation(); - } - TypeScript.findToken = findToken; - function findSkippedTokenInPositionedToken(positionedToken, position) { - var positionInLeadingTriviaList = (position < start(positionedToken)); - return findSkippedTokenInTriviaList(positionedToken, position, positionInLeadingTriviaList); - } - TypeScript.findSkippedTokenInPositionedToken = findSkippedTokenInPositionedToken; - function findSkippedTokenInLeadingTriviaList(positionedToken, position) { - return findSkippedTokenInTriviaList(positionedToken, position, true); - } - TypeScript.findSkippedTokenInLeadingTriviaList = findSkippedTokenInLeadingTriviaList; - function findSkippedTokenInTrailingTriviaList(positionedToken, position) { - return findSkippedTokenInTriviaList(positionedToken, position, false); - } - TypeScript.findSkippedTokenInTrailingTriviaList = findSkippedTokenInTrailingTriviaList; - function findSkippedTokenInTriviaList(positionedToken, position, lookInLeadingTriviaList) { - var triviaList = undefined; - var fullStart; - if (lookInLeadingTriviaList) { - triviaList = positionedToken.leadingTrivia(); - fullStart = positionedToken.fullStart(); - } - else { - triviaList = positionedToken.trailingTrivia(); - fullStart = end(positionedToken); - } - if (triviaList && triviaList.hasSkippedToken()) { - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - var triviaWidth = trivia.fullWidth(); - if (trivia.isSkippedToken() && position >= fullStart && position <= fullStart + triviaWidth) { - return trivia.skippedToken(); - } - fullStart += triviaWidth; - } - } - return undefined; - } - function findTokenWorker(element, elementPosition, position) { - if (isToken(element)) { - return element; - } - for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { - var child = TypeScript.childAt(element, i); - if (child) { - var childFullWidth = fullWidth(child); - var elementEndPosition = elementPosition + childFullWidth; - if (position < elementEndPosition) { - return findTokenWorker(child, elementPosition, position); - } - elementPosition = elementEndPosition; - } - } - return undefined; - } - function tryGetEndOfFileAt(element, position) { - if (element.kind() === 122 /* SourceUnit */ && position === fullWidth(element)) { - var sourceUnit = element; - return sourceUnit.endOfFileToken; - } - return undefined; - } - function nextToken(token, text) { - if (token.kind() === 8 /* EndOfFileToken */) { - return undefined; - } - return findToken(syntaxTree(token).sourceUnit(), fullEnd(token)); - } - TypeScript.nextToken = nextToken; - function isNode(element) { - if (element) { - var kind = element.kind(); - return kind >= TypeScript.SyntaxKind.FirstNode && kind <= TypeScript.SyntaxKind.LastNode; - } - return false; - } - TypeScript.isNode = isNode; - function isTokenKind(kind) { - return kind >= TypeScript.SyntaxKind.FirstToken && kind <= TypeScript.SyntaxKind.LastToken; - } - function isToken(element) { - if (element) { - return isTokenKind(element.kind()); - } - return false; - } - TypeScript.isToken = isToken; - function isList(element) { - return element instanceof Array; - } - TypeScript.isList = isList; - function syntaxID(element) { - var obj = element; - if (obj._syntaxID === undefined) { - obj._syntaxID = TypeScript.Syntax._nextSyntaxID++; - } - return obj._syntaxID; - } - TypeScript.syntaxID = syntaxID; - function collectTextElements(element, elements, text) { - if (element) { - if (isToken(element)) { - elements.push(element.fullText(text)); - } - else { - for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { - collectTextElements(TypeScript.childAt(element, i), elements, text); - } - } - } - } - function fullText(element, text) { - if (isToken(element)) { - return element.fullText(text); - } - var elements = []; - collectTextElements(element, elements, text); - return elements.join(""); - } - TypeScript.fullText = fullText; - function leadingTriviaWidth(element, text) { - var token = firstToken(element); - return token ? token.leadingTriviaWidth(text) : 0; - } - TypeScript.leadingTriviaWidth = leadingTriviaWidth; - function trailingTriviaWidth(element, text) { - var token = lastToken(element); - return token ? token.trailingTriviaWidth(text) : 0; - } - TypeScript.trailingTriviaWidth = trailingTriviaWidth; - function firstToken(element) { - if (element) { - var kind = element.kind(); - if (isTokenKind(kind)) { - return element.fullWidth() > 0 || kind === 8 /* EndOfFileToken */ ? element : undefined; - } - for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { - var token = firstToken(TypeScript.childAt(element, i)); - if (token) { - return token; - } - } - } - return undefined; - } - TypeScript.firstToken = firstToken; - function lastToken(element) { - if (isToken(element)) { - return fullWidth(element) > 0 || element.kind() === 8 /* EndOfFileToken */ ? element : undefined; - } - if (element.kind() === 122 /* SourceUnit */) { - return element.endOfFileToken; - } - for (var i = TypeScript.childCount(element) - 1; i >= 0; i--) { - var child = TypeScript.childAt(element, i); - if (child) { - var token = lastToken(child); - if (token) { - return token; - } - } - } - return undefined; - } - TypeScript.lastToken = lastToken; - function fullStart(element) { - var token = isToken(element) ? element : firstToken(element); - return token ? token.fullStart() : -1; - } - TypeScript.fullStart = fullStart; - function fullWidth(element) { - if (isToken(element)) { - return element.fullWidth(); - } - var info = data(element); - return info >>> 3 /* NodeFullWidthShift */; - } - TypeScript.fullWidth = fullWidth; - function isIncrementallyUnusable(element) { - if (isToken(element)) { - return element.isIncrementallyUnusable(); - } - return (data(element) & 2 /* NodeIncrementallyUnusableMask */) !== 0; - } - TypeScript.isIncrementallyUnusable = isIncrementallyUnusable; - function data(element) { - var dataElement = element; - var info = dataElement.__data; - if (info === undefined) { - info = 0; - } - if ((info & 1 /* NodeDataComputed */) === 0) { - info |= computeData(element); - dataElement.__data = info; - } - return info; - } - function computeData(element) { - var slotCount = TypeScript.childCount(element); - var fullWidth = 0; - var isIncrementallyUnusable = slotCount === 0 && !isList(element); - for (var i = 0, n = slotCount; i < n; i++) { - var child = TypeScript.childAt(element, i); - if (child) { - fullWidth += TypeScript.fullWidth(child); - isIncrementallyUnusable = isIncrementallyUnusable || TypeScript.isIncrementallyUnusable(child); - } - } - return (fullWidth << 3 /* NodeFullWidthShift */) | (isIncrementallyUnusable ? 2 /* NodeIncrementallyUnusableMask */ : 0) | 1 /* NodeDataComputed */; - } - function start(element, text) { - var token = isToken(element) ? element : firstToken(element); - return token ? token.fullStart() + token.leadingTriviaWidth(text) : -1; - } - TypeScript.start = start; - function end(element, text) { - var token = isToken(element) ? element : lastToken(element); - return token ? fullEnd(token) - token.trailingTriviaWidth(text) : -1; - } - TypeScript.end = end; - function width(element, text) { - if (isToken(element)) { - return element.text().length; - } - return fullWidth(element) - leadingTriviaWidth(element, text) - trailingTriviaWidth(element, text); - } - TypeScript.width = width; - function fullEnd(element) { - return fullStart(element) + fullWidth(element); - } - TypeScript.fullEnd = fullEnd; - function existsNewLineBetweenTokens(token1, token2, text) { - if (token1 === token2) { - return false; - } - if (!token1 || !token2) { - return true; - } - var lineMap = text.lineMap(); - return lineMap.getLineNumberFromPosition(end(token1, text)) !== lineMap.getLineNumberFromPosition(start(token2, text)); - } - TypeScript.existsNewLineBetweenTokens = existsNewLineBetweenTokens; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxFacts; - (function (SyntaxFacts) { - function isDirectivePrologueElement(node) { - if (node.kind() === 154 /* ExpressionStatement */) { - var expressionStatement = node; - var expression = expressionStatement.expression; - if (expression.kind() === 12 /* StringLiteral */) { - return true; - } - } - return false; - } - SyntaxFacts.isDirectivePrologueElement = isDirectivePrologueElement; - function isUseStrictDirective(node) { - var expressionStatement = node; - var stringLiteral = expressionStatement.expression; - var text = stringLiteral.text(); - return text === '"use strict"' || text === "'use strict'"; - } - SyntaxFacts.isUseStrictDirective = isUseStrictDirective; - function isIdentifierNameOrAnyKeyword(token) { - var tokenKind = token.kind(); - return tokenKind === 9 /* IdentifierName */ || SyntaxFacts.isAnyKeyword(tokenKind); - } - SyntaxFacts.isIdentifierNameOrAnyKeyword = isIdentifierNameOrAnyKeyword; - function isAccessibilityModifier(kind) { - switch (kind) { - case 59 /* PublicKeyword */: - case 57 /* PrivateKeyword */: - case 58 /* ProtectedKeyword */: - return true; - } - return false; - } - SyntaxFacts.isAccessibilityModifier = isAccessibilityModifier; - })(SyntaxFacts = TypeScript.SyntaxFacts || (TypeScript.SyntaxFacts = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function separatorCount(list) { - return list.length >> 1; - } - TypeScript.separatorCount = separatorCount; - function nonSeparatorCount(list) { - return (list.length + 1) >> 1; - } - TypeScript.nonSeparatorCount = nonSeparatorCount; - function separatorAt(list, index) { - return list[(index << 1) + 1]; - } - TypeScript.separatorAt = separatorAt; - function nonSeparatorAt(list, index) { - return list[index << 1]; - } - TypeScript.nonSeparatorAt = nonSeparatorAt; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Syntax; - (function (Syntax) { - function addArrayFunction(name, func) { - if (Object.defineProperty) { - Object.defineProperty(Array.prototype, name, { value: func, writable: true }); - } - else { - Array.prototype[name] = func; - } - } - addArrayFunction("kind", function () { - return 1 /* List */; - }); - function list(nodes) { - for (var i = 0, n = nodes.length; i < n; i++) { - nodes[i].parent = nodes; - } - return nodes; - } - Syntax.list = list; - function separatedList(nodesAndTokens) { - for (var i = 0, n = nodesAndTokens.length; i < n; i++) { - nodesAndTokens[i].parent = nodesAndTokens; - } - return nodesAndTokens; - } - Syntax.separatedList = separatedList; - })(Syntax = TypeScript.Syntax || (TypeScript.Syntax = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function tokenValue(token) { - if (token.fullWidth() === 0) { - return undefined; - } - var kind = token.kind(); - var text = token.text(); - if (kind === 9 /* IdentifierName */) { - return massageEscapes(text); - } - switch (kind) { - case 39 /* TrueKeyword */: - return true; - case 26 /* FalseKeyword */: - return false; - case 34 /* NullKeyword */: - return undefined; - } - if (TypeScript.SyntaxFacts.isAnyKeyword(kind) || TypeScript.SyntaxFacts.isAnyPunctuation(kind)) { - return TypeScript.SyntaxFacts.getText(kind); - } - if (kind === 11 /* NumericLiteral */) { - return TypeScript.IntegerUtilities.isHexInteger(text) ? parseInt(text, 16) : parseFloat(text); - } - else if (kind === 12 /* StringLiteral */) { - return (text.length > 1 && text.charCodeAt(text.length - 1) === text.charCodeAt(0)) ? massageEscapes(text.substr(1, text.length - "''".length)) : massageEscapes(text.substr(1)); - } - else if (kind === 13 /* NoSubstitutionTemplateToken */ || kind === 16 /* TemplateEndToken */) { - return (text.length > 1 && text.charCodeAt(text.length - 1) === 96 /* backtick */) ? massageTemplate(text.substr(1, text.length - "``".length)) : massageTemplate(text.substr(1)); - } - else if (kind === 14 /* TemplateStartToken */ || kind === 15 /* TemplateMiddleToken */) { - return massageTemplate(text.substr(1, text.length - "`${".length)); - } - else if (kind === 10 /* RegularExpressionLiteral */) { - return regularExpressionValue(text); - } - else if (kind === 8 /* EndOfFileToken */ || kind === 7 /* ErrorToken */) { - return undefined; - } - else { - throw TypeScript.Errors.invalidOperation(); - } - } - TypeScript.tokenValue = tokenValue; - function tokenValueText(token) { - var value = tokenValue(token); - return value === undefined ? "" : massageDisallowedIdentifiers(value.toString()); - } - TypeScript.tokenValueText = tokenValueText; - function massageTemplate(text) { - text = text.replace("\r\n", "\n").replace("\r", "\n"); - return massageEscapes(text); - } - function massageEscapes(text) { - return text.indexOf("\\") >= 0 ? convertEscapes(text) : text; - } - TypeScript.massageEscapes = massageEscapes; - function regularExpressionValue(text) { - try { - var lastSlash = text.lastIndexOf("/"); - var body = text.substring(1, lastSlash); - var flags = text.substring(lastSlash + 1); - return new RegExp(body, flags); - } - catch (e) { - return undefined; - } - } - function massageDisallowedIdentifiers(text) { - if (text.charCodeAt(0) === 95 /* _ */ && text.charCodeAt(1) === 95 /* _ */) { - return "_" + text; - } - return text; - } - var characterArray = []; - function convertEscapes(text) { - characterArray.length = 0; - var result = ""; - for (var i = 0, n = text.length; i < n; i++) { - var ch = text.charCodeAt(i); - if (ch === 92 /* backslash */) { - i++; - if (i < n) { - ch = text.charCodeAt(i); - switch (ch) { - case 48 /* _0 */: - characterArray.push(0 /* nullCharacter */); - continue; - case 98 /* b */: - characterArray.push(8 /* backspace */); - continue; - case 102 /* f */: - characterArray.push(12 /* formFeed */); - continue; - case 110 /* n */: - characterArray.push(10 /* lineFeed */); - continue; - case 114 /* r */: - characterArray.push(13 /* carriageReturn */); - continue; - case 116 /* t */: - characterArray.push(9 /* tab */); - continue; - case 118 /* v */: - characterArray.push(11 /* verticalTab */); - continue; - case 120 /* x */: - characterArray.push(hexValue(text, i + 1, 2)); - i += 2; - continue; - case 117 /* u */: - characterArray.push(hexValue(text, i + 1, 4)); - i += 4; - continue; - case 13 /* carriageReturn */: - var nextIndex = i + 1; - if (nextIndex < text.length && text.charCodeAt(nextIndex) === 10 /* lineFeed */) { - i++; - } - continue; - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - continue; - default: - } - } - } - characterArray.push(ch); - if (i && !(i % 1024)) { - result = result.concat(String.fromCharCode.apply(undefined, characterArray)); - characterArray.length = 0; - } - } - if (characterArray.length) { - result = result.concat(String.fromCharCode.apply(undefined, characterArray)); - } - return result; - } - function hexValue(text, start, length) { - var intChar = 0; - for (var i = 0; i < length; i++) { - var ch2 = text.charCodeAt(start + i); - if (!TypeScript.CharacterInfo.isHexDigit(ch2)) { - break; - } - intChar = (intChar << 4) + TypeScript.CharacterInfo.hexValue(ch2); - } - return intChar; - } -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Syntax; - (function (Syntax) { - function realizeToken(token, text) { - return new RealizedToken(token.fullStart(), token.kind(), token.isKeywordConvertedToIdentifier(), token.leadingTrivia(text), token.text(), token.trailingTrivia(text)); - } - Syntax.realizeToken = realizeToken; - function convertKeywordToIdentifier(token) { - return new ConvertedKeywordToken(token); - } - Syntax.convertKeywordToIdentifier = convertKeywordToIdentifier; - function withLeadingTrivia(token, leadingTrivia, text) { - return new RealizedToken(token.fullStart(), token.kind(), token.isKeywordConvertedToIdentifier(), leadingTrivia, token.text(), token.trailingTrivia(text)); - } - Syntax.withLeadingTrivia = withLeadingTrivia; - function withTrailingTrivia(token, trailingTrivia, text) { - return new RealizedToken(token.fullStart(), token.kind(), token.isKeywordConvertedToIdentifier(), token.leadingTrivia(text), token.text(), trailingTrivia); - } - Syntax.withTrailingTrivia = withTrailingTrivia; - function emptyToken(kind) { - return new EmptyToken(kind); - } - Syntax.emptyToken = emptyToken; - var EmptyToken = (function () { - function EmptyToken(_kind) { - this._kind = _kind; - } - EmptyToken.prototype.setFullStart = function (fullStart) { - }; - EmptyToken.prototype.kind = function () { - return this._kind; - }; - EmptyToken.prototype.childCount = function () { - return 0; - }; - EmptyToken.prototype.childAt = function (index) { - throw TypeScript.Errors.invalidOperation(); - }; - EmptyToken.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - EmptyToken.prototype.clone = function () { - return new EmptyToken(this.kind()); - }; - EmptyToken.prototype.isIncrementallyUnusable = function () { - return true; - }; - EmptyToken.prototype.isKeywordConvertedToIdentifier = function () { - return false; - }; - EmptyToken.prototype.fullWidth = function () { - return 0; - }; - EmptyToken.prototype.position = function () { - var previousElement = this.previousNonZeroWidthElement(); - return !previousElement ? 0 : TypeScript.fullStart(previousElement) + TypeScript.fullWidth(previousElement); - }; - EmptyToken.prototype.previousNonZeroWidthElement = function () { - var current = this; - while (true) { - var parent = current.parent; - if (parent === undefined) { - TypeScript.Debug.assert(current.kind() === 122 /* SourceUnit */, "We had a node without a parent that was not the root node!"); - return undefined; - } - for (var i = 0, n = TypeScript.childCount(parent); i < n; i++) { - if (TypeScript.childAt(parent, i) === current) { - break; - } - } - TypeScript.Debug.assert(i !== n, "Could not find current element in parent's child list!"); - for (var j = i - 1; j >= 0; j--) { - var sibling = TypeScript.childAt(parent, j); - if (sibling && TypeScript.fullWidth(sibling) > 0) { - return sibling; - } - } - current = current.parent; - } - }; - EmptyToken.prototype.fullStart = function () { - return this.position(); - }; - EmptyToken.prototype.text = function () { - return ""; - }; - EmptyToken.prototype.fullText = function () { - return ""; - }; - EmptyToken.prototype.hasLeadingTrivia = function () { - return false; - }; - EmptyToken.prototype.hasTrailingTrivia = function () { - return false; - }; - EmptyToken.prototype.hasLeadingComment = function () { - return false; - }; - EmptyToken.prototype.hasTrailingComment = function () { - return false; - }; - EmptyToken.prototype.hasSkippedToken = function () { - return false; - }; - EmptyToken.prototype.leadingTriviaWidth = function () { - return 0; - }; - EmptyToken.prototype.trailingTriviaWidth = function () { - return 0; - }; - EmptyToken.prototype.leadingTrivia = function () { - return Syntax.emptyTriviaList; - }; - EmptyToken.prototype.trailingTrivia = function () { - return Syntax.emptyTriviaList; - }; - return EmptyToken; - })(); - var RealizedToken = (function () { - function RealizedToken(fullStart, kind, isKeywordConvertedToIdentifier, leadingTrivia, text, trailingTrivia) { - this._fullStart = fullStart; - this._kind = kind; - this._isKeywordConvertedToIdentifier = isKeywordConvertedToIdentifier; - this._text = text; - this._leadingTrivia = leadingTrivia.clone(); - this._trailingTrivia = trailingTrivia.clone(); - if (!this._leadingTrivia.isShared()) { - this._leadingTrivia.parent = this; - } - if (!this._trailingTrivia.isShared()) { - this._trailingTrivia.parent = this; - } - } - RealizedToken.prototype.setFullStart = function (fullStart) { - this._fullStart = fullStart; - }; - RealizedToken.prototype.kind = function () { - return this._kind; - }; - RealizedToken.prototype.childCount = function () { - return 0; - }; - RealizedToken.prototype.childAt = function (index) { - throw TypeScript.Errors.invalidOperation(); - }; - RealizedToken.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - RealizedToken.prototype.clone = function () { - return new RealizedToken(this._fullStart, this.kind(), this._isKeywordConvertedToIdentifier, this._leadingTrivia, this._text, this._trailingTrivia); - }; - RealizedToken.prototype.isIncrementallyUnusable = function () { - return true; - }; - RealizedToken.prototype.isKeywordConvertedToIdentifier = function () { - return this._isKeywordConvertedToIdentifier; - }; - RealizedToken.prototype.fullStart = function () { - return this._fullStart; - }; - RealizedToken.prototype.fullWidth = function () { - return this._leadingTrivia.fullWidth() + this._text.length + this._trailingTrivia.fullWidth(); - }; - RealizedToken.prototype.text = function () { - return this._text; - }; - RealizedToken.prototype.fullText = function () { - return this._leadingTrivia.fullText() + this.text() + this._trailingTrivia.fullText(); - }; - RealizedToken.prototype.hasLeadingTrivia = function () { - return this._leadingTrivia.count() > 0; - }; - RealizedToken.prototype.hasTrailingTrivia = function () { - return this._trailingTrivia.count() > 0; - }; - RealizedToken.prototype.hasLeadingComment = function () { - return this._leadingTrivia.hasComment(); - }; - RealizedToken.prototype.hasTrailingComment = function () { - return this._trailingTrivia.hasComment(); - }; - RealizedToken.prototype.leadingTriviaWidth = function () { - return this._leadingTrivia.fullWidth(); - }; - RealizedToken.prototype.trailingTriviaWidth = function () { - return this._trailingTrivia.fullWidth(); - }; - RealizedToken.prototype.hasSkippedToken = function () { - return this._leadingTrivia.hasSkippedToken() || this._trailingTrivia.hasSkippedToken(); - }; - RealizedToken.prototype.leadingTrivia = function () { - return this._leadingTrivia; - }; - RealizedToken.prototype.trailingTrivia = function () { - return this._trailingTrivia; - }; - return RealizedToken; - })(); - var ConvertedKeywordToken = (function () { - function ConvertedKeywordToken(underlyingToken) { - this.underlyingToken = underlyingToken; - } - ConvertedKeywordToken.prototype.kind = function () { - return 9 /* IdentifierName */; - }; - ConvertedKeywordToken.prototype.setFullStart = function (fullStart) { - this.underlyingToken.setFullStart(fullStart); - }; - ConvertedKeywordToken.prototype.childCount = function () { - return 0; - }; - ConvertedKeywordToken.prototype.childAt = function (index) { - throw TypeScript.Errors.invalidOperation(); - }; - ConvertedKeywordToken.prototype.accept = function (visitor) { - return visitor.visitToken(this); - }; - ConvertedKeywordToken.prototype.fullStart = function () { - return this.underlyingToken.fullStart(); - }; - ConvertedKeywordToken.prototype.fullWidth = function () { - return this.underlyingToken.fullWidth(); - }; - ConvertedKeywordToken.prototype.text = function () { - return this.underlyingToken.text(); - }; - ConvertedKeywordToken.prototype.syntaxTreeText = function (text) { - var result = text || TypeScript.syntaxTree(this).text; - TypeScript.Debug.assert(result); - return result; - }; - ConvertedKeywordToken.prototype.fullText = function (text) { - return this.underlyingToken.fullText(this.syntaxTreeText(text)); - }; - ConvertedKeywordToken.prototype.hasLeadingTrivia = function () { - return this.underlyingToken.hasLeadingTrivia(); - }; - ConvertedKeywordToken.prototype.hasTrailingTrivia = function () { - return this.underlyingToken.hasTrailingTrivia(); - }; - ConvertedKeywordToken.prototype.hasLeadingComment = function () { - return this.underlyingToken.hasLeadingComment(); - }; - ConvertedKeywordToken.prototype.hasTrailingComment = function () { - return this.underlyingToken.hasTrailingComment(); - }; - ConvertedKeywordToken.prototype.hasSkippedToken = function () { - return this.underlyingToken.hasSkippedToken(); - }; - ConvertedKeywordToken.prototype.leadingTrivia = function (text) { - var result = this.underlyingToken.leadingTrivia(this.syntaxTreeText(text)); - result.parent = this; - return result; - }; - ConvertedKeywordToken.prototype.trailingTrivia = function (text) { - var result = this.underlyingToken.trailingTrivia(this.syntaxTreeText(text)); - result.parent = this; - return result; - }; - ConvertedKeywordToken.prototype.leadingTriviaWidth = function (text) { - return this.underlyingToken.leadingTriviaWidth(this.syntaxTreeText(text)); - }; - ConvertedKeywordToken.prototype.trailingTriviaWidth = function (text) { - return this.underlyingToken.trailingTriviaWidth(this.syntaxTreeText(text)); - }; - ConvertedKeywordToken.prototype.isKeywordConvertedToIdentifier = function () { - return true; - }; - ConvertedKeywordToken.prototype.isIncrementallyUnusable = function () { - return this.underlyingToken.isIncrementallyUnusable(); - }; - ConvertedKeywordToken.prototype.clone = function () { - return new ConvertedKeywordToken(this.underlyingToken); - }; - return ConvertedKeywordToken; - })(); - })(Syntax = TypeScript.Syntax || (TypeScript.Syntax = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Syntax; - (function (Syntax) { - var AbstractTrivia = (function () { - function AbstractTrivia(_kind) { - this._kind = _kind; - } - AbstractTrivia.prototype.kind = function () { - return this._kind; - }; - AbstractTrivia.prototype.clone = function () { - throw TypeScript.Errors.abstract(); - }; - AbstractTrivia.prototype.fullStart = function () { - throw TypeScript.Errors.abstract(); - }; - AbstractTrivia.prototype.fullWidth = function () { - throw TypeScript.Errors.abstract(); - }; - AbstractTrivia.prototype.fullText = function () { - throw TypeScript.Errors.abstract(); - }; - AbstractTrivia.prototype.skippedToken = function () { - throw TypeScript.Errors.abstract(); - }; - AbstractTrivia.prototype.isWhitespace = function () { - return this.kind() === 2 /* WhitespaceTrivia */; - }; - AbstractTrivia.prototype.isComment = function () { - return this.kind() === 5 /* SingleLineCommentTrivia */ || this.kind() === 4 /* MultiLineCommentTrivia */; - }; - AbstractTrivia.prototype.isNewLine = function () { - return this.kind() === 3 /* NewLineTrivia */; - }; - AbstractTrivia.prototype.isSkippedToken = function () { - return this.kind() === 6 /* SkippedTokenTrivia */; - }; - return AbstractTrivia; - })(); - var SkippedTokenTrivia = (function (_super) { - __extends(SkippedTokenTrivia, _super); - function SkippedTokenTrivia(_skippedToken, _fullText) { - _super.call(this, 6 /* SkippedTokenTrivia */); - this._skippedToken = _skippedToken; - this._fullText = _fullText; - _skippedToken.parent = this; - } - SkippedTokenTrivia.prototype.clone = function () { - return new SkippedTokenTrivia(this._skippedToken.clone(), this._fullText); - }; - SkippedTokenTrivia.prototype.fullStart = function () { - return this._skippedToken.fullStart(); - }; - SkippedTokenTrivia.prototype.fullWidth = function () { - return this.fullText().length; - }; - SkippedTokenTrivia.prototype.fullText = function () { - return this._fullText; - }; - SkippedTokenTrivia.prototype.skippedToken = function () { - return this._skippedToken; - }; - return SkippedTokenTrivia; - })(AbstractTrivia); - var DeferredTrivia = (function (_super) { - __extends(DeferredTrivia, _super); - function DeferredTrivia(kind, _text, _fullStart, _fullWidth) { - _super.call(this, kind); - this._text = _text; - this._fullStart = _fullStart; - this._fullWidth = _fullWidth; - } - DeferredTrivia.prototype.clone = function () { - return new DeferredTrivia(this.kind(), this._text, this._fullStart, this._fullWidth); - }; - DeferredTrivia.prototype.fullStart = function () { - return this._fullStart; - }; - DeferredTrivia.prototype.fullWidth = function () { - return this._fullWidth; - }; - DeferredTrivia.prototype.fullText = function () { - return this._text.substr(this._fullStart, this._fullWidth); - }; - DeferredTrivia.prototype.skippedToken = function () { - throw TypeScript.Errors.invalidOperation(); - }; - return DeferredTrivia; - })(AbstractTrivia); - function deferredTrivia(kind, text, fullStart, fullWidth) { - return new DeferredTrivia(kind, text, fullStart, fullWidth); - } - Syntax.deferredTrivia = deferredTrivia; - function skippedTokenTrivia(token, text) { - TypeScript.Debug.assert(!token.hasLeadingTrivia()); - TypeScript.Debug.assert(!token.hasTrailingTrivia()); - TypeScript.Debug.assert(token.fullWidth() > 0); - return new SkippedTokenTrivia(token, token.fullText(text)); - } - Syntax.skippedTokenTrivia = skippedTokenTrivia; - function splitMultiLineCommentTriviaIntoMultipleLines(trivia) { - var result = []; - var triviaText = trivia.fullText(); - var currentIndex = 0; - for (var i = 0; i < triviaText.length; i++) { - var ch = triviaText.charCodeAt(i); - switch (ch) { - case 13 /* carriageReturn */: - if (i < triviaText.length - 1 && triviaText.charCodeAt(i + 1) === 10 /* lineFeed */) { - i++; - } - case 10 /* lineFeed */: - case 8233 /* paragraphSeparator */: - case 8232 /* lineSeparator */: - result.push(triviaText.substring(currentIndex, i + 1)); - currentIndex = i + 1; - continue; - } - } - result.push(triviaText.substring(currentIndex)); - return result; - } - Syntax.splitMultiLineCommentTriviaIntoMultipleLines = splitMultiLineCommentTriviaIntoMultipleLines; - })(Syntax = TypeScript.Syntax || (TypeScript.Syntax = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Syntax; - (function (Syntax) { - var EmptyTriviaList = (function () { - function EmptyTriviaList() { - } - EmptyTriviaList.prototype.isShared = function () { - return true; - }; - EmptyTriviaList.prototype.count = function () { - return 0; - }; - EmptyTriviaList.prototype.syntaxTriviaAt = function (index) { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - EmptyTriviaList.prototype.last = function () { - throw TypeScript.Errors.argumentOutOfRange("index"); - }; - EmptyTriviaList.prototype.fullWidth = function () { - return 0; - }; - EmptyTriviaList.prototype.fullText = function () { - return ""; - }; - EmptyTriviaList.prototype.hasComment = function () { - return false; - }; - EmptyTriviaList.prototype.hasNewLine = function () { - return false; - }; - EmptyTriviaList.prototype.hasSkippedToken = function () { - return false; - }; - EmptyTriviaList.prototype.toArray = function () { - return []; - }; - EmptyTriviaList.prototype.clone = function () { - return this; - }; - return EmptyTriviaList; - })(); - ; - Syntax.emptyTriviaList = new EmptyTriviaList(); - function isComment(trivia) { - return trivia.kind() === 4 /* MultiLineCommentTrivia */ || trivia.kind() === 5 /* SingleLineCommentTrivia */; - } - var SingletonSyntaxTriviaList = (function () { - function SingletonSyntaxTriviaList(item) { - this.item = item.clone(); - this.item.parent = this; - } - SingletonSyntaxTriviaList.prototype.isShared = function () { - return false; - }; - SingletonSyntaxTriviaList.prototype.count = function () { - return 1; - }; - SingletonSyntaxTriviaList.prototype.syntaxTriviaAt = function (index) { - if (index !== 0) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - return this.item; - }; - SingletonSyntaxTriviaList.prototype.last = function () { - return this.item; - }; - SingletonSyntaxTriviaList.prototype.fullWidth = function () { - return this.item.fullWidth(); - }; - SingletonSyntaxTriviaList.prototype.fullText = function () { - return this.item.fullText(); - }; - SingletonSyntaxTriviaList.prototype.hasComment = function () { - return isComment(this.item); - }; - SingletonSyntaxTriviaList.prototype.hasNewLine = function () { - return this.item.kind() === 3 /* NewLineTrivia */; - }; - SingletonSyntaxTriviaList.prototype.hasSkippedToken = function () { - return this.item.kind() === 6 /* SkippedTokenTrivia */; - }; - SingletonSyntaxTriviaList.prototype.toArray = function () { - return [this.item]; - }; - SingletonSyntaxTriviaList.prototype.clone = function () { - return new SingletonSyntaxTriviaList(this.item.clone()); - }; - return SingletonSyntaxTriviaList; - })(); - var NormalSyntaxTriviaList = (function () { - function NormalSyntaxTriviaList(trivia) { - var _this = this; - this.trivia = trivia.map(function (t) { - var cloned = t.clone(); - cloned.parent = _this; - return cloned; - }); - } - NormalSyntaxTriviaList.prototype.isShared = function () { - return false; - }; - NormalSyntaxTriviaList.prototype.count = function () { - return this.trivia.length; - }; - NormalSyntaxTriviaList.prototype.syntaxTriviaAt = function (index) { - if (index < 0 || index >= this.trivia.length) { - throw TypeScript.Errors.argumentOutOfRange("index"); - } - return this.trivia[index]; - }; - NormalSyntaxTriviaList.prototype.last = function () { - return this.trivia[this.trivia.length - 1]; - }; - NormalSyntaxTriviaList.prototype.fullWidth = function () { - return TypeScript.ArrayUtilities.sum(this.trivia, function (t) { return t.fullWidth(); }); - }; - NormalSyntaxTriviaList.prototype.fullText = function () { - var result = []; - for (var i = 0, n = this.trivia.length; i < n; i++) { - result.push(this.trivia[i].fullText()); - } - return result.join(""); - }; - NormalSyntaxTriviaList.prototype.hasComment = function () { - for (var i = 0; i < this.trivia.length; i++) { - if (isComment(this.trivia[i])) { - return true; - } - } - return false; - }; - NormalSyntaxTriviaList.prototype.hasNewLine = function () { - for (var i = 0; i < this.trivia.length; i++) { - if (this.trivia[i].kind() === 3 /* NewLineTrivia */) { - return true; - } - } - return false; - }; - NormalSyntaxTriviaList.prototype.hasSkippedToken = function () { - for (var i = 0; i < this.trivia.length; i++) { - if (this.trivia[i].kind() === 6 /* SkippedTokenTrivia */) { - return true; - } - } - return false; - }; - NormalSyntaxTriviaList.prototype.toArray = function () { - return this.trivia.slice(0); - }; - NormalSyntaxTriviaList.prototype.clone = function () { - return new NormalSyntaxTriviaList(this.trivia.map(function (t) { return t.clone(); })); - }; - return NormalSyntaxTriviaList; - })(); - function triviaList(trivia) { - if (!trivia || trivia.length === 0) { - return Syntax.emptyTriviaList; - } - if (trivia.length === 1) { - return new SingletonSyntaxTriviaList(trivia[0]); - } - return new NormalSyntaxTriviaList(trivia); - } - Syntax.triviaList = triviaList; - })(Syntax = TypeScript.Syntax || (TypeScript.Syntax = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxUtilities = (function () { - function SyntaxUtilities() { - } - SyntaxUtilities.isAnyFunctionExpressionOrDeclaration = function (ast) { - switch (ast.kind()) { - case 183 /* SimpleArrowFunctionExpression */: - case 182 /* ParenthesizedArrowFunctionExpression */: - case 186 /* FunctionExpression */: - case 134 /* FunctionDeclaration */: - case 140 /* MemberFunctionDeclaration */: - case 207 /* FunctionPropertyAssignment */: - case 142 /* ConstructorDeclaration */: - case 144 /* GetAccessor */: - case 145 /* SetAccessor */: - return true; - } - return false; - }; - SyntaxUtilities.isLastTokenOnLine = function (token, text) { - var _nextToken = TypeScript.nextToken(token, text); - if (_nextToken === undefined) { - return true; - } - var lineMap = text.lineMap(); - var tokenLine = lineMap.getLineNumberFromPosition(TypeScript.end(token, text)); - var nextTokenLine = lineMap.getLineNumberFromPosition(TypeScript.start(_nextToken, text)); - return tokenLine !== nextTokenLine; - }; - SyntaxUtilities.isLeftHandSizeExpression = function (element) { - if (element) { - switch (element.kind()) { - case 176 /* MemberAccessExpression */: - case 185 /* ElementAccessExpression */: - case 189 /* TemplateAccessExpression */: - case 180 /* ObjectCreationExpression */: - case 177 /* InvocationExpression */: - case 178 /* ArrayLiteralExpression */: - case 181 /* ParenthesizedExpression */: - case 179 /* ObjectLiteralExpression */: - case 186 /* FunctionExpression */: - case 9 /* IdentifierName */: - case 10 /* RegularExpressionLiteral */: - case 11 /* NumericLiteral */: - case 12 /* StringLiteral */: - case 26 /* FalseKeyword */: - case 34 /* NullKeyword */: - case 37 /* ThisKeyword */: - case 39 /* TrueKeyword */: - case 52 /* SuperKeyword */: - return true; - } - } - return false; - }; - SyntaxUtilities.isSwitchClause = function (element) { - if (element) { - switch (element.kind()) { - case 198 /* CaseSwitchClause */: - case 199 /* DefaultSwitchClause */: - return true; - } - } - return false; - }; - SyntaxUtilities.isTypeMember = function (element) { - if (element) { - switch (element.kind()) { - case 148 /* ConstructSignature */: - case 150 /* MethodSignature */: - case 149 /* IndexSignature */: - case 146 /* PropertySignature */: - case 147 /* CallSignature */: - return true; - } - } - return false; - }; - SyntaxUtilities.isClassElement = function (element) { - if (element) { - switch (element.kind()) { - case 142 /* ConstructorDeclaration */: - case 143 /* IndexMemberDeclaration */: - case 140 /* MemberFunctionDeclaration */: - case 144 /* GetAccessor */: - case 145 /* SetAccessor */: - case 140 /* MemberFunctionDeclaration */: - case 141 /* MemberVariableDeclaration */: - return true; - } - } - return false; - }; - SyntaxUtilities.isModuleElement = function (element) { - if (element) { - switch (element.kind()) { - case 138 /* ImportDeclaration */: - case 139 /* ExportAssignment */: - case 136 /* ClassDeclaration */: - case 133 /* InterfaceDeclaration */: - case 135 /* ModuleDeclaration */: - case 137 /* EnumDeclaration */: - case 134 /* FunctionDeclaration */: - case 153 /* VariableStatement */: - case 151 /* Block */: - case 152 /* IfStatement */: - case 154 /* ExpressionStatement */: - case 162 /* ThrowStatement */: - case 155 /* ReturnStatement */: - case 156 /* SwitchStatement */: - case 157 /* BreakStatement */: - case 158 /* ContinueStatement */: - case 160 /* ForInStatement */: - case 159 /* ForStatement */: - case 163 /* WhileStatement */: - case 168 /* WithStatement */: - case 161 /* EmptyStatement */: - case 164 /* TryStatement */: - case 165 /* LabeledStatement */: - case 166 /* DoStatement */: - case 167 /* DebuggerStatement */: - return true; - } - } - return false; - }; - SyntaxUtilities.isStatement = function (element) { - if (element) { - switch (element.kind()) { - case 134 /* FunctionDeclaration */: - case 153 /* VariableStatement */: - case 151 /* Block */: - case 152 /* IfStatement */: - case 154 /* ExpressionStatement */: - case 162 /* ThrowStatement */: - case 155 /* ReturnStatement */: - case 156 /* SwitchStatement */: - case 157 /* BreakStatement */: - case 158 /* ContinueStatement */: - case 160 /* ForInStatement */: - case 159 /* ForStatement */: - case 163 /* WhileStatement */: - case 168 /* WithStatement */: - case 161 /* EmptyStatement */: - case 164 /* TryStatement */: - case 165 /* LabeledStatement */: - case 166 /* DoStatement */: - case 167 /* DebuggerStatement */: - return true; - } - } - return false; - }; - SyntaxUtilities.isAngleBracket = function (positionedElement) { - var element = positionedElement; - var parent = positionedElement.parent; - if (parent && (element.kind() === 82 /* LessThanToken */ || element.kind() === 83 /* GreaterThanToken */)) { - switch (parent.kind()) { - case 194 /* TypeArgumentList */: - case 195 /* TypeParameterList */: - case 184 /* CastExpression */: - return true; - } - } - return false; - }; - SyntaxUtilities.getToken = function (list, kind) { - for (var i = 0, n = list.length; i < n; i++) { - var token = list[i]; - if (token.kind() === kind) { - return token; - } - } - return undefined; - }; - SyntaxUtilities.containsToken = function (list, kind) { - return !!SyntaxUtilities.getToken(list, kind); - }; - SyntaxUtilities.hasExportKeyword = function (moduleElement) { - return !!SyntaxUtilities.getExportKeyword(moduleElement); - }; - SyntaxUtilities.getExportKeyword = function (moduleElement) { - switch (moduleElement.kind()) { - case 135 /* ModuleDeclaration */: - case 136 /* ClassDeclaration */: - case 134 /* FunctionDeclaration */: - case 153 /* VariableStatement */: - case 137 /* EnumDeclaration */: - case 133 /* InterfaceDeclaration */: - case 138 /* ImportDeclaration */: - return SyntaxUtilities.getToken(moduleElement.modifiers, 49 /* ExportKeyword */); - default: - return undefined; - } - }; - SyntaxUtilities.isAmbientDeclarationSyntax = function (positionNode) { - if (!positionNode) { - return false; - } - var node = positionNode; - switch (node.kind()) { - case 135 /* ModuleDeclaration */: - case 136 /* ClassDeclaration */: - case 134 /* FunctionDeclaration */: - case 153 /* VariableStatement */: - case 137 /* EnumDeclaration */: - if (SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */)) { - return true; - } - case 138 /* ImportDeclaration */: - case 142 /* ConstructorDeclaration */: - case 140 /* MemberFunctionDeclaration */: - case 144 /* GetAccessor */: - case 145 /* SetAccessor */: - case 141 /* MemberVariableDeclaration */: - if (SyntaxUtilities.isClassElement(node) || SyntaxUtilities.isModuleElement(node)) { - return SyntaxUtilities.isAmbientDeclarationSyntax(TypeScript.Syntax.containingNode(positionNode)); - } - case 209 /* EnumElement */: - return SyntaxUtilities.isAmbientDeclarationSyntax(TypeScript.Syntax.containingNode(TypeScript.Syntax.containingNode(positionNode))); - default: - return SyntaxUtilities.isAmbientDeclarationSyntax(TypeScript.Syntax.containingNode(positionNode)); - } - }; - return SyntaxUtilities; - })(); - TypeScript.SyntaxUtilities = SyntaxUtilities; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var childCountArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 3, 5, 2, 2, 3, 3, 3, 6, 6, 7, 8, 6, 6, 4, 5, 3, 5, 3, 5, 5, 3, 3, 2, 4, 3, 3, 6, 3, 2, 3, 7, 3, 3, 10, 8, 1, 3, 5, 4, 3, 7, 2, 5, 2, 2, 2, 2, 5, 3, 2, 3, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0, 2, 2, 2, 3, 4, 3, 3, 3, 2, 2, 4, 3, 2, 6, 2, 2, 2, 2, 3, 3, 6, 2, 2, 4, 1]; - function childCount(element) { - if (TypeScript.isList(element)) { - return element.length; - } - return childCountArray[element.kind()]; - } - TypeScript.childCount = childCount; - function sourceUnitChildAt(node, index) { - switch (index) { - case 0: return node.moduleElements; - case 1: return node.endOfFileToken; - } - } - function qualifiedNameChildAt(node, index) { - switch (index) { - case 0: return node.left; - case 1: return node.dotToken; - case 2: return node.right; - } - } - function objectTypeChildAt(node, index) { - switch (index) { - case 0: return node.openBraceToken; - case 1: return node.typeMembers; - case 2: return node.closeBraceToken; - } - } - function functionTypeChildAt(node, index) { - switch (index) { - case 0: return node.typeParameterList; - case 1: return node.parameterList; - case 2: return node.equalsGreaterThanToken; - case 3: return node.type; - } - } - function arrayTypeChildAt(node, index) { - switch (index) { - case 0: return node.type; - case 1: return node.openBracketToken; - case 2: return node.closeBracketToken; - } - } - function constructorTypeChildAt(node, index) { - switch (index) { - case 0: return node.newKeyword; - case 1: return node.typeParameterList; - case 2: return node.parameterList; - case 3: return node.equalsGreaterThanToken; - case 4: return node.type; - } - } - function genericTypeChildAt(node, index) { - switch (index) { - case 0: return node.name; - case 1: return node.typeArgumentList; - } - } - function typeQueryChildAt(node, index) { - switch (index) { - case 0: return node.typeOfKeyword; - case 1: return node.name; - } - } - function tupleTypeChildAt(node, index) { - switch (index) { - case 0: return node.openBracketToken; - case 1: return node.types; - case 2: return node.closeBracketToken; - } - } - function unionTypeChildAt(node, index) { - switch (index) { - case 0: return node.left; - case 1: return node.barToken; - case 2: return node.right; - } - } - function parenthesizedTypeChildAt(node, index) { - switch (index) { - case 0: return node.openParenToken; - case 1: return node.type; - case 2: return node.closeParenToken; - } - } - function interfaceDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.interfaceKeyword; - case 2: return node.identifier; - case 3: return node.typeParameterList; - case 4: return node.heritageClauses; - case 5: return node.body; - } - } - function functionDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.functionKeyword; - case 2: return node.identifier; - case 3: return node.callSignature; - case 4: return node.block; - case 5: return node.semicolonToken; - } - } - function moduleDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.moduleKeyword; - case 2: return node.name; - case 3: return node.stringLiteral; - case 4: return node.openBraceToken; - case 5: return node.moduleElements; - case 6: return node.closeBraceToken; - } - } - function classDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.classKeyword; - case 2: return node.identifier; - case 3: return node.typeParameterList; - case 4: return node.heritageClauses; - case 5: return node.openBraceToken; - case 6: return node.classElements; - case 7: return node.closeBraceToken; - } - } - function enumDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.enumKeyword; - case 2: return node.identifier; - case 3: return node.openBraceToken; - case 4: return node.enumElements; - case 5: return node.closeBraceToken; - } - } - function importDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.importKeyword; - case 2: return node.identifier; - case 3: return node.equalsToken; - case 4: return node.moduleReference; - case 5: return node.semicolonToken; - } - } - function exportAssignmentChildAt(node, index) { - switch (index) { - case 0: return node.exportKeyword; - case 1: return node.equalsToken; - case 2: return node.identifier; - case 3: return node.semicolonToken; - } - } - function memberFunctionDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.propertyName; - case 2: return node.callSignature; - case 3: return node.block; - case 4: return node.semicolonToken; - } - } - function memberVariableDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.variableDeclarator; - case 2: return node.semicolonToken; - } - } - function constructorDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.constructorKeyword; - case 2: return node.callSignature; - case 3: return node.block; - case 4: return node.semicolonToken; - } - } - function indexMemberDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.indexSignature; - case 2: return node.semicolonToken; - } - } - function getAccessorChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.getKeyword; - case 2: return node.propertyName; - case 3: return node.callSignature; - case 4: return node.block; - } - } - function setAccessorChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.setKeyword; - case 2: return node.propertyName; - case 3: return node.callSignature; - case 4: return node.block; - } - } - function propertySignatureChildAt(node, index) { - switch (index) { - case 0: return node.propertyName; - case 1: return node.questionToken; - case 2: return node.typeAnnotation; - } - } - function callSignatureChildAt(node, index) { - switch (index) { - case 0: return node.typeParameterList; - case 1: return node.parameterList; - case 2: return node.typeAnnotation; - } - } - function constructSignatureChildAt(node, index) { - switch (index) { - case 0: return node.newKeyword; - case 1: return node.callSignature; - } - } - function indexSignatureChildAt(node, index) { - switch (index) { - case 0: return node.openBracketToken; - case 1: return node.parameters; - case 2: return node.closeBracketToken; - case 3: return node.typeAnnotation; - } - } - function methodSignatureChildAt(node, index) { - switch (index) { - case 0: return node.propertyName; - case 1: return node.questionToken; - case 2: return node.callSignature; - } - } - function blockChildAt(node, index) { - switch (index) { - case 0: return node.openBraceToken; - case 1: return node.statements; - case 2: return node.closeBraceToken; - } - } - function ifStatementChildAt(node, index) { - switch (index) { - case 0: return node.ifKeyword; - case 1: return node.openParenToken; - case 2: return node.condition; - case 3: return node.closeParenToken; - case 4: return node.statement; - case 5: return node.elseClause; - } - } - function variableStatementChildAt(node, index) { - switch (index) { - case 0: return node.modifiers; - case 1: return node.variableDeclaration; - case 2: return node.semicolonToken; - } - } - function expressionStatementChildAt(node, index) { - switch (index) { - case 0: return node.expression; - case 1: return node.semicolonToken; - } - } - function returnStatementChildAt(node, index) { - switch (index) { - case 0: return node.returnKeyword; - case 1: return node.expression; - case 2: return node.semicolonToken; - } - } - function switchStatementChildAt(node, index) { - switch (index) { - case 0: return node.switchKeyword; - case 1: return node.openParenToken; - case 2: return node.expression; - case 3: return node.closeParenToken; - case 4: return node.openBraceToken; - case 5: return node.switchClauses; - case 6: return node.closeBraceToken; - } - } - function breakStatementChildAt(node, index) { - switch (index) { - case 0: return node.breakKeyword; - case 1: return node.identifier; - case 2: return node.semicolonToken; - } - } - function continueStatementChildAt(node, index) { - switch (index) { - case 0: return node.continueKeyword; - case 1: return node.identifier; - case 2: return node.semicolonToken; - } - } - function forStatementChildAt(node, index) { - switch (index) { - case 0: return node.forKeyword; - case 1: return node.openParenToken; - case 2: return node.variableDeclaration; - case 3: return node.initializer; - case 4: return node.firstSemicolonToken; - case 5: return node.condition; - case 6: return node.secondSemicolonToken; - case 7: return node.incrementor; - case 8: return node.closeParenToken; - case 9: return node.statement; - } - } - function forInStatementChildAt(node, index) { - switch (index) { - case 0: return node.forKeyword; - case 1: return node.openParenToken; - case 2: return node.variableDeclaration; - case 3: return node.left; - case 4: return node.inKeyword; - case 5: return node.expression; - case 6: return node.closeParenToken; - case 7: return node.statement; - } - } - function emptyStatementChildAt(node, index) { - switch (index) { - case 0: return node.semicolonToken; - } - } - function throwStatementChildAt(node, index) { - switch (index) { - case 0: return node.throwKeyword; - case 1: return node.expression; - case 2: return node.semicolonToken; - } - } - function whileStatementChildAt(node, index) { - switch (index) { - case 0: return node.whileKeyword; - case 1: return node.openParenToken; - case 2: return node.condition; - case 3: return node.closeParenToken; - case 4: return node.statement; - } - } - function tryStatementChildAt(node, index) { - switch (index) { - case 0: return node.tryKeyword; - case 1: return node.block; - case 2: return node.catchClause; - case 3: return node.finallyClause; - } - } - function labeledStatementChildAt(node, index) { - switch (index) { - case 0: return node.identifier; - case 1: return node.colonToken; - case 2: return node.statement; - } - } - function doStatementChildAt(node, index) { - switch (index) { - case 0: return node.doKeyword; - case 1: return node.statement; - case 2: return node.whileKeyword; - case 3: return node.openParenToken; - case 4: return node.condition; - case 5: return node.closeParenToken; - case 6: return node.semicolonToken; - } - } - function debuggerStatementChildAt(node, index) { - switch (index) { - case 0: return node.debuggerKeyword; - case 1: return node.semicolonToken; - } - } - function withStatementChildAt(node, index) { - switch (index) { - case 0: return node.withKeyword; - case 1: return node.openParenToken; - case 2: return node.condition; - case 3: return node.closeParenToken; - case 4: return node.statement; - } - } - function prefixUnaryExpressionChildAt(node, index) { - switch (index) { - case 0: return node.operatorToken; - case 1: return node.operand; - } - } - function deleteExpressionChildAt(node, index) { - switch (index) { - case 0: return node.deleteKeyword; - case 1: return node.expression; - } - } - function typeOfExpressionChildAt(node, index) { - switch (index) { - case 0: return node.typeOfKeyword; - case 1: return node.expression; - } - } - function voidExpressionChildAt(node, index) { - switch (index) { - case 0: return node.voidKeyword; - case 1: return node.expression; - } - } - function conditionalExpressionChildAt(node, index) { - switch (index) { - case 0: return node.condition; - case 1: return node.questionToken; - case 2: return node.whenTrue; - case 3: return node.colonToken; - case 4: return node.whenFalse; - } - } - function binaryExpressionChildAt(node, index) { - switch (index) { - case 0: return node.left; - case 1: return node.operatorToken; - case 2: return node.right; - } - } - function postfixUnaryExpressionChildAt(node, index) { - switch (index) { - case 0: return node.operand; - case 1: return node.operatorToken; - } - } - function memberAccessExpressionChildAt(node, index) { - switch (index) { - case 0: return node.expression; - case 1: return node.dotToken; - case 2: return node.name; - } - } - function invocationExpressionChildAt(node, index) { - switch (index) { - case 0: return node.expression; - case 1: return node.argumentList; - } - } - function arrayLiteralExpressionChildAt(node, index) { - switch (index) { - case 0: return node.openBracketToken; - case 1: return node.expressions; - case 2: return node.closeBracketToken; - } - } - function objectLiteralExpressionChildAt(node, index) { - switch (index) { - case 0: return node.openBraceToken; - case 1: return node.propertyAssignments; - case 2: return node.closeBraceToken; - } - } - function objectCreationExpressionChildAt(node, index) { - switch (index) { - case 0: return node.newKeyword; - case 1: return node.expression; - case 2: return node.argumentList; - } - } - function parenthesizedExpressionChildAt(node, index) { - switch (index) { - case 0: return node.openParenToken; - case 1: return node.expression; - case 2: return node.closeParenToken; - } - } - function parenthesizedArrowFunctionExpressionChildAt(node, index) { - switch (index) { - case 0: return node.callSignature; - case 1: return node.equalsGreaterThanToken; - case 2: return node.block; - case 3: return node.expression; - } - } - function simpleArrowFunctionExpressionChildAt(node, index) { - switch (index) { - case 0: return node.parameter; - case 1: return node.equalsGreaterThanToken; - case 2: return node.block; - case 3: return node.expression; - } - } - function castExpressionChildAt(node, index) { - switch (index) { - case 0: return node.lessThanToken; - case 1: return node.type; - case 2: return node.greaterThanToken; - case 3: return node.expression; - } - } - function elementAccessExpressionChildAt(node, index) { - switch (index) { - case 0: return node.expression; - case 1: return node.openBracketToken; - case 2: return node.argumentExpression; - case 3: return node.closeBracketToken; - } - } - function functionExpressionChildAt(node, index) { - switch (index) { - case 0: return node.functionKeyword; - case 1: return node.identifier; - case 2: return node.callSignature; - case 3: return node.block; - } - } - function omittedExpressionChildAt(node, index) { - throw TypeScript.Errors.invalidOperation(); - } - function templateExpressionChildAt(node, index) { - switch (index) { - case 0: return node.templateStartToken; - case 1: return node.templateClauses; - } - } - function templateAccessExpressionChildAt(node, index) { - switch (index) { - case 0: return node.expression; - case 1: return node.templateExpression; - } - } - function variableDeclarationChildAt(node, index) { - switch (index) { - case 0: return node.varKeyword; - case 1: return node.variableDeclarators; - } - } - function variableDeclaratorChildAt(node, index) { - switch (index) { - case 0: return node.propertyName; - case 1: return node.typeAnnotation; - case 2: return node.equalsValueClause; - } - } - function argumentListChildAt(node, index) { - switch (index) { - case 0: return node.typeArgumentList; - case 1: return node.openParenToken; - case 2: return node.arguments; - case 3: return node.closeParenToken; - } - } - function parameterListChildAt(node, index) { - switch (index) { - case 0: return node.openParenToken; - case 1: return node.parameters; - case 2: return node.closeParenToken; - } - } - function typeArgumentListChildAt(node, index) { - switch (index) { - case 0: return node.lessThanToken; - case 1: return node.typeArguments; - case 2: return node.greaterThanToken; - } - } - function typeParameterListChildAt(node, index) { - switch (index) { - case 0: return node.lessThanToken; - case 1: return node.typeParameters; - case 2: return node.greaterThanToken; - } - } - function heritageClauseChildAt(node, index) { - switch (index) { - case 0: return node.extendsOrImplementsKeyword; - case 1: return node.typeNames; - } - } - function equalsValueClauseChildAt(node, index) { - switch (index) { - case 0: return node.equalsToken; - case 1: return node.value; - } - } - function caseSwitchClauseChildAt(node, index) { - switch (index) { - case 0: return node.caseKeyword; - case 1: return node.expression; - case 2: return node.colonToken; - case 3: return node.statements; - } - } - function defaultSwitchClauseChildAt(node, index) { - switch (index) { - case 0: return node.defaultKeyword; - case 1: return node.colonToken; - case 2: return node.statements; - } - } - function elseClauseChildAt(node, index) { - switch (index) { - case 0: return node.elseKeyword; - case 1: return node.statement; - } - } - function catchClauseChildAt(node, index) { - switch (index) { - case 0: return node.catchKeyword; - case 1: return node.openParenToken; - case 2: return node.identifier; - case 3: return node.typeAnnotation; - case 4: return node.closeParenToken; - case 5: return node.block; - } - } - function finallyClauseChildAt(node, index) { - switch (index) { - case 0: return node.finallyKeyword; - case 1: return node.block; - } - } - function templateClauseChildAt(node, index) { - switch (index) { - case 0: return node.expression; - case 1: return node.templateMiddleOrEndToken; - } - } - function typeParameterChildAt(node, index) { - switch (index) { - case 0: return node.identifier; - case 1: return node.constraint; - } - } - function constraintChildAt(node, index) { - switch (index) { - case 0: return node.extendsKeyword; - case 1: return node.typeOrExpression; - } - } - function simplePropertyAssignmentChildAt(node, index) { - switch (index) { - case 0: return node.propertyName; - case 1: return node.colonToken; - case 2: return node.expression; - } - } - function functionPropertyAssignmentChildAt(node, index) { - switch (index) { - case 0: return node.propertyName; - case 1: return node.callSignature; - case 2: return node.block; - } - } - function parameterChildAt(node, index) { - switch (index) { - case 0: return node.dotDotDotToken; - case 1: return node.modifiers; - case 2: return node.identifier; - case 3: return node.questionToken; - case 4: return node.typeAnnotation; - case 5: return node.equalsValueClause; - } - } - function enumElementChildAt(node, index) { - switch (index) { - case 0: return node.propertyName; - case 1: return node.equalsValueClause; - } - } - function typeAnnotationChildAt(node, index) { - switch (index) { - case 0: return node.colonToken; - case 1: return node.type; - } - } - function externalModuleReferenceChildAt(node, index) { - switch (index) { - case 0: return node.requireKeyword; - case 1: return node.openParenToken; - case 2: return node.stringLiteral; - case 3: return node.closeParenToken; - } - } - function moduleNameModuleReferenceChildAt(node, index) { - switch (index) { - case 0: return node.moduleName; - } - } - function childAt(element, index) { - if (TypeScript.isList(element)) { - return element[index]; - } - switch (element.kind()) { - case 122 /* SourceUnit */: return sourceUnitChildAt(element, index); - case 123 /* QualifiedName */: return qualifiedNameChildAt(element, index); - case 124 /* ObjectType */: return objectTypeChildAt(element, index); - case 125 /* FunctionType */: return functionTypeChildAt(element, index); - case 126 /* ArrayType */: return arrayTypeChildAt(element, index); - case 127 /* ConstructorType */: return constructorTypeChildAt(element, index); - case 128 /* GenericType */: return genericTypeChildAt(element, index); - case 129 /* TypeQuery */: return typeQueryChildAt(element, index); - case 130 /* TupleType */: return tupleTypeChildAt(element, index); - case 131 /* UnionType */: return unionTypeChildAt(element, index); - case 132 /* ParenthesizedType */: return parenthesizedTypeChildAt(element, index); - case 133 /* InterfaceDeclaration */: return interfaceDeclarationChildAt(element, index); - case 134 /* FunctionDeclaration */: return functionDeclarationChildAt(element, index); - case 135 /* ModuleDeclaration */: return moduleDeclarationChildAt(element, index); - case 136 /* ClassDeclaration */: return classDeclarationChildAt(element, index); - case 137 /* EnumDeclaration */: return enumDeclarationChildAt(element, index); - case 138 /* ImportDeclaration */: return importDeclarationChildAt(element, index); - case 139 /* ExportAssignment */: return exportAssignmentChildAt(element, index); - case 140 /* MemberFunctionDeclaration */: return memberFunctionDeclarationChildAt(element, index); - case 141 /* MemberVariableDeclaration */: return memberVariableDeclarationChildAt(element, index); - case 142 /* ConstructorDeclaration */: return constructorDeclarationChildAt(element, index); - case 143 /* IndexMemberDeclaration */: return indexMemberDeclarationChildAt(element, index); - case 144 /* GetAccessor */: return getAccessorChildAt(element, index); - case 145 /* SetAccessor */: return setAccessorChildAt(element, index); - case 146 /* PropertySignature */: return propertySignatureChildAt(element, index); - case 147 /* CallSignature */: return callSignatureChildAt(element, index); - case 148 /* ConstructSignature */: return constructSignatureChildAt(element, index); - case 149 /* IndexSignature */: return indexSignatureChildAt(element, index); - case 150 /* MethodSignature */: return methodSignatureChildAt(element, index); - case 151 /* Block */: return blockChildAt(element, index); - case 152 /* IfStatement */: return ifStatementChildAt(element, index); - case 153 /* VariableStatement */: return variableStatementChildAt(element, index); - case 154 /* ExpressionStatement */: return expressionStatementChildAt(element, index); - case 155 /* ReturnStatement */: return returnStatementChildAt(element, index); - case 156 /* SwitchStatement */: return switchStatementChildAt(element, index); - case 157 /* BreakStatement */: return breakStatementChildAt(element, index); - case 158 /* ContinueStatement */: return continueStatementChildAt(element, index); - case 159 /* ForStatement */: return forStatementChildAt(element, index); - case 160 /* ForInStatement */: return forInStatementChildAt(element, index); - case 161 /* EmptyStatement */: return emptyStatementChildAt(element, index); - case 162 /* ThrowStatement */: return throwStatementChildAt(element, index); - case 163 /* WhileStatement */: return whileStatementChildAt(element, index); - case 164 /* TryStatement */: return tryStatementChildAt(element, index); - case 165 /* LabeledStatement */: return labeledStatementChildAt(element, index); - case 166 /* DoStatement */: return doStatementChildAt(element, index); - case 167 /* DebuggerStatement */: return debuggerStatementChildAt(element, index); - case 168 /* WithStatement */: return withStatementChildAt(element, index); - case 169 /* PrefixUnaryExpression */: return prefixUnaryExpressionChildAt(element, index); - case 170 /* DeleteExpression */: return deleteExpressionChildAt(element, index); - case 171 /* TypeOfExpression */: return typeOfExpressionChildAt(element, index); - case 172 /* VoidExpression */: return voidExpressionChildAt(element, index); - case 173 /* ConditionalExpression */: return conditionalExpressionChildAt(element, index); - case 174 /* BinaryExpression */: return binaryExpressionChildAt(element, index); - case 175 /* PostfixUnaryExpression */: return postfixUnaryExpressionChildAt(element, index); - case 176 /* MemberAccessExpression */: return memberAccessExpressionChildAt(element, index); - case 177 /* InvocationExpression */: return invocationExpressionChildAt(element, index); - case 178 /* ArrayLiteralExpression */: return arrayLiteralExpressionChildAt(element, index); - case 179 /* ObjectLiteralExpression */: return objectLiteralExpressionChildAt(element, index); - case 180 /* ObjectCreationExpression */: return objectCreationExpressionChildAt(element, index); - case 181 /* ParenthesizedExpression */: return parenthesizedExpressionChildAt(element, index); - case 182 /* ParenthesizedArrowFunctionExpression */: return parenthesizedArrowFunctionExpressionChildAt(element, index); - case 183 /* SimpleArrowFunctionExpression */: return simpleArrowFunctionExpressionChildAt(element, index); - case 184 /* CastExpression */: return castExpressionChildAt(element, index); - case 185 /* ElementAccessExpression */: return elementAccessExpressionChildAt(element, index); - case 186 /* FunctionExpression */: return functionExpressionChildAt(element, index); - case 187 /* OmittedExpression */: return omittedExpressionChildAt(element, index); - case 188 /* TemplateExpression */: return templateExpressionChildAt(element, index); - case 189 /* TemplateAccessExpression */: return templateAccessExpressionChildAt(element, index); - case 190 /* VariableDeclaration */: return variableDeclarationChildAt(element, index); - case 191 /* VariableDeclarator */: return variableDeclaratorChildAt(element, index); - case 192 /* ArgumentList */: return argumentListChildAt(element, index); - case 193 /* ParameterList */: return parameterListChildAt(element, index); - case 194 /* TypeArgumentList */: return typeArgumentListChildAt(element, index); - case 195 /* TypeParameterList */: return typeParameterListChildAt(element, index); - case 196 /* HeritageClause */: return heritageClauseChildAt(element, index); - case 197 /* EqualsValueClause */: return equalsValueClauseChildAt(element, index); - case 198 /* CaseSwitchClause */: return caseSwitchClauseChildAt(element, index); - case 199 /* DefaultSwitchClause */: return defaultSwitchClauseChildAt(element, index); - case 200 /* ElseClause */: return elseClauseChildAt(element, index); - case 201 /* CatchClause */: return catchClauseChildAt(element, index); - case 202 /* FinallyClause */: return finallyClauseChildAt(element, index); - case 203 /* TemplateClause */: return templateClauseChildAt(element, index); - case 204 /* TypeParameter */: return typeParameterChildAt(element, index); - case 205 /* Constraint */: return constraintChildAt(element, index); - case 206 /* SimplePropertyAssignment */: return simplePropertyAssignmentChildAt(element, index); - case 207 /* FunctionPropertyAssignment */: return functionPropertyAssignmentChildAt(element, index); - case 208 /* Parameter */: return parameterChildAt(element, index); - case 209 /* EnumElement */: return enumElementChildAt(element, index); - case 210 /* TypeAnnotation */: return typeAnnotationChildAt(element, index); - case 211 /* ExternalModuleReference */: return externalModuleReferenceChildAt(element, index); - case 212 /* ModuleNameModuleReference */: return moduleNameModuleReferenceChildAt(element, index); - } - } - TypeScript.childAt = childAt; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function visitNodeOrToken(visitor, element) { - if (element === undefined) { - return undefined; - } - switch (element.kind()) { - case 122 /* SourceUnit */: return visitor.visitSourceUnit(element); - case 123 /* QualifiedName */: return visitor.visitQualifiedName(element); - case 124 /* ObjectType */: return visitor.visitObjectType(element); - case 125 /* FunctionType */: return visitor.visitFunctionType(element); - case 126 /* ArrayType */: return visitor.visitArrayType(element); - case 127 /* ConstructorType */: return visitor.visitConstructorType(element); - case 128 /* GenericType */: return visitor.visitGenericType(element); - case 129 /* TypeQuery */: return visitor.visitTypeQuery(element); - case 130 /* TupleType */: return visitor.visitTupleType(element); - case 131 /* UnionType */: return visitor.visitUnionType(element); - case 132 /* ParenthesizedType */: return visitor.visitParenthesizedType(element); - case 133 /* InterfaceDeclaration */: return visitor.visitInterfaceDeclaration(element); - case 134 /* FunctionDeclaration */: return visitor.visitFunctionDeclaration(element); - case 135 /* ModuleDeclaration */: return visitor.visitModuleDeclaration(element); - case 136 /* ClassDeclaration */: return visitor.visitClassDeclaration(element); - case 137 /* EnumDeclaration */: return visitor.visitEnumDeclaration(element); - case 138 /* ImportDeclaration */: return visitor.visitImportDeclaration(element); - case 139 /* ExportAssignment */: return visitor.visitExportAssignment(element); - case 140 /* MemberFunctionDeclaration */: return visitor.visitMemberFunctionDeclaration(element); - case 141 /* MemberVariableDeclaration */: return visitor.visitMemberVariableDeclaration(element); - case 142 /* ConstructorDeclaration */: return visitor.visitConstructorDeclaration(element); - case 143 /* IndexMemberDeclaration */: return visitor.visitIndexMemberDeclaration(element); - case 144 /* GetAccessor */: return visitor.visitGetAccessor(element); - case 145 /* SetAccessor */: return visitor.visitSetAccessor(element); - case 146 /* PropertySignature */: return visitor.visitPropertySignature(element); - case 147 /* CallSignature */: return visitor.visitCallSignature(element); - case 148 /* ConstructSignature */: return visitor.visitConstructSignature(element); - case 149 /* IndexSignature */: return visitor.visitIndexSignature(element); - case 150 /* MethodSignature */: return visitor.visitMethodSignature(element); - case 151 /* Block */: return visitor.visitBlock(element); - case 152 /* IfStatement */: return visitor.visitIfStatement(element); - case 153 /* VariableStatement */: return visitor.visitVariableStatement(element); - case 154 /* ExpressionStatement */: return visitor.visitExpressionStatement(element); - case 155 /* ReturnStatement */: return visitor.visitReturnStatement(element); - case 156 /* SwitchStatement */: return visitor.visitSwitchStatement(element); - case 157 /* BreakStatement */: return visitor.visitBreakStatement(element); - case 158 /* ContinueStatement */: return visitor.visitContinueStatement(element); - case 159 /* ForStatement */: return visitor.visitForStatement(element); - case 160 /* ForInStatement */: return visitor.visitForInStatement(element); - case 161 /* EmptyStatement */: return visitor.visitEmptyStatement(element); - case 162 /* ThrowStatement */: return visitor.visitThrowStatement(element); - case 163 /* WhileStatement */: return visitor.visitWhileStatement(element); - case 164 /* TryStatement */: return visitor.visitTryStatement(element); - case 165 /* LabeledStatement */: return visitor.visitLabeledStatement(element); - case 166 /* DoStatement */: return visitor.visitDoStatement(element); - case 167 /* DebuggerStatement */: return visitor.visitDebuggerStatement(element); - case 168 /* WithStatement */: return visitor.visitWithStatement(element); - case 169 /* PrefixUnaryExpression */: return visitor.visitPrefixUnaryExpression(element); - case 170 /* DeleteExpression */: return visitor.visitDeleteExpression(element); - case 171 /* TypeOfExpression */: return visitor.visitTypeOfExpression(element); - case 172 /* VoidExpression */: return visitor.visitVoidExpression(element); - case 173 /* ConditionalExpression */: return visitor.visitConditionalExpression(element); - case 174 /* BinaryExpression */: return visitor.visitBinaryExpression(element); - case 175 /* PostfixUnaryExpression */: return visitor.visitPostfixUnaryExpression(element); - case 176 /* MemberAccessExpression */: return visitor.visitMemberAccessExpression(element); - case 177 /* InvocationExpression */: return visitor.visitInvocationExpression(element); - case 178 /* ArrayLiteralExpression */: return visitor.visitArrayLiteralExpression(element); - case 179 /* ObjectLiteralExpression */: return visitor.visitObjectLiteralExpression(element); - case 180 /* ObjectCreationExpression */: return visitor.visitObjectCreationExpression(element); - case 181 /* ParenthesizedExpression */: return visitor.visitParenthesizedExpression(element); - case 182 /* ParenthesizedArrowFunctionExpression */: return visitor.visitParenthesizedArrowFunctionExpression(element); - case 183 /* SimpleArrowFunctionExpression */: return visitor.visitSimpleArrowFunctionExpression(element); - case 184 /* CastExpression */: return visitor.visitCastExpression(element); - case 185 /* ElementAccessExpression */: return visitor.visitElementAccessExpression(element); - case 186 /* FunctionExpression */: return visitor.visitFunctionExpression(element); - case 187 /* OmittedExpression */: return visitor.visitOmittedExpression(element); - case 188 /* TemplateExpression */: return visitor.visitTemplateExpression(element); - case 189 /* TemplateAccessExpression */: return visitor.visitTemplateAccessExpression(element); - case 190 /* VariableDeclaration */: return visitor.visitVariableDeclaration(element); - case 191 /* VariableDeclarator */: return visitor.visitVariableDeclarator(element); - case 192 /* ArgumentList */: return visitor.visitArgumentList(element); - case 193 /* ParameterList */: return visitor.visitParameterList(element); - case 194 /* TypeArgumentList */: return visitor.visitTypeArgumentList(element); - case 195 /* TypeParameterList */: return visitor.visitTypeParameterList(element); - case 196 /* HeritageClause */: return visitor.visitHeritageClause(element); - case 197 /* EqualsValueClause */: return visitor.visitEqualsValueClause(element); - case 198 /* CaseSwitchClause */: return visitor.visitCaseSwitchClause(element); - case 199 /* DefaultSwitchClause */: return visitor.visitDefaultSwitchClause(element); - case 200 /* ElseClause */: return visitor.visitElseClause(element); - case 201 /* CatchClause */: return visitor.visitCatchClause(element); - case 202 /* FinallyClause */: return visitor.visitFinallyClause(element); - case 203 /* TemplateClause */: return visitor.visitTemplateClause(element); - case 204 /* TypeParameter */: return visitor.visitTypeParameter(element); - case 205 /* Constraint */: return visitor.visitConstraint(element); - case 206 /* SimplePropertyAssignment */: return visitor.visitSimplePropertyAssignment(element); - case 207 /* FunctionPropertyAssignment */: return visitor.visitFunctionPropertyAssignment(element); - case 208 /* Parameter */: return visitor.visitParameter(element); - case 209 /* EnumElement */: return visitor.visitEnumElement(element); - case 210 /* TypeAnnotation */: return visitor.visitTypeAnnotation(element); - case 211 /* ExternalModuleReference */: return visitor.visitExternalModuleReference(element); - case 212 /* ModuleNameModuleReference */: return visitor.visitModuleNameModuleReference(element); - default: return visitor.visitToken(element); - } - } - TypeScript.visitNodeOrToken = visitNodeOrToken; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var SyntaxWalker = (function () { - function SyntaxWalker() { - } - SyntaxWalker.prototype.visitToken = function (token) { - }; - SyntaxWalker.prototype.visitOptionalToken = function (token) { - if (token === undefined) { - return; - } - this.visitToken(token); - }; - SyntaxWalker.prototype.visitList = function (list) { - for (var i = 0, n = list.length; i < n; i++) { - TypeScript.visitNodeOrToken(this, list[i]); - } - }; - SyntaxWalker.prototype.visitSourceUnit = function (node) { - this.visitList(node.moduleElements); - this.visitToken(node.endOfFileToken); - }; - SyntaxWalker.prototype.visitQualifiedName = function (node) { - TypeScript.visitNodeOrToken(this, node.left); - this.visitToken(node.dotToken); - this.visitToken(node.right); - }; - SyntaxWalker.prototype.visitObjectType = function (node) { - this.visitToken(node.openBraceToken); - this.visitList(node.typeMembers); - this.visitToken(node.closeBraceToken); - }; - SyntaxWalker.prototype.visitFunctionType = function (node) { - TypeScript.visitNodeOrToken(this, node.typeParameterList); - TypeScript.visitNodeOrToken(this, node.parameterList); - this.visitToken(node.equalsGreaterThanToken); - TypeScript.visitNodeOrToken(this, node.type); - }; - SyntaxWalker.prototype.visitArrayType = function (node) { - TypeScript.visitNodeOrToken(this, node.type); - this.visitToken(node.openBracketToken); - this.visitToken(node.closeBracketToken); - }; - SyntaxWalker.prototype.visitConstructorType = function (node) { - this.visitToken(node.newKeyword); - TypeScript.visitNodeOrToken(this, node.typeParameterList); - TypeScript.visitNodeOrToken(this, node.parameterList); - this.visitToken(node.equalsGreaterThanToken); - TypeScript.visitNodeOrToken(this, node.type); - }; - SyntaxWalker.prototype.visitGenericType = function (node) { - TypeScript.visitNodeOrToken(this, node.name); - TypeScript.visitNodeOrToken(this, node.typeArgumentList); - }; - SyntaxWalker.prototype.visitTypeQuery = function (node) { - this.visitToken(node.typeOfKeyword); - TypeScript.visitNodeOrToken(this, node.name); - }; - SyntaxWalker.prototype.visitTupleType = function (node) { - this.visitToken(node.openBracketToken); - this.visitList(node.types); - this.visitToken(node.closeBracketToken); - }; - SyntaxWalker.prototype.visitUnionType = function (node) { - TypeScript.visitNodeOrToken(this, node.left); - this.visitToken(node.barToken); - TypeScript.visitNodeOrToken(this, node.right); - }; - SyntaxWalker.prototype.visitParenthesizedType = function (node) { - this.visitToken(node.openParenToken); - TypeScript.visitNodeOrToken(this, node.type); - this.visitToken(node.closeParenToken); - }; - SyntaxWalker.prototype.visitInterfaceDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.interfaceKeyword); - this.visitToken(node.identifier); - TypeScript.visitNodeOrToken(this, node.typeParameterList); - this.visitList(node.heritageClauses); - TypeScript.visitNodeOrToken(this, node.body); - }; - SyntaxWalker.prototype.visitFunctionDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.functionKeyword); - this.visitToken(node.identifier); - TypeScript.visitNodeOrToken(this, node.callSignature); - TypeScript.visitNodeOrToken(this, node.block); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitModuleDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.moduleKeyword); - TypeScript.visitNodeOrToken(this, node.name); - this.visitOptionalToken(node.stringLiteral); - this.visitToken(node.openBraceToken); - this.visitList(node.moduleElements); - this.visitToken(node.closeBraceToken); - }; - SyntaxWalker.prototype.visitClassDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.classKeyword); - this.visitToken(node.identifier); - TypeScript.visitNodeOrToken(this, node.typeParameterList); - this.visitList(node.heritageClauses); - this.visitToken(node.openBraceToken); - this.visitList(node.classElements); - this.visitToken(node.closeBraceToken); - }; - SyntaxWalker.prototype.visitEnumDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.enumKeyword); - this.visitToken(node.identifier); - this.visitToken(node.openBraceToken); - this.visitList(node.enumElements); - this.visitToken(node.closeBraceToken); - }; - SyntaxWalker.prototype.visitImportDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.importKeyword); - this.visitToken(node.identifier); - this.visitToken(node.equalsToken); - TypeScript.visitNodeOrToken(this, node.moduleReference); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitExportAssignment = function (node) { - this.visitToken(node.exportKeyword); - this.visitToken(node.equalsToken); - this.visitToken(node.identifier); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitMemberFunctionDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.propertyName); - TypeScript.visitNodeOrToken(this, node.callSignature); - TypeScript.visitNodeOrToken(this, node.block); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitMemberVariableDeclaration = function (node) { - this.visitList(node.modifiers); - TypeScript.visitNodeOrToken(this, node.variableDeclarator); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitConstructorDeclaration = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.constructorKeyword); - TypeScript.visitNodeOrToken(this, node.callSignature); - TypeScript.visitNodeOrToken(this, node.block); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitIndexMemberDeclaration = function (node) { - this.visitList(node.modifiers); - TypeScript.visitNodeOrToken(this, node.indexSignature); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitGetAccessor = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.getKeyword); - this.visitToken(node.propertyName); - TypeScript.visitNodeOrToken(this, node.callSignature); - TypeScript.visitNodeOrToken(this, node.block); - }; - SyntaxWalker.prototype.visitSetAccessor = function (node) { - this.visitList(node.modifiers); - this.visitToken(node.setKeyword); - this.visitToken(node.propertyName); - TypeScript.visitNodeOrToken(this, node.callSignature); - TypeScript.visitNodeOrToken(this, node.block); - }; - SyntaxWalker.prototype.visitPropertySignature = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalToken(node.questionToken); - TypeScript.visitNodeOrToken(this, node.typeAnnotation); - }; - SyntaxWalker.prototype.visitCallSignature = function (node) { - TypeScript.visitNodeOrToken(this, node.typeParameterList); - TypeScript.visitNodeOrToken(this, node.parameterList); - TypeScript.visitNodeOrToken(this, node.typeAnnotation); - }; - SyntaxWalker.prototype.visitConstructSignature = function (node) { - this.visitToken(node.newKeyword); - TypeScript.visitNodeOrToken(this, node.callSignature); - }; - SyntaxWalker.prototype.visitIndexSignature = function (node) { - this.visitToken(node.openBracketToken); - this.visitList(node.parameters); - this.visitToken(node.closeBracketToken); - TypeScript.visitNodeOrToken(this, node.typeAnnotation); - }; - SyntaxWalker.prototype.visitMethodSignature = function (node) { - this.visitToken(node.propertyName); - this.visitOptionalToken(node.questionToken); - TypeScript.visitNodeOrToken(this, node.callSignature); - }; - SyntaxWalker.prototype.visitBlock = function (node) { - this.visitToken(node.openBraceToken); - this.visitList(node.statements); - this.visitToken(node.closeBraceToken); - }; - SyntaxWalker.prototype.visitIfStatement = function (node) { - this.visitToken(node.ifKeyword); - this.visitToken(node.openParenToken); - TypeScript.visitNodeOrToken(this, node.condition); - this.visitToken(node.closeParenToken); - TypeScript.visitNodeOrToken(this, node.statement); - TypeScript.visitNodeOrToken(this, node.elseClause); - }; - SyntaxWalker.prototype.visitVariableStatement = function (node) { - this.visitList(node.modifiers); - TypeScript.visitNodeOrToken(this, node.variableDeclaration); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitExpressionStatement = function (node) { - TypeScript.visitNodeOrToken(this, node.expression); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitReturnStatement = function (node) { - this.visitToken(node.returnKeyword); - TypeScript.visitNodeOrToken(this, node.expression); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitSwitchStatement = function (node) { - this.visitToken(node.switchKeyword); - this.visitToken(node.openParenToken); - TypeScript.visitNodeOrToken(this, node.expression); - this.visitToken(node.closeParenToken); - this.visitToken(node.openBraceToken); - this.visitList(node.switchClauses); - this.visitToken(node.closeBraceToken); - }; - SyntaxWalker.prototype.visitBreakStatement = function (node) { - this.visitToken(node.breakKeyword); - this.visitOptionalToken(node.identifier); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitContinueStatement = function (node) { - this.visitToken(node.continueKeyword); - this.visitOptionalToken(node.identifier); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitForStatement = function (node) { - this.visitToken(node.forKeyword); - this.visitToken(node.openParenToken); - TypeScript.visitNodeOrToken(this, node.variableDeclaration); - TypeScript.visitNodeOrToken(this, node.initializer); - this.visitToken(node.firstSemicolonToken); - TypeScript.visitNodeOrToken(this, node.condition); - this.visitToken(node.secondSemicolonToken); - TypeScript.visitNodeOrToken(this, node.incrementor); - this.visitToken(node.closeParenToken); - TypeScript.visitNodeOrToken(this, node.statement); - }; - SyntaxWalker.prototype.visitForInStatement = function (node) { - this.visitToken(node.forKeyword); - this.visitToken(node.openParenToken); - TypeScript.visitNodeOrToken(this, node.variableDeclaration); - TypeScript.visitNodeOrToken(this, node.left); - this.visitToken(node.inKeyword); - TypeScript.visitNodeOrToken(this, node.expression); - this.visitToken(node.closeParenToken); - TypeScript.visitNodeOrToken(this, node.statement); - }; - SyntaxWalker.prototype.visitEmptyStatement = function (node) { - this.visitToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitThrowStatement = function (node) { - this.visitToken(node.throwKeyword); - TypeScript.visitNodeOrToken(this, node.expression); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitWhileStatement = function (node) { - this.visitToken(node.whileKeyword); - this.visitToken(node.openParenToken); - TypeScript.visitNodeOrToken(this, node.condition); - this.visitToken(node.closeParenToken); - TypeScript.visitNodeOrToken(this, node.statement); - }; - SyntaxWalker.prototype.visitTryStatement = function (node) { - this.visitToken(node.tryKeyword); - TypeScript.visitNodeOrToken(this, node.block); - TypeScript.visitNodeOrToken(this, node.catchClause); - TypeScript.visitNodeOrToken(this, node.finallyClause); - }; - SyntaxWalker.prototype.visitLabeledStatement = function (node) { - this.visitToken(node.identifier); - this.visitToken(node.colonToken); - TypeScript.visitNodeOrToken(this, node.statement); - }; - SyntaxWalker.prototype.visitDoStatement = function (node) { - this.visitToken(node.doKeyword); - TypeScript.visitNodeOrToken(this, node.statement); - this.visitToken(node.whileKeyword); - this.visitToken(node.openParenToken); - TypeScript.visitNodeOrToken(this, node.condition); - this.visitToken(node.closeParenToken); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitDebuggerStatement = function (node) { - this.visitToken(node.debuggerKeyword); - this.visitOptionalToken(node.semicolonToken); - }; - SyntaxWalker.prototype.visitWithStatement = function (node) { - this.visitToken(node.withKeyword); - this.visitToken(node.openParenToken); - TypeScript.visitNodeOrToken(this, node.condition); - this.visitToken(node.closeParenToken); - TypeScript.visitNodeOrToken(this, node.statement); - }; - SyntaxWalker.prototype.visitPrefixUnaryExpression = function (node) { - this.visitToken(node.operatorToken); - TypeScript.visitNodeOrToken(this, node.operand); - }; - SyntaxWalker.prototype.visitDeleteExpression = function (node) { - this.visitToken(node.deleteKeyword); - TypeScript.visitNodeOrToken(this, node.expression); - }; - SyntaxWalker.prototype.visitTypeOfExpression = function (node) { - this.visitToken(node.typeOfKeyword); - TypeScript.visitNodeOrToken(this, node.expression); - }; - SyntaxWalker.prototype.visitVoidExpression = function (node) { - this.visitToken(node.voidKeyword); - TypeScript.visitNodeOrToken(this, node.expression); - }; - SyntaxWalker.prototype.visitConditionalExpression = function (node) { - TypeScript.visitNodeOrToken(this, node.condition); - this.visitToken(node.questionToken); - TypeScript.visitNodeOrToken(this, node.whenTrue); - this.visitToken(node.colonToken); - TypeScript.visitNodeOrToken(this, node.whenFalse); - }; - SyntaxWalker.prototype.visitBinaryExpression = function (node) { - TypeScript.visitNodeOrToken(this, node.left); - this.visitToken(node.operatorToken); - TypeScript.visitNodeOrToken(this, node.right); - }; - SyntaxWalker.prototype.visitPostfixUnaryExpression = function (node) { - TypeScript.visitNodeOrToken(this, node.operand); - this.visitToken(node.operatorToken); - }; - SyntaxWalker.prototype.visitMemberAccessExpression = function (node) { - TypeScript.visitNodeOrToken(this, node.expression); - this.visitToken(node.dotToken); - this.visitToken(node.name); - }; - SyntaxWalker.prototype.visitInvocationExpression = function (node) { - TypeScript.visitNodeOrToken(this, node.expression); - TypeScript.visitNodeOrToken(this, node.argumentList); - }; - SyntaxWalker.prototype.visitArrayLiteralExpression = function (node) { - this.visitToken(node.openBracketToken); - this.visitList(node.expressions); - this.visitToken(node.closeBracketToken); - }; - SyntaxWalker.prototype.visitObjectLiteralExpression = function (node) { - this.visitToken(node.openBraceToken); - this.visitList(node.propertyAssignments); - this.visitToken(node.closeBraceToken); - }; - SyntaxWalker.prototype.visitObjectCreationExpression = function (node) { - this.visitToken(node.newKeyword); - TypeScript.visitNodeOrToken(this, node.expression); - TypeScript.visitNodeOrToken(this, node.argumentList); - }; - SyntaxWalker.prototype.visitParenthesizedExpression = function (node) { - this.visitToken(node.openParenToken); - TypeScript.visitNodeOrToken(this, node.expression); - this.visitToken(node.closeParenToken); - }; - SyntaxWalker.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - TypeScript.visitNodeOrToken(this, node.callSignature); - this.visitToken(node.equalsGreaterThanToken); - TypeScript.visitNodeOrToken(this, node.block); - TypeScript.visitNodeOrToken(this, node.expression); - }; - SyntaxWalker.prototype.visitSimpleArrowFunctionExpression = function (node) { - TypeScript.visitNodeOrToken(this, node.parameter); - this.visitToken(node.equalsGreaterThanToken); - TypeScript.visitNodeOrToken(this, node.block); - TypeScript.visitNodeOrToken(this, node.expression); - }; - SyntaxWalker.prototype.visitCastExpression = function (node) { - this.visitToken(node.lessThanToken); - TypeScript.visitNodeOrToken(this, node.type); - this.visitToken(node.greaterThanToken); - TypeScript.visitNodeOrToken(this, node.expression); - }; - SyntaxWalker.prototype.visitElementAccessExpression = function (node) { - TypeScript.visitNodeOrToken(this, node.expression); - this.visitToken(node.openBracketToken); - TypeScript.visitNodeOrToken(this, node.argumentExpression); - this.visitToken(node.closeBracketToken); - }; - SyntaxWalker.prototype.visitFunctionExpression = function (node) { - this.visitToken(node.functionKeyword); - this.visitOptionalToken(node.identifier); - TypeScript.visitNodeOrToken(this, node.callSignature); - TypeScript.visitNodeOrToken(this, node.block); - }; - SyntaxWalker.prototype.visitOmittedExpression = function (node) { - }; - SyntaxWalker.prototype.visitTemplateExpression = function (node) { - this.visitToken(node.templateStartToken); - this.visitList(node.templateClauses); - }; - SyntaxWalker.prototype.visitTemplateAccessExpression = function (node) { - TypeScript.visitNodeOrToken(this, node.expression); - TypeScript.visitNodeOrToken(this, node.templateExpression); - }; - SyntaxWalker.prototype.visitVariableDeclaration = function (node) { - this.visitToken(node.varKeyword); - this.visitList(node.variableDeclarators); - }; - SyntaxWalker.prototype.visitVariableDeclarator = function (node) { - this.visitToken(node.propertyName); - TypeScript.visitNodeOrToken(this, node.typeAnnotation); - TypeScript.visitNodeOrToken(this, node.equalsValueClause); - }; - SyntaxWalker.prototype.visitArgumentList = function (node) { - TypeScript.visitNodeOrToken(this, node.typeArgumentList); - this.visitToken(node.openParenToken); - this.visitList(node.arguments); - this.visitToken(node.closeParenToken); - }; - SyntaxWalker.prototype.visitParameterList = function (node) { - this.visitToken(node.openParenToken); - this.visitList(node.parameters); - this.visitToken(node.closeParenToken); - }; - SyntaxWalker.prototype.visitTypeArgumentList = function (node) { - this.visitToken(node.lessThanToken); - this.visitList(node.typeArguments); - this.visitToken(node.greaterThanToken); - }; - SyntaxWalker.prototype.visitTypeParameterList = function (node) { - this.visitToken(node.lessThanToken); - this.visitList(node.typeParameters); - this.visitToken(node.greaterThanToken); - }; - SyntaxWalker.prototype.visitHeritageClause = function (node) { - this.visitToken(node.extendsOrImplementsKeyword); - this.visitList(node.typeNames); - }; - SyntaxWalker.prototype.visitEqualsValueClause = function (node) { - this.visitToken(node.equalsToken); - TypeScript.visitNodeOrToken(this, node.value); - }; - SyntaxWalker.prototype.visitCaseSwitchClause = function (node) { - this.visitToken(node.caseKeyword); - TypeScript.visitNodeOrToken(this, node.expression); - this.visitToken(node.colonToken); - this.visitList(node.statements); - }; - SyntaxWalker.prototype.visitDefaultSwitchClause = function (node) { - this.visitToken(node.defaultKeyword); - this.visitToken(node.colonToken); - this.visitList(node.statements); - }; - SyntaxWalker.prototype.visitElseClause = function (node) { - this.visitToken(node.elseKeyword); - TypeScript.visitNodeOrToken(this, node.statement); - }; - SyntaxWalker.prototype.visitCatchClause = function (node) { - this.visitToken(node.catchKeyword); - this.visitToken(node.openParenToken); - this.visitToken(node.identifier); - TypeScript.visitNodeOrToken(this, node.typeAnnotation); - this.visitToken(node.closeParenToken); - TypeScript.visitNodeOrToken(this, node.block); - }; - SyntaxWalker.prototype.visitFinallyClause = function (node) { - this.visitToken(node.finallyKeyword); - TypeScript.visitNodeOrToken(this, node.block); - }; - SyntaxWalker.prototype.visitTemplateClause = function (node) { - TypeScript.visitNodeOrToken(this, node.expression); - this.visitToken(node.templateMiddleOrEndToken); - }; - SyntaxWalker.prototype.visitTypeParameter = function (node) { - this.visitToken(node.identifier); - TypeScript.visitNodeOrToken(this, node.constraint); - }; - SyntaxWalker.prototype.visitConstraint = function (node) { - this.visitToken(node.extendsKeyword); - TypeScript.visitNodeOrToken(this, node.typeOrExpression); - }; - SyntaxWalker.prototype.visitSimplePropertyAssignment = function (node) { - this.visitToken(node.propertyName); - this.visitToken(node.colonToken); - TypeScript.visitNodeOrToken(this, node.expression); - }; - SyntaxWalker.prototype.visitFunctionPropertyAssignment = function (node) { - this.visitToken(node.propertyName); - TypeScript.visitNodeOrToken(this, node.callSignature); - TypeScript.visitNodeOrToken(this, node.block); - }; - SyntaxWalker.prototype.visitParameter = function (node) { - this.visitOptionalToken(node.dotDotDotToken); - this.visitList(node.modifiers); - this.visitToken(node.identifier); - this.visitOptionalToken(node.questionToken); - TypeScript.visitNodeOrToken(this, node.typeAnnotation); - TypeScript.visitNodeOrToken(this, node.equalsValueClause); - }; - SyntaxWalker.prototype.visitEnumElement = function (node) { - this.visitToken(node.propertyName); - TypeScript.visitNodeOrToken(this, node.equalsValueClause); - }; - SyntaxWalker.prototype.visitTypeAnnotation = function (node) { - this.visitToken(node.colonToken); - TypeScript.visitNodeOrToken(this, node.type); - }; - SyntaxWalker.prototype.visitExternalModuleReference = function (node) { - this.visitToken(node.requireKeyword); - this.visitToken(node.openParenToken); - this.visitToken(node.stringLiteral); - this.visitToken(node.closeParenToken); - }; - SyntaxWalker.prototype.visitModuleNameModuleReference = function (node) { - TypeScript.visitNodeOrToken(this, node.moduleName); - }; - return SyntaxWalker; - })(); - TypeScript.SyntaxWalker = SyntaxWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Parser; - (function (Parser) { - var arrayPool = []; - var arrayPoolCount = 0; - function getArray() { - if (arrayPoolCount === 0) { - return []; - } - arrayPoolCount--; - var result = arrayPool[arrayPoolCount]; - arrayPool[arrayPoolCount] = undefined; - return result; - } - function returnArray(array) { - array.length = 0; - arrayPool[arrayPoolCount] = array; - arrayPoolCount++; - } - function createParseSyntaxTree() { - var fileName; - var source; - var languageVersion; - var listParsingState = 0; - var isInStrictMode = false; - var diagnostics = []; - var parseNodeData = 0; - function parseSyntaxTree(_source, isDeclaration) { - fileName = _source.fileName; - source = _source; - languageVersion = source.languageVersion; - var result = parseSyntaxTreeWorker(isDeclaration); - diagnostics = []; - parseNodeData = 0 /* None */; - fileName = undefined; - source.release(); - source = undefined; - _source = undefined; - return result; - } - function parseSyntaxTreeWorker(isDeclaration) { - var sourceUnit = parseSourceUnit(); - var allDiagnostics = source.tokenDiagnostics().concat(diagnostics); - allDiagnostics.sort(function (a, b) { return a.start() - b.start(); }); - return new TypeScript.SyntaxTree(sourceUnit, isDeclaration, allDiagnostics, fileName, source.text, languageVersion); - } - function getRewindPoint() { - var rewindPoint = source.getRewindPoint(); - rewindPoint.diagnosticsCount = diagnostics.length; - rewindPoint.isInStrictMode = isInStrictMode; - rewindPoint.listParsingState = listParsingState; - return rewindPoint; - } - function rewind(rewindPoint) { - source.rewind(rewindPoint); - diagnostics.length = rewindPoint.diagnosticsCount; - } - function releaseRewindPoint(rewindPoint) { - source.releaseRewindPoint(rewindPoint); - } - function currentNode() { - var node = source.currentNode(); - if (!node || TypeScript.parsedInStrictMode(node) !== isInStrictMode) { - return undefined; - } - return node; - } - function currentToken() { - return source.currentToken(); - } - function currentContextualToken() { - return source.currentContextualToken(); - } - function peekToken(n) { - return source.peekToken(n); - } - function consumeToken(token) { - source.consumeToken(token); - return token; - } - function consumeNode(node) { - source.consumeNode(node); - } - function eatToken(kind) { - var token = currentToken(); - if (token.kind() === kind) { - return consumeToken(token); - } - return createMissingToken(kind, token); - } - function tryEatToken(kind) { - var _currentToken = currentToken(); - if (_currentToken.kind() === kind) { - return consumeToken(_currentToken); - } - return undefined; - } - function isIdentifier(token) { - var tokenKind = token.kind(); - if (tokenKind === 9 /* IdentifierName */) { - return true; - } - if (tokenKind >= TypeScript.SyntaxKind.FirstFutureReservedStrictKeyword) { - if (tokenKind <= TypeScript.SyntaxKind.LastFutureReservedStrictKeyword) { - return !isInStrictMode; - } - return tokenKind <= TypeScript.SyntaxKind.LastTypeScriptKeyword; - } - return false; - } - function eatIdentifierNameToken() { - var token = currentToken(); - var tokenKind = token.kind(); - if (tokenKind === 9 /* IdentifierName */) { - return consumeToken(token); - } - if (TypeScript.SyntaxFacts.isAnyKeyword(tokenKind)) { - return TypeScript.Syntax.convertKeywordToIdentifier(consumeToken(token)); - } - return createMissingToken(9 /* IdentifierName */, token); - } - function eatOptionalIdentifierToken() { - return isIdentifier(currentToken()) ? eatIdentifierToken() : undefined; - } - function eatIdentifierToken(diagnosticCode) { - var token = currentToken(); - if (isIdentifier(token)) { - consumeToken(token); - if (token.kind() === 9 /* IdentifierName */) { - return token; - } - return TypeScript.Syntax.convertKeywordToIdentifier(token); - } - return createMissingToken(9 /* IdentifierName */, token, diagnosticCode); - } - function previousTokenHasTrailingNewLine(token) { - var tokenFullStart = token.fullStart(); - if (tokenFullStart === 0) { - return false; - } - var lineNumber = source.text.lineMap().getLineNumberFromPosition(tokenFullStart); - var lineStart = source.text.lineMap().getLineStartPosition(lineNumber); - return lineStart == tokenFullStart; - } - function canEatAutomaticSemicolon(allowWithoutNewLine) { - var token = currentToken(); - var tokenKind = token.kind(); - if (tokenKind === 8 /* EndOfFileToken */) { - return true; - } - if (tokenKind === 73 /* CloseBraceToken */) { - return true; - } - if (allowWithoutNewLine) { - return true; - } - if (previousTokenHasTrailingNewLine(token)) { - return true; - } - return false; - } - function canEatExplicitOrAutomaticSemicolon(allowWithoutNewline) { - var token = currentToken(); - if (token.kind() === 80 /* SemicolonToken */) { - return true; - } - return canEatAutomaticSemicolon(allowWithoutNewline); - } - function eatExplicitOrAutomaticSemicolon(allowWithoutNewline) { - var token = currentToken(); - if (token.kind() === 80 /* SemicolonToken */) { - return consumeToken(token); - } - if (canEatAutomaticSemicolon(allowWithoutNewline)) { - return undefined; - } - return eatToken(80 /* SemicolonToken */); - } - function createMissingToken(expectedKind, actual, diagnosticCode) { - var diagnostic = getExpectedTokenDiagnostic(expectedKind, actual, diagnosticCode); - addDiagnostic(diagnostic); - return TypeScript.Syntax.emptyToken(expectedKind); - } - function getExpectedTokenDiagnostic(expectedKind, actual, diagnosticCode) { - var token = currentToken(); - var args = undefined; - if (!diagnosticCode) { - if (TypeScript.SyntaxFacts.isAnyKeyword(expectedKind) || TypeScript.SyntaxFacts.isAnyPunctuation(expectedKind)) { - diagnosticCode = TypeScript.DiagnosticCode._0_expected; - args = [TypeScript.SyntaxFacts.getText(expectedKind)]; - } - else { - if (actual && TypeScript.SyntaxFacts.isAnyKeyword(actual.kind())) { - diagnosticCode = TypeScript.DiagnosticCode.Identifier_expected_0_is_a_keyword; - args = [TypeScript.SyntaxFacts.getText(actual.kind())]; - } - else { - diagnosticCode = TypeScript.DiagnosticCode.Identifier_expected; - } - } - } - return new TypeScript.Diagnostic(fileName, source.text.lineMap(), TypeScript.start(token, source.text), TypeScript.width(token), diagnosticCode, args); - } - function getBinaryExpressionPrecedence(tokenKind) { - switch (tokenKind) { - case 106 /* BarBarToken */: return 2 /* LogicalOrExpressionPrecedence */; - case 105 /* AmpersandAmpersandToken */: return 3 /* LogicalAndExpressionPrecedence */; - case 101 /* BarToken */: return 4 /* BitwiseOrExpressionPrecedence */; - case 102 /* CaretToken */: return 5 /* BitwiseExclusiveOrExpressionPrecedence */; - case 100 /* AmpersandToken */: return 6 /* BitwiseAndExpressionPrecedence */; - case 86 /* EqualsEqualsToken */: - case 88 /* ExclamationEqualsToken */: - case 89 /* EqualsEqualsEqualsToken */: - case 90 /* ExclamationEqualsEqualsToken */: - return 7 /* EqualityExpressionPrecedence */; - case 82 /* LessThanToken */: - case 83 /* GreaterThanToken */: - case 84 /* LessThanEqualsToken */: - case 85 /* GreaterThanEqualsToken */: - case 32 /* InstanceOfKeyword */: - case 31 /* InKeyword */: - return 8 /* RelationalExpressionPrecedence */; - case 97 /* LessThanLessThanToken */: - case 98 /* GreaterThanGreaterThanToken */: - case 99 /* GreaterThanGreaterThanGreaterThanToken */: - return 9 /* ShiftExpressionPrecdence */; - case 91 /* PlusToken */: - case 92 /* MinusToken */: - return 10 /* AdditiveExpressionPrecedence */; - case 93 /* AsteriskToken */: - case 120 /* SlashToken */: - case 94 /* PercentToken */: - return 11 /* MultiplicativeExpressionPrecedence */; - } - throw TypeScript.Errors.invalidOperation(); - } - function addSkippedTokenAfterNodeOrToken(nodeOrToken, skippedToken) { - if (TypeScript.isToken(nodeOrToken)) { - return addSkippedTokenAfterToken(nodeOrToken, skippedToken); - } - else if (TypeScript.isNode(nodeOrToken)) { - return addSkippedTokenAfterNode(nodeOrToken, skippedToken); - } - else { - throw TypeScript.Errors.invalidOperation(); - } - } - function replaceTokenInParent(node, oldToken, newToken) { - replaceTokenInParentWorker(oldToken, newToken); - var parent = oldToken.parent; - newToken.parent = parent; - while (true) { - TypeScript.Debug.assert(TypeScript.isNode(parent) || TypeScript.isList(parent)); - var dataElement = parent; - if (dataElement.__data) { - dataElement.__data &= 4 /* NodeParsedInStrictModeMask */; - } - dataElement.__cachedTokens = undefined; - if (parent === node) { - break; - } - parent = parent.parent; - } - } - function replaceTokenInParentWorker(oldToken, newToken) { - var parent = oldToken.parent; - if (TypeScript.isNode(parent)) { - var node = parent; - for (var key in node) { - if (node[key] === oldToken) { - node[key] = newToken; - return; - } - } - } - else if (TypeScript.isList(parent)) { - var list1 = parent; - for (var i = 0, n = list1.length; i < n; i++) { - if (list1[i] === oldToken) { - list1[i] = newToken; - return; - } - } - } - throw TypeScript.Errors.invalidOperation(); - } - function addSkippedTokenAfterNode(node, skippedToken) { - var oldToken = TypeScript.lastToken(node); - var newToken = addSkippedTokenAfterToken(oldToken, skippedToken); - replaceTokenInParent(node, oldToken, newToken); - return node; - } - function addSkippedTokensBeforeNode(node, skippedTokens) { - if (skippedTokens.length > 0) { - var oldToken = TypeScript.firstToken(node); - var newToken = addSkippedTokensBeforeToken(oldToken, skippedTokens); - replaceTokenInParent(node, oldToken, newToken); - } - return node; - } - function addSkippedTokensBeforeToken(token, skippedTokens) { - var leadingTrivia = []; - for (var i = 0, n = skippedTokens.length; i < n; i++) { - var skippedToken = skippedTokens[i]; - addSkippedTokenToTriviaArray(leadingTrivia, skippedToken); - } - addTriviaTo(token.leadingTrivia(source.text), leadingTrivia); - var updatedToken = TypeScript.Syntax.withLeadingTrivia(token, TypeScript.Syntax.triviaList(leadingTrivia), source.text); - updatedToken.setFullStart(skippedTokens[0].fullStart()); - returnArray(skippedTokens); - return updatedToken; - } - function addSkippedTokensAfterToken(token, skippedTokens) { - if (skippedTokens.length === 0) { - returnArray(skippedTokens); - return token; - } - var trailingTrivia = token.trailingTrivia(source.text).toArray(); - for (var i = 0, n = skippedTokens.length; i < n; i++) { - addSkippedTokenToTriviaArray(trailingTrivia, skippedTokens[i]); - } - returnArray(skippedTokens); - return TypeScript.Syntax.withTrailingTrivia(token, TypeScript.Syntax.triviaList(trailingTrivia), source.text); - } - function addSkippedTokenAfterToken(token, skippedToken) { - var trailingTrivia = token.trailingTrivia(source.text).toArray(); - addSkippedTokenToTriviaArray(trailingTrivia, skippedToken); - return TypeScript.Syntax.withTrailingTrivia(token, TypeScript.Syntax.triviaList(trailingTrivia), source.text); - } - function addSkippedTokenToTriviaArray(array, skippedToken) { - addTriviaTo(skippedToken.leadingTrivia(source.text), array); - var trimmedToken = TypeScript.Syntax.withTrailingTrivia(TypeScript.Syntax.withLeadingTrivia(skippedToken, TypeScript.Syntax.emptyTriviaList, source.text), TypeScript.Syntax.emptyTriviaList, source.text); - trimmedToken.setFullStart(TypeScript.start(skippedToken, source.text)); - array.push(TypeScript.Syntax.skippedTokenTrivia(trimmedToken, source.text)); - addTriviaTo(skippedToken.trailingTrivia(source.text), array); - } - function addTriviaTo(list, array) { - for (var i = 0, n = list.count(); i < n; i++) { - array.push(list.syntaxTriviaAt(i)); - } - } - function setStrictMode(_isInStrictMode) { - isInStrictMode = _isInStrictMode; - parseNodeData = _isInStrictMode ? 4 /* NodeParsedInStrictModeMask */ : 0; - } - function parseSourceUnit() { - var savedIsInStrictMode = isInStrictMode; - var skippedTokens = getArray(); - var moduleElements = parseSyntaxList(0 /* SourceUnit_ModuleElements */, skippedTokens, updateStrictModeState); - setStrictMode(savedIsInStrictMode); - var sourceUnit = new TypeScript.SourceUnitSyntax(parseNodeData, moduleElements, currentToken()); - sourceUnit = addSkippedTokensBeforeNode(sourceUnit, skippedTokens); - if (TypeScript.Debug.shouldAssert(2 /* Aggressive */)) { - TypeScript.Debug.assert(TypeScript.fullWidth(sourceUnit) === source.text.length()); - if (TypeScript.Debug.shouldAssert(3 /* VeryAggressive */)) { - TypeScript.Debug.assert(TypeScript.fullText(sourceUnit) === source.text.substr(0, source.text.length())); - } - } - return sourceUnit; - } - function updateStrictModeState(items) { - if (!isInStrictMode) { - for (var i = 0; i < items.length; i++) { - var item = items[i]; - if (!TypeScript.SyntaxFacts.isDirectivePrologueElement(item)) { - return; - } - } - setStrictMode(TypeScript.SyntaxFacts.isUseStrictDirective(items[items.length - 1])); - } - } - function isModuleElement(inErrorRecovery) { - if (TypeScript.SyntaxUtilities.isModuleElement(currentNode())) { - return true; - } - var _modifierCount = modifierCount(); - return isInterfaceEnumClassModuleImportOrExport(_modifierCount) || isStatement(_modifierCount, inErrorRecovery); - } - function tryParseModuleElement(inErrorRecovery) { - var node = currentNode(); - if (TypeScript.SyntaxUtilities.isModuleElement(node)) { - consumeNode(node); - return node; - } - var _currentToken = currentToken(); - var _modifierCount = modifierCount(); - if (_modifierCount) { - switch (peekToken(_modifierCount).kind()) { - case 51 /* ImportKeyword */: return parseImportDeclaration(); - case 67 /* ModuleKeyword */: return parseModuleDeclaration(); - case 54 /* InterfaceKeyword */: return parseInterfaceDeclaration(); - case 46 /* ClassKeyword */: return parseClassDeclaration(); - case 48 /* EnumKeyword */: return parseEnumDeclaration(); - } - } - var nextToken = peekToken(1); - var currentTokenKind = _currentToken.kind(); - switch (currentTokenKind) { - case 67 /* ModuleKeyword */: - if (isIdentifier(nextToken) || nextToken.kind() === 12 /* StringLiteral */) { - return parseModuleDeclaration(); - } - break; - case 51 /* ImportKeyword */: - if (isIdentifier(nextToken)) { - return parseImportDeclaration(); - } - break; - case 46 /* ClassKeyword */: - if (isIdentifier(nextToken)) { - return parseClassDeclaration(); - } - break; - case 48 /* EnumKeyword */: - if (isIdentifier(nextToken)) { - return parseEnumDeclaration(); - } - break; - case 54 /* InterfaceKeyword */: - if (isIdentifier(nextToken)) { - return parseInterfaceDeclaration(); - } - break; - case 49 /* ExportKeyword */: - if (nextToken.kind() === 109 /* EqualsToken */) { - return parseExportAssignment(); - } - break; - } - return tryParseStatementWorker(_currentToken, currentTokenKind, _modifierCount, inErrorRecovery); - } - function parseImportDeclaration() { - return new TypeScript.ImportDeclarationSyntax(parseNodeData, parseModifiers(), eatToken(51 /* ImportKeyword */), eatIdentifierToken(), eatToken(109 /* EqualsToken */), parseModuleReference(), eatExplicitOrAutomaticSemicolon(false)); - } - function parseExportAssignment() { - return new TypeScript.ExportAssignmentSyntax(parseNodeData, eatToken(49 /* ExportKeyword */), eatToken(109 /* EqualsToken */), eatIdentifierToken(), eatExplicitOrAutomaticSemicolon(false)); - } - function parseModuleReference() { - return isExternalModuleReference() ? parseExternalModuleReference() : parseModuleNameModuleReference(); - } - function isExternalModuleReference() { - return currentToken().kind() === 68 /* RequireKeyword */ && peekToken(1).kind() === 74 /* OpenParenToken */; - } - function parseExternalModuleReference() { - return new TypeScript.ExternalModuleReferenceSyntax(parseNodeData, eatToken(68 /* RequireKeyword */), eatToken(74 /* OpenParenToken */), eatToken(12 /* StringLiteral */), eatToken(75 /* CloseParenToken */)); - } - function parseModuleNameModuleReference() { - return new TypeScript.ModuleNameModuleReferenceSyntax(parseNodeData, parseName(false)); - } - function tryParseTypeArgumentList(inExpression) { - var _currentToken = currentToken(); - if (_currentToken.kind() !== 82 /* LessThanToken */) { - return undefined; - } - if (!inExpression) { - var lessThanToken = consumeToken(_currentToken); - var skippedTokens = getArray(); - var typeArguments = parseSeparatedSyntaxList(19 /* TypeArgumentList_Types */, skippedTokens); - lessThanToken = addSkippedTokensAfterToken(lessThanToken, skippedTokens); - return new TypeScript.TypeArgumentListSyntax(parseNodeData, lessThanToken, typeArguments, eatToken(83 /* GreaterThanToken */)); - } - var rewindPoint = getRewindPoint(); - var lessThanToken = consumeToken(_currentToken); - var skippedTokens = getArray(); - var typeArguments = parseSeparatedSyntaxList(19 /* TypeArgumentList_Types */, skippedTokens); - var lessThanToken = addSkippedTokensAfterToken(lessThanToken, skippedTokens); - var greaterThanToken = eatToken(83 /* GreaterThanToken */); - if (greaterThanToken.fullWidth() === 0 || !canFollowTypeArgumentListInExpression(currentToken().kind())) { - rewind(rewindPoint); - releaseRewindPoint(rewindPoint); - return undefined; - } - else { - releaseRewindPoint(rewindPoint); - return new TypeScript.TypeArgumentListSyntax(parseNodeData, lessThanToken, typeArguments, greaterThanToken); - } - } - function canFollowTypeArgumentListInExpression(kind) { - switch (kind) { - case 74 /* OpenParenToken */: - case 78 /* DotToken */: - case 75 /* CloseParenToken */: - case 77 /* CloseBracketToken */: - case 108 /* ColonToken */: - case 80 /* SemicolonToken */: - case 81 /* CommaToken */: - case 107 /* QuestionToken */: - case 86 /* EqualsEqualsToken */: - case 89 /* EqualsEqualsEqualsToken */: - case 88 /* ExclamationEqualsToken */: - case 90 /* ExclamationEqualsEqualsToken */: - case 105 /* AmpersandAmpersandToken */: - case 106 /* BarBarToken */: - case 102 /* CaretToken */: - case 100 /* AmpersandToken */: - case 101 /* BarToken */: - case 73 /* CloseBraceToken */: - case 8 /* EndOfFileToken */: - return true; - default: - return false; - } - } - function parseName(allowIdentifierName) { - return tryParseName(allowIdentifierName) || eatIdentifierToken(); - } - function eatRightSideOfName(allowIdentifierNames) { - var _currentToken = currentToken(); - if (TypeScript.SyntaxFacts.isAnyKeyword(_currentToken.kind()) && previousTokenHasTrailingNewLine(_currentToken)) { - var token1 = peekToken(1); - if (!TypeScript.existsNewLineBetweenTokens(_currentToken, token1, source.text) && TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token1)) { - return createMissingToken(9 /* IdentifierName */, _currentToken); - } - } - return allowIdentifierNames ? eatIdentifierNameToken() : eatIdentifierToken(); - } - function tryParseName(allowIdentifierNames) { - var token0 = currentToken(); - var shouldContinue = isIdentifier(token0); - if (!shouldContinue) { - return undefined; - } - var current = eatIdentifierToken(); - while (shouldContinue && currentToken().kind() === 78 /* DotToken */) { - var dotToken = consumeToken(currentToken()); - var identifierName = eatRightSideOfName(allowIdentifierNames); - current = new TypeScript.QualifiedNameSyntax(parseNodeData, current, dotToken, identifierName); - shouldContinue = identifierName.fullWidth() > 0; - } - return current; - } - function parseEnumDeclaration() { - var modifiers = parseModifiers(); - var enumKeyword = eatToken(48 /* EnumKeyword */); - var identifier = eatIdentifierToken(); - var openBraceToken = eatToken(72 /* OpenBraceToken */); - var enumElements; - if (openBraceToken.fullWidth() > 0) { - var skippedTokens = getArray(); - enumElements = parseSeparatedSyntaxList(8 /* EnumDeclaration_EnumElements */, skippedTokens); - openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); - } - return new TypeScript.EnumDeclarationSyntax(parseNodeData, modifiers, enumKeyword, identifier, openBraceToken, enumElements || [], eatToken(73 /* CloseBraceToken */)); - } - function isEnumElement(inErrorRecovery) { - var node = currentNode(); - if (node && node.kind() === 209 /* EnumElement */) { - return true; - } - return isPropertyName(currentToken(), inErrorRecovery); - } - function tryParseEnumElementEqualsValueClause() { - return isEqualsValueClause(false) ? parseEqualsValueClause(true) : undefined; - } - function tryParseEnumElement(inErrorRecovery) { - var node = currentNode(); - if (node && node.kind() === 209 /* EnumElement */) { - consumeNode(node); - return node; - } - if (!isPropertyName(currentToken(), inErrorRecovery)) { - return undefined; - } - return new TypeScript.EnumElementSyntax(parseNodeData, eatPropertyName(), tryParseEnumElementEqualsValueClause()); - } - function isModifierKind(kind) { - switch (kind) { - case 49 /* ExportKeyword */: - case 59 /* PublicKeyword */: - case 57 /* PrivateKeyword */: - case 58 /* ProtectedKeyword */: - case 60 /* StaticKeyword */: - case 65 /* DeclareKeyword */: - return true; - } - return false; - } - function isModifier(token, index) { - if (isModifierKind(token.kind())) { - var nextToken = peekToken(index + 1); - var nextTokenKind = nextToken.kind(); - switch (nextTokenKind) { - case 9 /* IdentifierName */: - case 76 /* OpenBracketToken */: - case 11 /* NumericLiteral */: - case 12 /* StringLiteral */: - return true; - default: - return TypeScript.SyntaxFacts.isAnyKeyword(nextTokenKind); - } - } - return false; - } - function modifierCount() { - var modifierCount = 0; - while (isModifier(peekToken(modifierCount), modifierCount)) { - modifierCount++; - } - return modifierCount; - } - function parseModifiers() { - var tokens = getArray(); - while (true) { - var token = currentToken(); - if (isModifier(token, 0)) { - tokens.push(consumeToken(token)); - continue; - } - break; - } - return TypeScript.Syntax.list(tokens); - } - function parseHeritageClauses() { - var heritageClauses; - if (isHeritageClause()) { - heritageClauses = parseSyntaxList(10 /* ClassOrInterfaceDeclaration_HeritageClauses */, undefined); - } - return heritageClauses || []; - } - function tryParseHeritageClauseTypeName() { - return isHeritageClauseTypeName() ? tryParseNameOrGenericType() : undefined; - } - function parseClassDeclaration() { - var modifiers = parseModifiers(); - var classKeyword = eatToken(46 /* ClassKeyword */); - var identifier = eatIdentifierToken(); - var typeParameterList = tryParseTypeParameterList(false); - var heritageClauses = parseHeritageClauses(); - var openBraceToken = eatToken(72 /* OpenBraceToken */); - var classElements; - if (openBraceToken.fullWidth() > 0) { - var skippedTokens = getArray(); - classElements = parseSyntaxList(1 /* ClassDeclaration_ClassElements */, skippedTokens); - openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); - } - ; - return new TypeScript.ClassDeclarationSyntax(parseNodeData, modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements || [], eatToken(73 /* CloseBraceToken */)); - } - function isAccessor(modifierCount, inErrorRecovery) { - var tokenKind = peekToken(modifierCount).kind(); - if (tokenKind !== 66 /* GetKeyword */ && tokenKind !== 70 /* SetKeyword */) { - return false; - } - return isPropertyName(peekToken(modifierCount + 1), inErrorRecovery); - } - function parseAccessor(checkForStrictMode) { - var modifiers = parseModifiers(); - var _currenToken = currentToken(); - var tokenKind = _currenToken.kind(); - if (tokenKind === 66 /* GetKeyword */) { - return parseGetMemberAccessorDeclaration(modifiers, _currenToken, checkForStrictMode); - } - else if (tokenKind === 70 /* SetKeyword */) { - return parseSetMemberAccessorDeclaration(modifiers, _currenToken, checkForStrictMode); - } - else { - throw TypeScript.Errors.invalidOperation(); - } - } - function parseGetMemberAccessorDeclaration(modifiers, getKeyword, checkForStrictMode) { - return new TypeScript.GetAccessorSyntax(parseNodeData, modifiers, consumeToken(getKeyword), eatPropertyName(), parseCallSignature(false), parseBlock(false, checkForStrictMode)); - } - function parseSetMemberAccessorDeclaration(modifiers, setKeyword, checkForStrictMode) { - return new TypeScript.SetAccessorSyntax(parseNodeData, modifiers, consumeToken(setKeyword), eatPropertyName(), parseCallSignature(false), parseBlock(false, checkForStrictMode)); - } - function isClassElement(inErrorRecovery) { - if (TypeScript.SyntaxUtilities.isClassElement(currentNode())) { - return true; - } - var _modifierCount = modifierCount(); - return isConstructorDeclaration(_modifierCount) || isMemberFunctionDeclaration(_modifierCount, inErrorRecovery) || isAccessor(_modifierCount, inErrorRecovery) || isMemberVariableDeclaration(_modifierCount, inErrorRecovery) || isIndexMemberDeclaration(_modifierCount); - } - function tryParseClassElement(inErrorRecovery) { - var node = currentNode(); - if (TypeScript.SyntaxUtilities.isClassElement(node)) { - consumeNode(node); - return node; - } - var _modifierCount = modifierCount(); - if (isConstructorDeclaration(_modifierCount)) { - return parseConstructorDeclaration(); - } - else if (isMemberFunctionDeclaration(_modifierCount, inErrorRecovery)) { - return parseMemberFunctionDeclaration(); - } - else if (isAccessor(_modifierCount, inErrorRecovery)) { - return parseAccessor(false); - } - else if (isMemberVariableDeclaration(_modifierCount, inErrorRecovery)) { - return parseMemberVariableDeclaration(); - } - else if (isIndexMemberDeclaration(_modifierCount)) { - return parseIndexMemberDeclaration(); - } - else { - return undefined; - } - } - function isConstructorDeclaration(modifierCount) { - return peekToken(modifierCount).kind() === 64 /* ConstructorKeyword */; - } - function parseConstructorDeclaration() { - var modifiers = parseModifiers(); - var constructorKeyword = eatToken(64 /* ConstructorKeyword */); - var callSignature = parseCallSignature(false); - var semicolonToken = undefined; - var block = undefined; - if (isBlock()) { - block = parseBlock(false, true); - } - else { - semicolonToken = eatExplicitOrAutomaticSemicolon(false); - } - return new TypeScript.ConstructorDeclarationSyntax(parseNodeData, modifiers, constructorKeyword, callSignature, block, semicolonToken); - } - function isMemberFunctionDeclaration(modifierCount, inErrorRecovery) { - return isPropertyName(peekToken(modifierCount), inErrorRecovery) && isCallSignature(modifierCount + 1); - } - function parseMemberFunctionDeclaration() { - var modifiers = parseModifiers(); - var propertyName = eatPropertyName(); - var callSignature = parseCallSignature(false); - var parseBlockEvenWithNoOpenBrace = tryAddUnexpectedEqualsGreaterThanToken(callSignature); - var block = undefined; - var semicolon = undefined; - if (parseBlockEvenWithNoOpenBrace || isBlock()) { - block = parseBlock(parseBlockEvenWithNoOpenBrace, true); - } - else { - semicolon = eatExplicitOrAutomaticSemicolon(false); - } - return new TypeScript.MemberFunctionDeclarationSyntax(parseNodeData, modifiers, propertyName, callSignature, block, semicolon); - } - function isDefinitelyMemberVariablePropertyName(index) { - if (TypeScript.SyntaxFacts.isAnyKeyword(peekToken(index).kind())) { - var nextToken = peekToken(index + 1); - switch (nextToken.kind()) { - case 80 /* SemicolonToken */: - case 109 /* EqualsToken */: - case 108 /* ColonToken */: - case 73 /* CloseBraceToken */: - case 8 /* EndOfFileToken */: - return true; - default: - return previousTokenHasTrailingNewLine(nextToken); - } - } - else { - return true; - } - } - function isMemberVariableDeclaration(modifierCount, inErrorRecover) { - return isPropertyName(peekToken(modifierCount), inErrorRecover) && isDefinitelyMemberVariablePropertyName(modifierCount); - } - function parseMemberVariableDeclaration() { - return new TypeScript.MemberVariableDeclarationSyntax(parseNodeData, parseModifiers(), tryParseVariableDeclarator(true, true), eatExplicitOrAutomaticSemicolon(false)); - } - function isIndexMemberDeclaration(modifierCount) { - return isIndexSignature(modifierCount); - } - function parseIndexMemberDeclaration() { - return new TypeScript.IndexMemberDeclarationSyntax(parseNodeData, parseModifiers(), parseIndexSignature(), eatExplicitOrAutomaticSemicolon(false)); - } - function tryAddUnexpectedEqualsGreaterThanToken(callSignature) { - var token0 = currentToken(); - var hasEqualsGreaterThanToken = token0.kind() === 87 /* EqualsGreaterThanToken */; - if (hasEqualsGreaterThanToken) { - var _lastToken = TypeScript.lastToken(callSignature); - if (_lastToken && _lastToken.fullWidth() > 0) { - var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), TypeScript.start(token0, source.text), TypeScript.width(token0), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [TypeScript.SyntaxFacts.getText(72 /* OpenBraceToken */)]); - addDiagnostic(diagnostic); - consumeToken(token0); - addSkippedTokenAfterNode(callSignature, token0); - return true; - } - } - return false; - } - function isFunctionDeclaration(modifierCount) { - return peekToken(modifierCount).kind() === 29 /* FunctionKeyword */; - } - function parseFunctionDeclaration() { - var modifiers = parseModifiers(); - var functionKeyword = eatToken(29 /* FunctionKeyword */); - var identifier = eatIdentifierToken(); - var callSignature = parseCallSignature(false); - var parseBlockEvenWithNoOpenBrace = tryAddUnexpectedEqualsGreaterThanToken(callSignature); - var semicolonToken = undefined; - var block = undefined; - if (parseBlockEvenWithNoOpenBrace || isBlock()) { - block = parseBlock(parseBlockEvenWithNoOpenBrace, true); - } - else { - semicolonToken = eatExplicitOrAutomaticSemicolon(false); - } - return new TypeScript.FunctionDeclarationSyntax(parseNodeData, modifiers, functionKeyword, identifier, callSignature, block, semicolonToken); - } - function parseModuleDeclaration() { - var modifiers = parseModifiers(); - var moduleKeyword = eatToken(67 /* ModuleKeyword */); - var moduleName = undefined; - var stringLiteral = undefined; - if (currentToken().kind() === 12 /* StringLiteral */) { - stringLiteral = eatToken(12 /* StringLiteral */); - } - else { - moduleName = parseName(false); - } - var openBraceToken = eatToken(72 /* OpenBraceToken */); - var moduleElements; - if (openBraceToken.fullWidth() > 0) { - var skippedTokens = getArray(); - moduleElements = parseSyntaxList(2 /* ModuleDeclaration_ModuleElements */, skippedTokens); - openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); - } - return new TypeScript.ModuleDeclarationSyntax(parseNodeData, modifiers, moduleKeyword, moduleName, stringLiteral, openBraceToken, moduleElements || [], eatToken(73 /* CloseBraceToken */)); - } - function parseInterfaceDeclaration() { - return new TypeScript.InterfaceDeclarationSyntax(parseNodeData, parseModifiers(), eatToken(54 /* InterfaceKeyword */), eatIdentifierToken(), tryParseTypeParameterList(false), parseHeritageClauses(), parseObjectType()); - } - function parseObjectType() { - var openBraceToken = eatToken(72 /* OpenBraceToken */); - var typeMembers; - if (openBraceToken.fullWidth() > 0) { - var skippedTokens = getArray(); - typeMembers = parseSeparatedSyntaxList(9 /* ObjectType_TypeMembers */, skippedTokens); - openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); - } - return new TypeScript.ObjectTypeSyntax(parseNodeData, openBraceToken, typeMembers || [], eatToken(73 /* CloseBraceToken */)); - } - function parseTupleType(currentToken) { - var openBracket = consumeToken(currentToken); - var types; - if (openBracket.fullWidth() > 0) { - var skippedTokens = getArray(); - types = parseSeparatedSyntaxList(21 /* TupleType_Types */, skippedTokens); - openBracket = addSkippedTokensAfterToken(openBracket, skippedTokens); - } - return new TypeScript.TupleTypeSyntax(parseNodeData, openBracket, types || [], eatToken(77 /* CloseBracketToken */)); - } - function isTypeMember(inErrorRecovery) { - if (TypeScript.SyntaxUtilities.isTypeMember(currentNode())) { - return true; - } - return isCallSignature(0) || isConstructSignature() || isIndexSignature(0) || isMethodSignature(inErrorRecovery) || isPropertySignature(inErrorRecovery); - } - function tryParseTypeMember(inErrorRecovery) { - var node = currentNode(); - if (TypeScript.SyntaxUtilities.isTypeMember(node)) { - consumeNode(node); - return node; - } - if (isCallSignature(0)) { - return parseCallSignature(false); - } - else if (isConstructSignature()) { - return parseConstructSignature(); - } - else if (isIndexSignature(0)) { - return parseIndexSignature(); - } - else if (isMethodSignature(inErrorRecovery)) { - return parseMethodSignature(); - } - else if (isPropertySignature(inErrorRecovery)) { - return parsePropertySignature(); - } - else { - return undefined; - } - } - function parseConstructSignature() { - return new TypeScript.ConstructSignatureSyntax(parseNodeData, eatToken(33 /* NewKeyword */), parseCallSignature(false)); - } - function parseIndexSignature() { - var openBracketToken = eatToken(76 /* OpenBracketToken */); - var skippedTokens = getArray(); - var parameters = parseSeparatedSyntaxList(18 /* IndexSignature_Parameters */, skippedTokens); - openBracketToken = addSkippedTokensAfterToken(openBracketToken, skippedTokens); - return new TypeScript.IndexSignatureSyntax(parseNodeData, openBracketToken, parameters, eatToken(77 /* CloseBracketToken */), parseOptionalTypeAnnotation(false)); - } - function parseMethodSignature() { - return new TypeScript.MethodSignatureSyntax(parseNodeData, eatPropertyName(), tryEatToken(107 /* QuestionToken */), parseCallSignature(false)); - } - function parsePropertySignature() { - return new TypeScript.PropertySignatureSyntax(parseNodeData, eatPropertyName(), tryEatToken(107 /* QuestionToken */), parseOptionalTypeAnnotation(false)); - } - function isCallSignature(peekIndex) { - var tokenKind = peekToken(peekIndex).kind(); - return tokenKind === 74 /* OpenParenToken */ || tokenKind === 82 /* LessThanToken */; - } - function isConstructSignature() { - if (currentToken().kind() !== 33 /* NewKeyword */) { - return false; - } - return isCallSignature(1); - } - function isIndexSignature(peekIndex) { - return peekToken(peekIndex).kind() === 76 /* OpenBracketToken */; - } - function isMethodSignature(inErrorRecovery) { - if (isPropertyName(currentToken(), inErrorRecovery)) { - if (isCallSignature(1)) { - return true; - } - if (peekToken(1).kind() === 107 /* QuestionToken */ && isCallSignature(2)) { - return true; - } - } - return false; - } - function isPropertySignature(inErrorRecovery) { - var _currentToken = currentToken(); - if (isModifier(_currentToken, 0)) { - if (!TypeScript.existsNewLineBetweenTokens(_currentToken, peekToken(1), source.text) && isPropertyName(peekToken(1), inErrorRecovery)) { - return false; - } - } - return isPropertyName(_currentToken, inErrorRecovery); - } - function isHeritageClause() { - var tokenKind = currentToken().kind(); - return tokenKind === 50 /* ExtendsKeyword */ || tokenKind === 53 /* ImplementsKeyword */; - } - function isNotHeritageClauseTypeName() { - var tokenKind = currentToken().kind(); - if (tokenKind === 53 /* ImplementsKeyword */ || tokenKind === 50 /* ExtendsKeyword */) { - return isIdentifier(peekToken(1)); - } - return false; - } - function isHeritageClauseTypeName() { - if (isIdentifier(currentToken())) { - return !isNotHeritageClauseTypeName(); - } - return false; - } - function tryParseHeritageClause() { - var extendsOrImplementsKeyword = currentToken(); - var tokenKind = extendsOrImplementsKeyword.kind(); - if (tokenKind !== 50 /* ExtendsKeyword */ && tokenKind !== 53 /* ImplementsKeyword */) { - return undefined; - } - consumeToken(extendsOrImplementsKeyword); - var skippedTokens = getArray(); - var typeNames = parseSeparatedSyntaxList(11 /* HeritageClause_TypeNameList */, skippedTokens); - extendsOrImplementsKeyword = addSkippedTokensAfterToken(extendsOrImplementsKeyword, skippedTokens); - return new TypeScript.HeritageClauseSyntax(parseNodeData, extendsOrImplementsKeyword, typeNames); - } - function isInterfaceEnumClassModuleImportOrExport(modifierCount, _currentToken) { - if (modifierCount) { - switch (peekToken(modifierCount).kind()) { - case 51 /* ImportKeyword */: - case 67 /* ModuleKeyword */: - case 54 /* InterfaceKeyword */: - case 46 /* ClassKeyword */: - case 48 /* EnumKeyword */: - return true; - } - } - _currentToken = _currentToken || currentToken(); - var nextToken = peekToken(1); - switch (_currentToken.kind()) { - case 67 /* ModuleKeyword */: - return isIdentifier(nextToken) || nextToken.kind() === 12 /* StringLiteral */; - case 51 /* ImportKeyword */: - case 46 /* ClassKeyword */: - case 48 /* EnumKeyword */: - case 54 /* InterfaceKeyword */: - return isIdentifier(nextToken); - case 49 /* ExportKeyword */: - return nextToken.kind() === 109 /* EqualsToken */; - } - return false; - } - function isStatement(modifierCount, inErrorRecovery) { - if (TypeScript.SyntaxUtilities.isStatement(currentNode())) { - return true; - } - var _currentToken = currentToken(); - var currentTokenKind = _currentToken.kind(); - switch (currentTokenKind) { - case 59 /* PublicKeyword */: - case 57 /* PrivateKeyword */: - case 58 /* ProtectedKeyword */: - case 60 /* StaticKeyword */: - var token1 = peekToken(1); - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token1)) { - return false; - } - break; - case 30 /* IfKeyword */: - case 72 /* OpenBraceToken */: - case 35 /* ReturnKeyword */: - case 36 /* SwitchKeyword */: - case 38 /* ThrowKeyword */: - case 17 /* BreakKeyword */: - case 20 /* ContinueKeyword */: - case 28 /* ForKeyword */: - case 44 /* WhileKeyword */: - case 45 /* WithKeyword */: - case 24 /* DoKeyword */: - case 40 /* TryKeyword */: - case 21 /* DebuggerKeyword */: - return true; - } - if (isInterfaceEnumClassModuleImportOrExport(modifierCount, _currentToken)) { - return false; - } - return isLabeledStatement(_currentToken) || isVariableStatement(modifierCount) || isFunctionDeclaration(modifierCount) || isEmptyStatement(_currentToken, inErrorRecovery) || isExpressionStatement(_currentToken); - } - function parseStatement(inErrorRecovery) { - return tryParseStatement(inErrorRecovery) || parseExpressionStatement(); - } - function tryParseStatement(inErrorRecovery) { - var node = currentNode(); - if (TypeScript.SyntaxUtilities.isStatement(node)) { - consumeNode(node); - return node; - } - var _currentToken = currentToken(); - var currentTokenKind = _currentToken.kind(); - return tryParseStatementWorker(_currentToken, currentTokenKind, modifierCount(), inErrorRecovery); - } - function tryParseStatementWorker(_currentToken, currentTokenKind, modifierCount, inErrorRecovery) { - switch (currentTokenKind) { - case 59 /* PublicKeyword */: - case 57 /* PrivateKeyword */: - case 58 /* ProtectedKeyword */: - case 60 /* StaticKeyword */: - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(peekToken(1))) { - return undefined; - } - else { - break; - } - case 30 /* IfKeyword */: return parseIfStatement(_currentToken); - case 72 /* OpenBraceToken */: return parseBlock(false, false); - case 35 /* ReturnKeyword */: return parseReturnStatement(_currentToken); - case 36 /* SwitchKeyword */: return parseSwitchStatement(_currentToken); - case 38 /* ThrowKeyword */: return parseThrowStatement(_currentToken); - case 17 /* BreakKeyword */: return parseBreakStatement(_currentToken); - case 20 /* ContinueKeyword */: return parseContinueStatement(_currentToken); - case 28 /* ForKeyword */: return parseForOrForInStatement(_currentToken); - case 44 /* WhileKeyword */: return parseWhileStatement(_currentToken); - case 45 /* WithKeyword */: return parseWithStatement(_currentToken); - case 24 /* DoKeyword */: return parseDoStatement(_currentToken); - case 40 /* TryKeyword */: return parseTryStatement(_currentToken); - case 21 /* DebuggerKeyword */: return parseDebuggerStatement(_currentToken); - } - if (isInterfaceEnumClassModuleImportOrExport(modifierCount, _currentToken)) { - return undefined; - } - else if (isVariableStatement(modifierCount)) { - return parseVariableStatement(); - } - else if (isLabeledStatement(_currentToken)) { - return parseLabeledStatement(_currentToken); - } - else if (isFunctionDeclaration(modifierCount)) { - return parseFunctionDeclaration(); - } - else if (isEmptyStatement(_currentToken, inErrorRecovery)) { - return parseEmptyStatement(_currentToken); - } - else if (isExpressionStatement(_currentToken)) { - return parseExpressionStatement(); - } - else { - return undefined; - } - } - function parseDebuggerStatement(debuggerKeyword) { - return new TypeScript.DebuggerStatementSyntax(parseNodeData, consumeToken(debuggerKeyword), eatExplicitOrAutomaticSemicolon(false)); - } - function parseDoStatement(doKeyword) { - return new TypeScript.DoStatementSyntax(parseNodeData, consumeToken(doKeyword), parseStatement(false), eatToken(44 /* WhileKeyword */), eatToken(74 /* OpenParenToken */), parseExpression(true), eatToken(75 /* CloseParenToken */), eatExplicitOrAutomaticSemicolon(true)); - } - function isLabeledStatement(currentToken) { - return isIdentifier(currentToken) && peekToken(1).kind() === 108 /* ColonToken */; - } - function parseLabeledStatement(identifierToken) { - return new TypeScript.LabeledStatementSyntax(parseNodeData, consumeToken(identifierToken), eatToken(108 /* ColonToken */), parseStatement(false)); - } - function parseTryStatement(tryKeyword) { - var tryKeyword = consumeToken(tryKeyword); - var savedListParsingState = listParsingState; - listParsingState |= (1 << 6 /* TryBlock_Statements */); - var block = parseBlock(false, false); - listParsingState = savedListParsingState; - var catchClause = undefined; - if (currentToken().kind() === 19 /* CatchKeyword */) { - catchClause = parseCatchClause(); - } - var finallyClause = undefined; - if (!catchClause || currentToken().kind() === 27 /* FinallyKeyword */) { - finallyClause = parseFinallyClause(); - } - return new TypeScript.TryStatementSyntax(parseNodeData, tryKeyword, block, catchClause, finallyClause); - } - function parseCatchClauseBlock() { - var savedListParsingState = listParsingState; - listParsingState |= (1 << 7 /* CatchBlock_Statements */); - var block = parseBlock(false, false); - listParsingState = savedListParsingState; - return block; - } - function parseCatchClause() { - return new TypeScript.CatchClauseSyntax(parseNodeData, eatToken(19 /* CatchKeyword */), eatToken(74 /* OpenParenToken */), eatIdentifierToken(), parseOptionalTypeAnnotation(false), eatToken(75 /* CloseParenToken */), parseCatchClauseBlock()); - } - function parseFinallyClause() { - return new TypeScript.FinallyClauseSyntax(parseNodeData, eatToken(27 /* FinallyKeyword */), parseBlock(false, false)); - } - function parseWithStatement(withKeyword) { - return new TypeScript.WithStatementSyntax(parseNodeData, consumeToken(withKeyword), eatToken(74 /* OpenParenToken */), parseExpression(true), eatToken(75 /* CloseParenToken */), parseStatement(false)); - } - function parseWhileStatement(whileKeyword) { - return new TypeScript.WhileStatementSyntax(parseNodeData, consumeToken(whileKeyword), eatToken(74 /* OpenParenToken */), parseExpression(true), eatToken(75 /* CloseParenToken */), parseStatement(false)); - } - function isEmptyStatement(currentToken, inErrorRecovery) { - if (inErrorRecovery) { - return false; - } - return currentToken.kind() === 80 /* SemicolonToken */; - } - function parseEmptyStatement(semicolonToken) { - return new TypeScript.EmptyStatementSyntax(parseNodeData, consumeToken(semicolonToken)); - } - function parseForOrForInStatement(forKeyword) { - consumeToken(forKeyword); - var openParenToken = eatToken(74 /* OpenParenToken */); - var _currentToken = currentToken(); - var tokenKind = _currentToken.kind(); - if (tokenKind === 42 /* VarKeyword */) { - return parseForOrForInStatementWithVariableDeclaration(forKeyword, openParenToken); - } - else if (tokenKind === 80 /* SemicolonToken */) { - return parseForStatementWithNoVariableDeclarationOrInitializer(forKeyword, openParenToken); - } - else { - return parseForOrForInStatementWithInitializer(forKeyword, openParenToken); - } - } - function parseForOrForInStatementWithVariableDeclaration(forKeyword, openParenToken) { - var variableDeclaration = parseVariableDeclaration(false); - return currentToken().kind() === 31 /* InKeyword */ ? parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, undefined) : parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, undefined); - } - function parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, initializer) { - return new TypeScript.ForInStatementSyntax(parseNodeData, forKeyword, openParenToken, variableDeclaration, initializer, eatToken(31 /* InKeyword */), parseExpression(true), eatToken(75 /* CloseParenToken */), parseStatement(false)); - } - function parseForOrForInStatementWithInitializer(forKeyword, openParenToken) { - var initializer = parseExpression(false); - return currentToken().kind() === 31 /* InKeyword */ ? parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, undefined, initializer) : parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, undefined, initializer); - } - function parseForStatementWithNoVariableDeclarationOrInitializer(forKeyword, openParenToken) { - return parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, undefined, undefined); - } - function tryParseForStatementCondition() { - var tokenKind = currentToken().kind(); - if (tokenKind !== 80 /* SemicolonToken */ && tokenKind !== 75 /* CloseParenToken */ && tokenKind !== 8 /* EndOfFileToken */) { - return parseExpression(true); - } - return undefined; - } - function tryParseForStatementIncrementor() { - var tokenKind = currentToken().kind(); - if (tokenKind !== 75 /* CloseParenToken */ && tokenKind !== 8 /* EndOfFileToken */) { - return parseExpression(true); - } - return undefined; - } - function parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, initializer) { - return new TypeScript.ForStatementSyntax(parseNodeData, forKeyword, openParenToken, variableDeclaration, initializer, eatToken(80 /* SemicolonToken */), tryParseForStatementCondition(), eatToken(80 /* SemicolonToken */), tryParseForStatementIncrementor(), eatToken(75 /* CloseParenToken */), parseStatement(false)); - } - function tryEatBreakOrContinueLabel() { - var identifier = undefined; - if (!canEatExplicitOrAutomaticSemicolon(false)) { - if (isIdentifier(currentToken())) { - return eatIdentifierToken(); - } - } - return undefined; - } - function parseBreakStatement(breakKeyword) { - return new TypeScript.BreakStatementSyntax(parseNodeData, consumeToken(breakKeyword), tryEatBreakOrContinueLabel(), eatExplicitOrAutomaticSemicolon(false)); - } - function parseContinueStatement(continueKeyword) { - return new TypeScript.ContinueStatementSyntax(parseNodeData, consumeToken(continueKeyword), tryEatBreakOrContinueLabel(), eatExplicitOrAutomaticSemicolon(false)); - } - function parseSwitchStatement(switchKeyword) { - consumeToken(switchKeyword); - var openParenToken = eatToken(74 /* OpenParenToken */); - var expression = parseExpression(true); - var closeParenToken = eatToken(75 /* CloseParenToken */); - var openBraceToken = eatToken(72 /* OpenBraceToken */); - var switchClauses; - if (openBraceToken.fullWidth() > 0) { - var skippedTokens = getArray(); - switchClauses = parseSyntaxList(3 /* SwitchStatement_SwitchClauses */, skippedTokens); - openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); - } - return new TypeScript.SwitchStatementSyntax(parseNodeData, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses || [], eatToken(73 /* CloseBraceToken */)); - } - function isSwitchClause() { - if (TypeScript.SyntaxUtilities.isSwitchClause(currentNode())) { - return true; - } - var currentTokenKind = currentToken().kind(); - return currentTokenKind === 18 /* CaseKeyword */ || currentTokenKind === 22 /* DefaultKeyword */; - } - function tryParseSwitchClause() { - var node = currentNode(); - if (TypeScript.SyntaxUtilities.isSwitchClause(node)) { - consumeNode(node); - return node; - } - var _currentToken = currentToken(); - var kind = _currentToken.kind(); - if (kind === 18 /* CaseKeyword */) { - return parseCaseSwitchClause(_currentToken); - } - else if (kind === 22 /* DefaultKeyword */) { - return parseDefaultSwitchClause(_currentToken); - } - else { - return undefined; - } - } - function parseCaseSwitchClause(caseKeyword) { - consumeToken(caseKeyword); - var expression = parseExpression(true); - var colonToken = eatToken(108 /* ColonToken */); - var statements; - if (colonToken.fullWidth() > 0) { - var skippedTokens = getArray(); - statements = parseSyntaxList(4 /* SwitchClause_Statements */, skippedTokens); - colonToken = addSkippedTokensAfterToken(colonToken, skippedTokens); - } - return new TypeScript.CaseSwitchClauseSyntax(parseNodeData, caseKeyword, expression, colonToken, statements || []); - } - function parseDefaultSwitchClause(defaultKeyword) { - consumeToken(defaultKeyword); - var colonToken = eatToken(108 /* ColonToken */); - var statements; - if (colonToken.fullWidth() > 0) { - var skippedTokens = getArray(); - statements = parseSyntaxList(4 /* SwitchClause_Statements */, skippedTokens); - colonToken = addSkippedTokensAfterToken(colonToken, skippedTokens); - } - return new TypeScript.DefaultSwitchClauseSyntax(parseNodeData, defaultKeyword, colonToken, statements || []); - } - function parseThrowStatementExpression() { - return canEatExplicitOrAutomaticSemicolon(false) ? createMissingToken(9 /* IdentifierName */, undefined) : parseExpression(true); - } - function parseThrowStatement(throwKeyword) { - return new TypeScript.ThrowStatementSyntax(parseNodeData, consumeToken(throwKeyword), parseThrowStatementExpression(), eatExplicitOrAutomaticSemicolon(false)); - } - function tryParseReturnStatementExpression() { - return !canEatExplicitOrAutomaticSemicolon(false) ? parseExpression(true) : undefined; - } - function parseReturnStatement(returnKeyword) { - return new TypeScript.ReturnStatementSyntax(parseNodeData, consumeToken(returnKeyword), tryParseReturnStatementExpression(), eatExplicitOrAutomaticSemicolon(false)); - } - function isExpressionStatement(currentToken) { - var tokenKind = currentToken.kind(); - return tokenKind !== 72 /* OpenBraceToken */ && tokenKind !== 29 /* FunctionKeyword */ && isExpression(currentToken); - } - function isAssignmentOrOmittedExpression() { - var _currentToken = currentToken(); - return _currentToken.kind() === 81 /* CommaToken */ || isExpression(_currentToken); - } - function tryParseAssignmentOrOmittedExpression() { - if (currentToken().kind() === 81 /* CommaToken */) { - return new TypeScript.OmittedExpressionSyntax(parseNodeData); - } - return tryParseAssignmentExpressionOrHigher(false, true); - } - function isExpression(currentToken) { - switch (currentToken.kind()) { - case 11 /* NumericLiteral */: - case 12 /* StringLiteral */: - case 10 /* RegularExpressionLiteral */: - case 13 /* NoSubstitutionTemplateToken */: - case 14 /* TemplateStartToken */: - case 76 /* OpenBracketToken */: - case 74 /* OpenParenToken */: - case 82 /* LessThanToken */: - case 95 /* PlusPlusToken */: - case 96 /* MinusMinusToken */: - case 91 /* PlusToken */: - case 92 /* MinusToken */: - case 104 /* TildeToken */: - case 103 /* ExclamationToken */: - case 72 /* OpenBraceToken */: - case 87 /* EqualsGreaterThanToken */: - case 120 /* SlashToken */: - case 121 /* SlashEqualsToken */: - case 52 /* SuperKeyword */: - case 37 /* ThisKeyword */: - case 39 /* TrueKeyword */: - case 26 /* FalseKeyword */: - case 34 /* NullKeyword */: - case 33 /* NewKeyword */: - case 23 /* DeleteKeyword */: - case 43 /* VoidKeyword */: - case 41 /* TypeOfKeyword */: - case 29 /* FunctionKeyword */: - return true; - } - return isIdentifier(currentToken); - } - function parseExpressionStatement() { - return new TypeScript.ExpressionStatementSyntax(parseNodeData, parseExpression(true), eatExplicitOrAutomaticSemicolon(false)); - } - function parseIfStatement(ifKeyword) { - return new TypeScript.IfStatementSyntax(parseNodeData, consumeToken(ifKeyword), eatToken(74 /* OpenParenToken */), parseExpression(true), eatToken(75 /* CloseParenToken */), parseStatement(false), parseOptionalElseClause()); - } - function parseOptionalElseClause() { - return currentToken().kind() === 25 /* ElseKeyword */ ? parseElseClause() : undefined; - } - function parseElseClause() { - return new TypeScript.ElseClauseSyntax(parseNodeData, eatToken(25 /* ElseKeyword */), parseStatement(false)); - } - function isVariableStatement(modifierCount) { - return peekToken(modifierCount).kind() === 42 /* VarKeyword */; - } - function parseVariableStatement() { - return new TypeScript.VariableStatementSyntax(parseNodeData, parseModifiers(), parseVariableDeclaration(true), eatExplicitOrAutomaticSemicolon(false)); - } - function parseVariableDeclaration(allowIn) { - var varKeyword = eatToken(42 /* VarKeyword */); - var listParsingState = allowIn ? 12 /* VariableDeclaration_VariableDeclarators_AllowIn */ : 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */; - var skippedTokens = getArray(); - var variableDeclarators = parseSeparatedSyntaxList(listParsingState, skippedTokens); - varKeyword = addSkippedTokensAfterToken(varKeyword, skippedTokens); - return new TypeScript.VariableDeclarationSyntax(parseNodeData, varKeyword, variableDeclarators); - } - function isVariableDeclarator() { - var node = currentNode(); - if (node && node.kind() === 191 /* VariableDeclarator */) { - return true; - } - return isIdentifier(currentToken()); - } - function canReuseVariableDeclaratorNode(node) { - if (!node || node.kind() !== 191 /* VariableDeclarator */) { - return false; - } - var variableDeclarator = node; - return variableDeclarator.equalsValueClause === undefined; - } - function tryParseVariableDeclarator(allowIn, allowPropertyName) { - var node = currentNode(); - if (canReuseVariableDeclaratorNode(node)) { - consumeNode(node); - return node; - } - if (allowPropertyName) { - } - if (!allowPropertyName && !isIdentifier(currentToken())) { - return undefined; - } - var propertyName = allowPropertyName ? eatPropertyName() : eatIdentifierToken(); - var equalsValueClause = undefined; - var typeAnnotation = undefined; - if (propertyName.fullWidth() > 0) { - typeAnnotation = parseOptionalTypeAnnotation(false); - if (isEqualsValueClause(false)) { - equalsValueClause = parseEqualsValueClause(allowIn); - } - } - return new TypeScript.VariableDeclaratorSyntax(parseNodeData, propertyName, typeAnnotation, equalsValueClause); - } - function isEqualsValueClause(inParameter) { - var token0 = currentToken(); - if (token0.kind() === 109 /* EqualsToken */) { - return true; - } - if (!previousTokenHasTrailingNewLine(token0)) { - var tokenKind = token0.kind(); - if (tokenKind === 87 /* EqualsGreaterThanToken */) { - return false; - } - if (tokenKind === 72 /* OpenBraceToken */ && inParameter) { - return false; - } - return isExpression(token0); - } - return false; - } - function parseEqualsValueClause(allowIn) { - return new TypeScript.EqualsValueClauseSyntax(parseNodeData, eatToken(109 /* EqualsToken */), tryParseAssignmentExpressionOrHigher(true, allowIn)); - } - function parseExpression(allowIn) { - var leftOperand = tryParseAssignmentExpressionOrHigher(true, allowIn); - while (true) { - var _currentToken = currentToken(); - if (_currentToken.kind() !== 81 /* CommaToken */) { - break; - } - leftOperand = new TypeScript.BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(_currentToken), tryParseAssignmentExpressionOrHigher(true, allowIn)); - } - return leftOperand; - } - function tryParseAssignmentExpressionOrHigher(force, allowIn) { - var _currentToken = currentToken(); - var arrowFunction = tryParseAnyArrowFunctionExpression(_currentToken); - if (arrowFunction) { - return arrowFunction; - } - var leftOperand = tryParseBinaryExpressionOrHigher(_currentToken, force, 1 /* Lowest */, allowIn); - if (leftOperand === undefined) { - return undefined; - } - if (TypeScript.SyntaxUtilities.isLeftHandSizeExpression(leftOperand)) { - var operatorToken = currentOperatorToken(); - if (TypeScript.SyntaxFacts.isAssignmentOperatorToken(operatorToken.kind())) { - return new TypeScript.BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(operatorToken), tryParseAssignmentExpressionOrHigher(true, allowIn)); - } - } - return parseConditionalExpressionRest(allowIn, leftOperand); - } - function tryParseAnyArrowFunctionExpression(_currentToken) { - return isSimpleArrowFunctionExpression(_currentToken) ? parseSimpleArrowFunctionExpression() : tryParseParenthesizedArrowFunctionExpression(); - } - function tryParseUnaryExpressionOrHigher(_currentToken, force) { - var currentTokenKind = _currentToken.kind(); - switch (currentTokenKind) { - case 91 /* PlusToken */: - case 92 /* MinusToken */: - case 104 /* TildeToken */: - case 103 /* ExclamationToken */: - case 95 /* PlusPlusToken */: - case 96 /* MinusMinusToken */: - return new TypeScript.PrefixUnaryExpressionSyntax(parseNodeData, consumeToken(_currentToken), tryParseUnaryExpressionOrHigher(currentToken(), true)); - case 41 /* TypeOfKeyword */: return parseTypeOfExpression(_currentToken); - case 43 /* VoidKeyword */: return parseVoidExpression(_currentToken); - case 23 /* DeleteKeyword */: return parseDeleteExpression(_currentToken); - case 82 /* LessThanToken */: return parseCastExpression(_currentToken); - default: - return tryParsePostfixExpressionOrHigher(_currentToken, force); - } - } - function tryParseBinaryExpressionOrHigher(_currentToken, force, precedence, allowIn) { - var leftOperand = tryParseUnaryExpressionOrHigher(_currentToken, force); - if (leftOperand === undefined) { - return undefined; - } - return parseBinaryExpressionRest(precedence, allowIn, leftOperand); - } - function parseConditionalExpressionRest(allowIn, leftOperand) { - var _currentToken = currentToken(); - if (_currentToken.kind() !== 107 /* QuestionToken */) { - return leftOperand; - } - return new TypeScript.ConditionalExpressionSyntax(parseNodeData, leftOperand, consumeToken(_currentToken), tryParseAssignmentExpressionOrHigher(true, true), eatToken(108 /* ColonToken */), tryParseAssignmentExpressionOrHigher(true, allowIn)); - } - function parseBinaryExpressionRest(precedence, allowIn, leftOperand) { - while (true) { - var operatorToken = currentOperatorToken(); - var tokenKind = operatorToken.kind(); - if (!TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(tokenKind) || tokenKind === 81 /* CommaToken */ || TypeScript.SyntaxFacts.isAssignmentOperatorToken(tokenKind)) { - break; - } - if (tokenKind === 31 /* InKeyword */ && !allowIn) { - break; - } - var newPrecedence = getBinaryExpressionPrecedence(tokenKind); - if (newPrecedence <= precedence) { - break; - } - leftOperand = new TypeScript.BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(operatorToken), tryParseBinaryExpressionOrHigher(currentToken(), true, newPrecedence, allowIn)); - } - return leftOperand; - } - function currentOperatorToken() { - var token0 = currentToken(); - if (token0.kind() === 83 /* GreaterThanToken */) { - return currentContextualToken(); - } - return token0; - } - function tryParseMemberExpressionOrHigher(_currentToken, force, inObjectCreation) { - var expression = tryParsePrimaryExpression(_currentToken, force); - if (expression === undefined) { - return undefined; - } - return parseMemberExpressionRest(expression, inObjectCreation); - } - function parseCallExpressionRest(expression) { - while (true) { - var _currentToken = currentToken(); - var currentTokenKind = _currentToken.kind(); - switch (currentTokenKind) { - case 74 /* OpenParenToken */: - expression = new TypeScript.InvocationExpressionSyntax(parseNodeData, expression, parseArgumentList(undefined)); - continue; - case 82 /* LessThanToken */: - var argumentList = tryParseArgumentList(); - if (argumentList === undefined) { - break; - } - expression = new TypeScript.InvocationExpressionSyntax(parseNodeData, expression, argumentList); - continue; - case 76 /* OpenBracketToken */: - expression = parseElementAccessExpression(expression, _currentToken, false); - continue; - case 78 /* DotToken */: - expression = new TypeScript.MemberAccessExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken), eatIdentifierNameToken()); - continue; - case 13 /* NoSubstitutionTemplateToken */: - case 14 /* TemplateStartToken */: - expression = new TypeScript.TemplateAccessExpressionSyntax(parseNodeData, expression, parseTemplateExpression(_currentToken)); - continue; - } - return expression; - } - } - function parseMemberExpressionRest(expression, inObjectCreation) { - while (true) { - var _currentToken = currentToken(); - var currentTokenKind = _currentToken.kind(); - switch (currentTokenKind) { - case 76 /* OpenBracketToken */: - expression = parseElementAccessExpression(expression, _currentToken, inObjectCreation); - continue; - case 78 /* DotToken */: - expression = new TypeScript.MemberAccessExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken), eatIdentifierNameToken()); - continue; - case 13 /* NoSubstitutionTemplateToken */: - case 14 /* TemplateStartToken */: - expression = new TypeScript.TemplateAccessExpressionSyntax(parseNodeData, expression, parseTemplateExpression(_currentToken)); - continue; - } - return expression; - } - } - function tryParseLeftHandSideExpressionOrHigher(_currentToken, force) { - var expression = undefined; - if (_currentToken.kind() === 52 /* SuperKeyword */) { - expression = parseSuperExpression(_currentToken); - } - else { - expression = tryParseMemberExpressionOrHigher(_currentToken, force, false); - if (expression === undefined) { - return undefined; - } - } - return parseCallExpressionRest(expression); - } - function parseSuperExpression(superToken) { - var expression = consumeToken(superToken); - var currentTokenKind = currentToken().kind(); - return currentTokenKind === 74 /* OpenParenToken */ || currentTokenKind === 78 /* DotToken */ ? expression : new TypeScript.MemberAccessExpressionSyntax(parseNodeData, expression, eatToken(78 /* DotToken */), eatIdentifierNameToken()); - } - function tryParsePostfixExpressionOrHigher(_currentToken, force) { - var expression = tryParseLeftHandSideExpressionOrHigher(_currentToken, force); - if (expression === undefined) { - return undefined; - } - var _currentToken = currentToken(); - var currentTokenKind = _currentToken.kind(); - switch (currentTokenKind) { - case 95 /* PlusPlusToken */: - case 96 /* MinusMinusToken */: - if (previousTokenHasTrailingNewLine(_currentToken)) { - break; - } - return new TypeScript.PostfixUnaryExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken)); - } - return expression; - } - function tryParseGenericArgumentList() { - var rewindPoint = getRewindPoint(); - var typeArgumentList = tryParseTypeArgumentList(true); - var token0 = currentToken(); - var tokenKind = token0.kind(); - var isOpenParen = tokenKind === 74 /* OpenParenToken */; - var isDot = tokenKind === 78 /* DotToken */; - var isOpenParenOrDot = isOpenParen || isDot; - var argumentList = undefined; - if (!typeArgumentList || !isOpenParenOrDot) { - rewind(rewindPoint); - releaseRewindPoint(rewindPoint); - return undefined; - } - else { - releaseRewindPoint(rewindPoint); - if (isDot) { - var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), TypeScript.start(token0, source.text), TypeScript.width(token0), TypeScript.DiagnosticCode.A_parameter_list_must_follow_a_generic_type_argument_list_expected, undefined); - addDiagnostic(diagnostic); - return new TypeScript.ArgumentListSyntax(parseNodeData, typeArgumentList, TypeScript.Syntax.emptyToken(74 /* OpenParenToken */), [], TypeScript.Syntax.emptyToken(75 /* CloseParenToken */)); - } - else { - return parseArgumentList(typeArgumentList); - } - } - } - function tryParseArgumentList() { - var tokenKind = currentToken().kind(); - if (tokenKind === 82 /* LessThanToken */) { - return tryParseGenericArgumentList(); - } - if (tokenKind === 74 /* OpenParenToken */) { - return parseArgumentList(undefined); - } - return undefined; - } - function parseArgumentList(typeArgumentList) { - var openParenToken = eatToken(74 /* OpenParenToken */); - var _arguments; - if (openParenToken.fullWidth() > 0) { - var skippedTokens = getArray(); - _arguments = parseSeparatedSyntaxList(14 /* ArgumentList_AssignmentExpressions */, skippedTokens); - openParenToken = addSkippedTokensAfterToken(openParenToken, skippedTokens); - } - return new TypeScript.ArgumentListSyntax(parseNodeData, typeArgumentList, openParenToken, _arguments || [], eatToken(75 /* CloseParenToken */)); - } - function tryParseArgumentListExpression() { - var force = currentToken().kind() === 81 /* CommaToken */; - return tryParseAssignmentExpressionOrHigher(force, true); - } - function parseElementAccessArgumentExpression(openBracketToken, inObjectCreation) { - if (inObjectCreation && currentToken().kind() === 77 /* CloseBracketToken */) { - var errorStart = TypeScript.start(openBracketToken, source.text); - var errorEnd = TypeScript.end(currentToken(), source.text); - var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), errorStart, errorEnd - errorStart, TypeScript.DiagnosticCode.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead, undefined); - addDiagnostic(diagnostic); - return TypeScript.Syntax.emptyToken(9 /* IdentifierName */); - } - else { - return parseExpression(true); - } - } - function parseElementAccessExpression(expression, openBracketToken, inObjectCreation) { - return new TypeScript.ElementAccessExpressionSyntax(parseNodeData, expression, consumeToken(openBracketToken), parseElementAccessArgumentExpression(openBracketToken, inObjectCreation), eatToken(77 /* CloseBracketToken */)); - } - function tryParsePrimaryExpression(_currentToken, force) { - if (isIdentifier(_currentToken)) { - return eatIdentifierToken(); - } - var currentTokenKind = _currentToken.kind(); - switch (currentTokenKind) { - case 37 /* ThisKeyword */: - case 39 /* TrueKeyword */: - case 26 /* FalseKeyword */: - case 34 /* NullKeyword */: - case 11 /* NumericLiteral */: - case 10 /* RegularExpressionLiteral */: - case 12 /* StringLiteral */: - return consumeToken(_currentToken); - case 29 /* FunctionKeyword */: return parseFunctionExpression(_currentToken); - case 76 /* OpenBracketToken */: return parseArrayLiteralExpression(_currentToken); - case 72 /* OpenBraceToken */: return parseObjectLiteralExpression(_currentToken); - case 74 /* OpenParenToken */: return parseParenthesizedExpression(_currentToken); - case 33 /* NewKeyword */: return parseObjectCreationExpression(_currentToken); - case 13 /* NoSubstitutionTemplateToken */: - case 14 /* TemplateStartToken */: - return parseTemplateExpression(_currentToken); - case 120 /* SlashToken */: - case 121 /* SlashEqualsToken */: - var result = tryReparseDivideAsRegularExpression(); - return result || eatIdentifierToken(TypeScript.DiagnosticCode.Expression_expected); - } - if (!force) { - return undefined; - } - return eatIdentifierToken(TypeScript.DiagnosticCode.Expression_expected); - } - function tryReparseDivideAsRegularExpression() { - var currentToken = currentContextualToken(); - var tokenKind = currentToken.kind(); - if (tokenKind === 120 /* SlashToken */ || tokenKind === 121 /* SlashEqualsToken */) { - return undefined; - } - else if (tokenKind === 10 /* RegularExpressionLiteral */) { - return consumeToken(currentToken); - } - else { - throw TypeScript.Errors.invalidOperation(); - } - } - function parseTypeOfExpression(typeOfKeyword) { - return new TypeScript.TypeOfExpressionSyntax(parseNodeData, consumeToken(typeOfKeyword), tryParseUnaryExpressionOrHigher(currentToken(), true)); - } - function parseDeleteExpression(deleteKeyword) { - return new TypeScript.DeleteExpressionSyntax(parseNodeData, consumeToken(deleteKeyword), tryParseUnaryExpressionOrHigher(currentToken(), true)); - } - function parseVoidExpression(voidKeyword) { - return new TypeScript.VoidExpressionSyntax(parseNodeData, consumeToken(voidKeyword), tryParseUnaryExpressionOrHigher(currentToken(), true)); - } - function parseFunctionExpression(functionKeyword) { - return new TypeScript.FunctionExpressionSyntax(parseNodeData, consumeToken(functionKeyword), eatOptionalIdentifierToken(), parseCallSignature(false), parseBlock(false, true)); - } - function parseObjectCreationExpression(newKeyword) { - return new TypeScript.ObjectCreationExpressionSyntax(parseNodeData, consumeToken(newKeyword), tryParseMemberExpressionOrHigher(currentToken(), true, true), tryParseArgumentList()); - } - function parseTemplateExpression(startToken) { - consumeToken(startToken); - if (startToken.kind() === 13 /* NoSubstitutionTemplateToken */) { - return startToken; - } - var templateClauses = getArray(); - do { - templateClauses.push(parseTemplateClause()); - } while (templateClauses[templateClauses.length - 1].templateMiddleOrEndToken.kind() === 15 /* TemplateMiddleToken */); - return new TypeScript.TemplateExpressionSyntax(parseNodeData, startToken, TypeScript.Syntax.list(templateClauses)); - } - function parseTemplateClause() { - var expression = parseExpression(true); - var token = currentToken(); - if (token.kind() === 73 /* CloseBraceToken */) { - token = currentContextualToken(); - TypeScript.Debug.assert(token.kind() === 15 /* TemplateMiddleToken */ || token.kind() === 16 /* TemplateEndToken */); - consumeToken(token); - } - else { - var diagnostic = getExpectedTokenDiagnostic(73 /* CloseBraceToken */); - addDiagnostic(diagnostic); - token = TypeScript.Syntax.emptyToken(16 /* TemplateEndToken */); - } - return new TypeScript.TemplateClauseSyntax(parseNodeData, expression, token); - } - function parseCastExpression(lessThanToken) { - return new TypeScript.CastExpressionSyntax(parseNodeData, consumeToken(lessThanToken), parseType(), eatToken(83 /* GreaterThanToken */), tryParseUnaryExpressionOrHigher(currentToken(), true)); - } - function parseParenthesizedExpression(openParenToken) { - return new TypeScript.ParenthesizedExpressionSyntax(parseNodeData, consumeToken(openParenToken), parseExpression(true), eatToken(75 /* CloseParenToken */)); - } - function tryParseParenthesizedArrowFunctionExpression() { - var tokenKind = currentToken().kind(); - if (tokenKind !== 74 /* OpenParenToken */ && tokenKind !== 82 /* LessThanToken */) { - return undefined; - } - if (isDefinitelyArrowFunctionExpression()) { - return tryParseParenthesizedArrowFunctionExpressionWorker(false); - } - if (!isPossiblyArrowFunctionExpression()) { - return undefined; - } - var rewindPoint = getRewindPoint(); - var arrowFunction = tryParseParenthesizedArrowFunctionExpressionWorker(true); - if (arrowFunction === undefined) { - rewind(rewindPoint); - } - releaseRewindPoint(rewindPoint); - return arrowFunction; - } - function tryParseParenthesizedArrowFunctionExpressionWorker(requireArrow) { - var _currentToken = currentToken(); - var callSignature = parseCallSignature(true); - if (requireArrow && currentToken().kind() !== 87 /* EqualsGreaterThanToken */) { - return undefined; - } - var equalsGreaterThanToken = eatToken(87 /* EqualsGreaterThanToken */); - var block = tryParseArrowFunctionBlock(); - var expression = undefined; - if (block === undefined) { - expression = tryParseAssignmentExpressionOrHigher(true, true); - } - return new TypeScript.ParenthesizedArrowFunctionExpressionSyntax(parseNodeData, callSignature, equalsGreaterThanToken, block, expression); - } - function tryParseArrowFunctionBlock() { - if (isBlock()) { - return parseBlock(false, false); - } - else { - var _modifierCount = modifierCount(); - if (isStatement(_modifierCount, false) && !isExpressionStatement(currentToken()) && !isFunctionDeclaration(_modifierCount)) { - return parseBlock(true, false); - } - else { - return undefined; - } - } - } - function isSimpleArrowFunctionExpression(_currentToken) { - if (_currentToken.kind() === 87 /* EqualsGreaterThanToken */) { - return true; - } - return isIdentifier(_currentToken) && peekToken(1).kind() === 87 /* EqualsGreaterThanToken */; - } - function parseSimpleArrowFunctionExpression() { - var parameter = eatSimpleParameter(); - var equalsGreaterThanToken = eatToken(87 /* EqualsGreaterThanToken */); - var block = tryParseArrowFunctionBlock(); - var expression = undefined; - if (block === undefined) { - expression = tryParseAssignmentExpressionOrHigher(true, true); - } - return new TypeScript.SimpleArrowFunctionExpressionSyntax(parseNodeData, parameter, equalsGreaterThanToken, block, expression); - } - function isBlock() { - return currentToken().kind() === 72 /* OpenBraceToken */; - } - function isDefinitelyArrowFunctionExpression() { - var token0 = currentToken(); - if (token0.kind() !== 74 /* OpenParenToken */) { - return false; - } - var token1 = peekToken(1); - var token1Kind = token1.kind(); - var token2; - if (token1Kind === 75 /* CloseParenToken */) { - token2 = peekToken(2); - var token2Kind = token2.kind(); - return token2Kind === 108 /* ColonToken */ || token2Kind === 87 /* EqualsGreaterThanToken */ || token2Kind === 72 /* OpenBraceToken */; - } - if (token1Kind === 79 /* DotDotDotToken */) { - return true; - } - token2 = peekToken(2); - token2Kind = token2.kind(); - if (TypeScript.SyntaxFacts.isAccessibilityModifier(token1Kind)) { - if (isIdentifier(token2)) { - return true; - } - } - if (!isIdentifier(token1)) { - return false; - } - if (token2Kind === 108 /* ColonToken */) { - return true; - } - var token3 = peekToken(3); - var token3Kind = token3.kind(); - if (token2Kind === 107 /* QuestionToken */) { - if (token3Kind === 108 /* ColonToken */ || token3Kind === 75 /* CloseParenToken */ || token3Kind === 81 /* CommaToken */) { - return true; - } - } - if (token2Kind === 75 /* CloseParenToken */) { - if (token3Kind === 87 /* EqualsGreaterThanToken */) { - return true; - } - } - return false; - } - function isPossiblyArrowFunctionExpression() { - var token0 = currentToken(); - if (token0.kind() !== 74 /* OpenParenToken */) { - return true; - } - var token1 = peekToken(1); - if (!isIdentifier(token1)) { - return false; - } - var token2 = peekToken(2); - var token2Kind = token2.kind(); - if (token2Kind === 109 /* EqualsToken */) { - return true; - } - if (token2Kind === 81 /* CommaToken */) { - return true; - } - if (token2Kind === 75 /* CloseParenToken */) { - var token3 = peekToken(3); - if (token3.kind() === 108 /* ColonToken */) { - return true; - } - } - return false; - } - function parseObjectLiteralExpression(openBraceToken) { - consumeToken(openBraceToken); - var skippedTokens = getArray(); - var propertyAssignments = parseSeparatedSyntaxList(15 /* ObjectLiteralExpression_PropertyAssignments */, skippedTokens); - openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); - return new TypeScript.ObjectLiteralExpressionSyntax(parseNodeData, openBraceToken, propertyAssignments, eatToken(73 /* CloseBraceToken */)); - } - function tryParsePropertyAssignment(inErrorRecovery) { - if (isAccessor(modifierCount(), inErrorRecovery)) { - return parseAccessor(true); - } - else if (isFunctionPropertyAssignment(inErrorRecovery)) { - return parseFunctionPropertyAssignment(); - } - else if (isSimplePropertyAssignment(inErrorRecovery)) { - return parseSimplePropertyAssignment(); - } - else { - return undefined; - } - } - function isPropertyAssignment(inErrorRecovery) { - return isAccessor(modifierCount(), inErrorRecovery) || isFunctionPropertyAssignment(inErrorRecovery) || isSimplePropertyAssignment(inErrorRecovery); - } - function eatPropertyName() { - var _currentToken = currentToken(); - return TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(_currentToken) ? eatIdentifierNameToken() : consumeToken(_currentToken); - } - function isFunctionPropertyAssignment(inErrorRecovery) { - return isPropertyName(currentToken(), inErrorRecovery) && isCallSignature(1); - } - function parseFunctionPropertyAssignment() { - return new TypeScript.FunctionPropertyAssignmentSyntax(parseNodeData, eatPropertyName(), parseCallSignature(false), parseBlock(false, true)); - } - function isSimplePropertyAssignment(inErrorRecovery) { - return isPropertyName(currentToken(), inErrorRecovery); - } - function parseSimplePropertyAssignment() { - return new TypeScript.SimplePropertyAssignmentSyntax(parseNodeData, eatPropertyName(), eatToken(108 /* ColonToken */), tryParseAssignmentExpressionOrHigher(true, true)); - } - function isPropertyName(token, inErrorRecovery) { - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token)) { - if (inErrorRecovery) { - return isIdentifier(token); - } - else { - return true; - } - } - var kind = token.kind(); - return kind === 12 /* StringLiteral */ || kind === 11 /* NumericLiteral */ || kind === 13 /* NoSubstitutionTemplateToken */; - } - function parseArrayLiteralExpression(openBracketToken) { - consumeToken(openBracketToken); - var skippedTokens = getArray(); - var expressions = parseSeparatedSyntaxList(16 /* ArrayLiteralExpression_AssignmentExpressions */, skippedTokens); - openBracketToken = addSkippedTokensAfterToken(openBracketToken, skippedTokens); - return new TypeScript.ArrayLiteralExpressionSyntax(parseNodeData, openBracketToken, expressions, eatToken(77 /* CloseBracketToken */)); - } - function parseBlock(parseBlockEvenWithNoOpenBrace, checkForStrictMode) { - var openBraceToken = eatToken(72 /* OpenBraceToken */); - var statements; - if (parseBlockEvenWithNoOpenBrace || openBraceToken.fullWidth() > 0) { - var savedIsInStrictMode = isInStrictMode; - var processItems = checkForStrictMode ? updateStrictModeState : undefined; - var skippedTokens = getArray(); - var statements = parseSyntaxList(5 /* Block_Statements */, skippedTokens, processItems); - openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); - setStrictMode(savedIsInStrictMode); - } - return new TypeScript.BlockSyntax(parseNodeData, openBraceToken, statements || [], eatToken(73 /* CloseBraceToken */)); - } - function parseCallSignature(requireCompleteTypeParameterList) { - return new TypeScript.CallSignatureSyntax(parseNodeData, tryParseTypeParameterList(requireCompleteTypeParameterList), parseParameterList(), parseOptionalTypeAnnotation(false)); - } - function tryParseTypeParameterList(requireCompleteTypeParameterList) { - var _currentToken = currentToken(); - if (_currentToken.kind() !== 82 /* LessThanToken */) { - return undefined; - } - var rewindPoint = getRewindPoint(); - var lessThanToken = consumeToken(_currentToken); - var skippedTokens = getArray(); - var typeParameters = parseSeparatedSyntaxList(20 /* TypeParameterList_TypeParameters */, skippedTokens); - lessThanToken = addSkippedTokensAfterToken(lessThanToken, skippedTokens); - var greaterThanToken = eatToken(83 /* GreaterThanToken */); - if (requireCompleteTypeParameterList && greaterThanToken.fullWidth() === 0) { - rewind(rewindPoint); - releaseRewindPoint(rewindPoint); - return undefined; - } - else { - releaseRewindPoint(rewindPoint); - return new TypeScript.TypeParameterListSyntax(parseNodeData, lessThanToken, typeParameters, greaterThanToken); - } - } - function isTypeParameter() { - return isIdentifier(currentToken()); - } - function tryParseTypeParameter() { - if (!isIdentifier(currentToken())) { - return undefined; - } - return new TypeScript.TypeParameterSyntax(parseNodeData, eatIdentifierToken(), tryParseConstraint()); - } - function tryParseConstraint() { - if (currentToken().kind() !== 50 /* ExtendsKeyword */) { - return undefined; - } - return new TypeScript.ConstraintSyntax(parseNodeData, eatToken(50 /* ExtendsKeyword */), parseTypeOrExpression()); - } - function tryParseParameterList() { - if (currentToken().kind() === 74 /* OpenParenToken */) { - var token1 = peekToken(1); - if (token1.kind() === 75 /* CloseParenToken */ || isParameterHelper(token1)) { - return parseParameterList(); - } - } - return undefined; - } - function parseParameterList() { - var openParenToken = eatToken(74 /* OpenParenToken */); - var parameters; - if (openParenToken.fullWidth() > 0) { - var skippedTokens = getArray(); - parameters = parseSeparatedSyntaxList(17 /* ParameterList_Parameters */, skippedTokens); - openParenToken = addSkippedTokensAfterToken(openParenToken, skippedTokens); - } - return new TypeScript.ParameterListSyntax(parseNodeData, openParenToken, parameters || [], eatToken(75 /* CloseParenToken */)); - } - function parseOptionalTypeAnnotation(allowStringLiteral) { - return currentToken().kind() === 108 /* ColonToken */ ? parseTypeAnnotation(allowStringLiteral) : undefined; - } - function parseTypeAnnotationType(allowStringLiteral) { - if (allowStringLiteral) { - var _currentToken = currentToken(); - if (_currentToken.kind() === 12 /* StringLiteral */) { - return consumeToken(_currentToken); - } - } - return parseType(); - } - function parseTypeAnnotation(allowStringLiteral) { - return new TypeScript.TypeAnnotationSyntax(parseNodeData, consumeToken(currentToken()), parseTypeAnnotationType(allowStringLiteral)); - } - function isType() { - var _currentToken = currentToken(); - switch (_currentToken.kind()) { - case 41 /* TypeOfKeyword */: - case 62 /* AnyKeyword */: - case 69 /* NumberKeyword */: - case 63 /* BooleanKeyword */: - case 71 /* StringKeyword */: - case 43 /* VoidKeyword */: - case 72 /* OpenBraceToken */: - case 74 /* OpenParenToken */: - case 82 /* LessThanToken */: - case 33 /* NewKeyword */: - return true; - default: - return isIdentifier(_currentToken); - } - } - function parseTypeOrExpression() { - var result = tryParseType(); - if (result) { - return result; - } - var _currentToken = currentToken(); - if (isExpression(_currentToken)) { - return tryParseUnaryExpressionOrHigher(_currentToken, true); - } - return eatIdentifierToken(TypeScript.DiagnosticCode.Type_expected); - } - function parseType() { - return tryParseType() || eatIdentifierToken(TypeScript.DiagnosticCode.Type_expected); - } - function tryParseType() { - if (isFunctionType()) { - return parseFunctionType(); - } - if (currentToken().kind() === 33 /* NewKeyword */) { - return parseConstructorType(); - } - return tryParseUnionTypeOrHigher(); - } - function tryParseUnionTypeOrHigher() { - var type = tryParsePrimaryType(); - if (type) { - var barToken; - while ((barToken = currentToken()).kind() === 101 /* BarToken */) { - consumeToken(barToken); - var right = parsePrimaryType(); - type = new TypeScript.UnionTypeSyntax(parseNodeData, type, barToken, right); - } - } - return type; - } - function parsePrimaryType() { - return tryParsePrimaryType() || eatIdentifierToken(TypeScript.DiagnosticCode.Type_expected); - } - function tryParsePrimaryType() { - var type = tryParseNonArrayType(); - while (type) { - var _currentToken = currentToken(); - if (previousTokenHasTrailingNewLine(_currentToken) || _currentToken.kind() !== 76 /* OpenBracketToken */) { - break; - } - type = new TypeScript.ArrayTypeSyntax(parseNodeData, type, consumeToken(_currentToken), eatToken(77 /* CloseBracketToken */)); - } - return type; - } - function parseTypeQuery(typeOfKeyword) { - return new TypeScript.TypeQuerySyntax(parseNodeData, consumeToken(typeOfKeyword), parseName(true)); - } - function tryParseNonArrayType() { - var _currentToken = currentToken(); - switch (_currentToken.kind()) { - case 62 /* AnyKeyword */: - case 69 /* NumberKeyword */: - case 63 /* BooleanKeyword */: - case 71 /* StringKeyword */: - if (peekToken(1).kind() === 78 /* DotToken */) { - break; - } - return consumeToken(_currentToken); - case 43 /* VoidKeyword */: return consumeToken(_currentToken); - case 74 /* OpenParenToken */: return parseParenthesizedType(_currentToken); - case 72 /* OpenBraceToken */: return parseObjectType(); - case 41 /* TypeOfKeyword */: return parseTypeQuery(_currentToken); - case 76 /* OpenBracketToken */: return parseTupleType(_currentToken); - } - return tryParseNameOrGenericType(); - } - function parseParenthesizedType(openParenToken) { - return new TypeScript.ParenthesizedTypeSyntax(parseNodeData, consumeToken(openParenToken), parseType(), eatToken(75 /* CloseParenToken */)); - } - function tryParseNameOrGenericType() { - var name = tryParseName(false); - if (name === undefined) { - return undefined; - } - if (previousTokenHasTrailingNewLine(currentToken())) { - return name; - } - var typeArgumentList = tryParseTypeArgumentList(false); - return !typeArgumentList ? name : new TypeScript.GenericTypeSyntax(parseNodeData, name, typeArgumentList); - } - function isFunctionType() { - var token0 = currentToken(); - var token0Kind = token0.kind(); - if (token0Kind === 82 /* LessThanToken */) { - return true; - } - if (token0Kind === 74 /* OpenParenToken */) { - var token1 = peekToken(1); - var token1Kind = token1.kind(); - if (token1Kind === 75 /* CloseParenToken */ || token1Kind === 79 /* DotDotDotToken */) { - return true; - } - if (isModifierKind(token1Kind) || isIdentifier(token1)) { - var token2 = peekToken(2); - var token2Kind = token2.kind(); - if (token2Kind === 108 /* ColonToken */ || token2Kind === 81 /* CommaToken */ || token2Kind === 107 /* QuestionToken */ || token2Kind === 109 /* EqualsToken */ || isIdentifier(token2) || isModifierKind(token2Kind)) { - return true; - } - if (token2Kind === 75 /* CloseParenToken */) { - return peekToken(3).kind() === 87 /* EqualsGreaterThanToken */; - } - } - } - return false; - } - function parseFunctionType() { - var typeParameterList = tryParseTypeParameterList(false); - var parameterList = parseParameterList(); - return new TypeScript.FunctionTypeSyntax(parseNodeData, typeParameterList, parameterList, eatToken(87 /* EqualsGreaterThanToken */), parseType()); - } - function parseConstructorType() { - return new TypeScript.ConstructorTypeSyntax(parseNodeData, eatToken(33 /* NewKeyword */), tryParseTypeParameterList(false), parseParameterList(), eatToken(87 /* EqualsGreaterThanToken */), parseType()); - } - function isParameter() { - if (currentNode() && currentNode().kind() === 208 /* Parameter */) { - return true; - } - return isParameterHelper(currentToken()); - } - function isParameterHelper(token) { - var tokenKind = token.kind(); - return tokenKind === 79 /* DotDotDotToken */ || isModifierKind(tokenKind) || isIdentifier(token); - } - function eatSimpleParameter() { - return new TypeScript.ParameterSyntax(parseNodeData, undefined, [], eatIdentifierToken(), undefined, undefined, undefined); - } - function tryParseParameter() { - var node = currentNode(); - if (node && node.kind() === 208 /* Parameter */) { - consumeNode(node); - return node; - } - var dotDotDotToken = tryEatToken(79 /* DotDotDotToken */); - var modifiers = parseModifiers(); - var _currentToken = currentToken(); - if (!isIdentifier(_currentToken) && !dotDotDotToken && modifiers.length === 0) { - if (isModifierKind(_currentToken.kind())) { - modifiers = TypeScript.Syntax.list([consumeToken(_currentToken)]); - } - else { - return undefined; - } - } - var identifier = eatIdentifierToken(); - var questionToken = tryEatToken(107 /* QuestionToken */); - var typeAnnotation = parseOptionalTypeAnnotation(true); - var equalsValueClause = undefined; - if (isEqualsValueClause(true)) { - equalsValueClause = parseEqualsValueClause(true); - } - return new TypeScript.ParameterSyntax(parseNodeData, dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause); - } - function parseSyntaxList(currentListType, skippedTokens, processItems) { - var savedListParsingState = listParsingState; - listParsingState |= (1 << currentListType); - var result = parseSyntaxListWorker(currentListType, skippedTokens, processItems); - listParsingState = savedListParsingState; - return result; - } - function parseSeparatedSyntaxList(currentListType, skippedTokens) { - var savedListParsingState = listParsingState; - listParsingState |= (1 << currentListType); - var result = parseSeparatedSyntaxListWorker(currentListType, skippedTokens); - listParsingState = savedListParsingState; - return result; - } - function abortParsingListOrMoveToNextToken(currentListType, nodeAndSeparators, skippedTokens) { - reportUnexpectedTokenDiagnostic(currentListType); - for (var state = ListParsingState.LastListParsingState; state >= ListParsingState.FirstListParsingState; state--) { - if ((listParsingState & (1 << state)) !== 0) { - if (isExpectedListTerminator(state) || isExpectedListItem(state, true)) { - return true; - } - } - } - addSkippedTokenToList(nodeAndSeparators, skippedTokens, consumeToken(currentToken())); - return false; - } - function addSkippedTokenToList(nodesAndSeparators, skippedTokens, skippedToken) { - var length = nodesAndSeparators.length; - for (var i = length - 1; i >= 0; i--) { - var item = nodesAndSeparators[i]; - var _lastToken = TypeScript.lastToken(item); - if (_lastToken && _lastToken.fullWidth() > 0) { - nodesAndSeparators[i] = addSkippedTokenAfterNodeOrToken(item, skippedToken); - return; - } - } - skippedTokens.push(skippedToken); - } - function tryParseExpectedListItem(currentListType, inErrorRecovery, items, processItems) { - var item = tryParseExpectedListItemWorker(currentListType, inErrorRecovery); - if (item === undefined) { - return false; - } - items.push(item); - if (processItems) { - processItems(items); - } - return true; - } - function listIsTerminated(currentListType) { - return isExpectedListTerminator(currentListType) || currentToken().kind() === 8 /* EndOfFileToken */; - } - function parseSyntaxListWorker(currentListType, skippedTokens, processItems) { - var items = []; - while (true) { - var succeeded = tryParseExpectedListItem(currentListType, false, items, processItems); - if (!succeeded) { - if (listIsTerminated(currentListType)) { - break; - } - var abort = abortParsingListOrMoveToNextToken(currentListType, items, skippedTokens); - if (abort) { - break; - } - } - } - return TypeScript.Syntax.list(items); - } - function parseSeparatedSyntaxListWorker(currentListType, skippedTokens) { - var nodesAndSeparators = []; - var _separatorKind = currentListType === 9 /* ObjectType_TypeMembers */ ? 80 /* SemicolonToken */ : 81 /* CommaToken */; - var allowAutomaticSemicolonInsertion = _separatorKind === 80 /* SemicolonToken */; - var inErrorRecovery = false; - while (true) { - var succeeded = tryParseExpectedListItem(currentListType, inErrorRecovery, nodesAndSeparators, undefined); - if (!succeeded) { - if (listIsTerminated(currentListType)) { - break; - } - var abort = abortParsingListOrMoveToNextToken(currentListType, nodesAndSeparators, skippedTokens); - if (abort) { - break; - } - else { - inErrorRecovery = true; - continue; - } - } - inErrorRecovery = false; - var _currentToken = currentToken(); - var tokenKind = _currentToken.kind(); - if (tokenKind === _separatorKind || tokenKind === 81 /* CommaToken */) { - nodesAndSeparators.push(consumeToken(_currentToken)); - continue; - } - if (listIsTerminated(currentListType)) { - break; - } - if (allowAutomaticSemicolonInsertion && canEatAutomaticSemicolon(false)) { - var semicolonToken = eatExplicitOrAutomaticSemicolon(false) || TypeScript.Syntax.emptyToken(80 /* SemicolonToken */); - nodesAndSeparators.push(semicolonToken); - continue; - } - nodesAndSeparators.push(eatToken(_separatorKind)); - inErrorRecovery = true; - } - return TypeScript.Syntax.separatedList(nodesAndSeparators); - } - function reportUnexpectedTokenDiagnostic(listType) { - var token = currentToken(); - var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), TypeScript.start(token, source.text), TypeScript.width(token), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [getExpectedListElementType(listType)]); - addDiagnostic(diagnostic); - } - function addDiagnostic(diagnostic) { - if (diagnostics.length > 0 && diagnostics[diagnostics.length - 1].start() === diagnostic.start()) { - return; - } - diagnostics.push(diagnostic); - } - function isExpectedListTerminator(currentListType) { - switch (currentListType) { - case 0 /* SourceUnit_ModuleElements */: return isExpectedSourceUnit_ModuleElementsTerminator(); - case 1 /* ClassDeclaration_ClassElements */: return isExpectedClassDeclaration_ClassElementsTerminator(); - case 2 /* ModuleDeclaration_ModuleElements */: return isExpectedModuleDeclaration_ModuleElementsTerminator(); - case 3 /* SwitchStatement_SwitchClauses */: return isExpectedSwitchStatement_SwitchClausesTerminator(); - case 4 /* SwitchClause_Statements */: return isExpectedSwitchClause_StatementsTerminator(); - case 5 /* Block_Statements */: return isExpectedBlock_StatementsTerminator(); - case 6 /* TryBlock_Statements */: return isExpectedTryBlock_StatementsTerminator(); - case 7 /* CatchBlock_Statements */: return isExpectedCatchBlock_StatementsTerminator(); - case 8 /* EnumDeclaration_EnumElements */: return isExpectedEnumDeclaration_EnumElementsTerminator(); - case 9 /* ObjectType_TypeMembers */: return isExpectedObjectType_TypeMembersTerminator(); - case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: return isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator(); - case 11 /* HeritageClause_TypeNameList */: return isExpectedHeritageClause_TypeNameListTerminator(); - case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: return isExpectedVariableDeclaration_VariableDeclarators_AllowInTerminator(); - case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: return isExpectedVariableDeclaration_VariableDeclarators_DisallowInTerminator(); - case 14 /* ArgumentList_AssignmentExpressions */: return isExpectedArgumentList_AssignmentExpressionsTerminator(); - case 15 /* ObjectLiteralExpression_PropertyAssignments */: return isExpectedObjectLiteralExpression_PropertyAssignmentsTerminator(); - case 16 /* ArrayLiteralExpression_AssignmentExpressions */: return isExpectedLiteralExpression_AssignmentExpressionsTerminator(); - case 17 /* ParameterList_Parameters */: return isExpectedParameterList_ParametersTerminator(); - case 18 /* IndexSignature_Parameters */: return isExpectedIndexSignature_ParametersTerminator(); - case 19 /* TypeArgumentList_Types */: return isExpectedTypeArgumentList_TypesTerminator(); - case 20 /* TypeParameterList_TypeParameters */: return isExpectedTypeParameterList_TypeParametersTerminator(); - case 21 /* TupleType_Types */: return isExpectedTupleType_TypesTerminator(); - default: - throw TypeScript.Errors.invalidOperation(); - } - } - function isExpectedSourceUnit_ModuleElementsTerminator() { - return currentToken().kind() === 8 /* EndOfFileToken */; - } - function isExpectedEnumDeclaration_EnumElementsTerminator() { - return currentToken().kind() === 73 /* CloseBraceToken */; - } - function isExpectedModuleDeclaration_ModuleElementsTerminator() { - return currentToken().kind() === 73 /* CloseBraceToken */; - } - function isExpectedObjectType_TypeMembersTerminator() { - return currentToken().kind() === 73 /* CloseBraceToken */; - } - function isExpectedObjectLiteralExpression_PropertyAssignmentsTerminator() { - return currentToken().kind() === 73 /* CloseBraceToken */; - } - function isExpectedLiteralExpression_AssignmentExpressionsTerminator() { - return currentToken().kind() === 77 /* CloseBracketToken */; - } - function isExpectedTypeArgumentList_TypesTerminator() { - var token = currentToken(); - var tokenKind = token.kind(); - if (tokenKind === 83 /* GreaterThanToken */) { - return true; - } - if (canFollowTypeArgumentListInExpression(tokenKind)) { - return true; - } - return false; - } - function isExpectedTupleType_TypesTerminator() { - var token = currentToken(); - var tokenKind = token.kind(); - if (tokenKind === 77 /* CloseBracketToken */) { - return true; - } - return false; - } - function isExpectedTypeParameterList_TypeParametersTerminator() { - var tokenKind = currentToken().kind(); - if (tokenKind === 83 /* GreaterThanToken */) { - return true; - } - if (tokenKind === 74 /* OpenParenToken */ || tokenKind === 72 /* OpenBraceToken */ || tokenKind === 50 /* ExtendsKeyword */ || tokenKind === 53 /* ImplementsKeyword */) { - return true; - } - return false; - } - function isExpectedParameterList_ParametersTerminator() { - var tokenKind = currentToken().kind(); - if (tokenKind === 75 /* CloseParenToken */) { - return true; - } - if (tokenKind === 72 /* OpenBraceToken */) { - return true; - } - if (tokenKind === 87 /* EqualsGreaterThanToken */) { - return true; - } - return false; - } - function isExpectedIndexSignature_ParametersTerminator() { - var tokenKind = currentToken().kind(); - if (tokenKind === 77 /* CloseBracketToken */) { - return true; - } - if (tokenKind === 72 /* OpenBraceToken */) { - return true; - } - return false; - } - function isExpectedVariableDeclaration_VariableDeclarators_DisallowInTerminator() { - var tokenKind = currentToken().kind(); - if (tokenKind === 80 /* SemicolonToken */ || tokenKind === 75 /* CloseParenToken */) { - return true; - } - if (tokenKind === 31 /* InKeyword */) { - return true; - } - return false; - } - function isExpectedVariableDeclaration_VariableDeclarators_AllowInTerminator() { - if (currentToken().kind() === 87 /* EqualsGreaterThanToken */) { - return true; - } - return canEatExplicitOrAutomaticSemicolon(false); - } - function isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator() { - var tokenKind = currentToken().kind(); - if (tokenKind === 72 /* OpenBraceToken */ || tokenKind === 73 /* CloseBraceToken */) { - return true; - } - return false; - } - function isExpectedHeritageClause_TypeNameListTerminator() { - var tokenKind = currentToken().kind(); - if (tokenKind === 50 /* ExtendsKeyword */ || tokenKind === 53 /* ImplementsKeyword */) { - return true; - } - if (isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator()) { - return true; - } - return false; - } - function isExpectedArgumentList_AssignmentExpressionsTerminator() { - var token0 = currentToken(); - var tokenKind = token0.kind(); - return tokenKind === 75 /* CloseParenToken */ || tokenKind === 80 /* SemicolonToken */; - } - function isExpectedClassDeclaration_ClassElementsTerminator() { - return currentToken().kind() === 73 /* CloseBraceToken */; - } - function isExpectedSwitchStatement_SwitchClausesTerminator() { - return currentToken().kind() === 73 /* CloseBraceToken */; - } - function isExpectedSwitchClause_StatementsTerminator() { - return currentToken().kind() === 73 /* CloseBraceToken */ || isSwitchClause(); - } - function isExpectedBlock_StatementsTerminator() { - return currentToken().kind() === 73 /* CloseBraceToken */; - } - function isExpectedTryBlock_StatementsTerminator() { - var tokenKind = currentToken().kind(); - return tokenKind === 19 /* CatchKeyword */ || tokenKind === 27 /* FinallyKeyword */; - } - function isExpectedCatchBlock_StatementsTerminator() { - return currentToken().kind() === 27 /* FinallyKeyword */; - } - function isExpectedListItem(currentListType, inErrorRecovery) { - switch (currentListType) { - case 0 /* SourceUnit_ModuleElements */: return isModuleElement(inErrorRecovery); - case 1 /* ClassDeclaration_ClassElements */: return isClassElement(inErrorRecovery); - case 2 /* ModuleDeclaration_ModuleElements */: return isModuleElement(inErrorRecovery); - case 3 /* SwitchStatement_SwitchClauses */: return isSwitchClause(); - case 4 /* SwitchClause_Statements */: return isStatement(modifierCount(), inErrorRecovery); - case 5 /* Block_Statements */: return isStatement(modifierCount(), inErrorRecovery); - case 6 /* TryBlock_Statements */: return false; - case 7 /* CatchBlock_Statements */: return false; - case 8 /* EnumDeclaration_EnumElements */: return isEnumElement(inErrorRecovery); - case 9 /* ObjectType_TypeMembers */: return isTypeMember(inErrorRecovery); - case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: return isHeritageClause(); - case 11 /* HeritageClause_TypeNameList */: return isHeritageClauseTypeName(); - case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: return isVariableDeclarator(); - case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: return isVariableDeclarator(); - case 14 /* ArgumentList_AssignmentExpressions */: return isExpectedArgumentList_AssignmentExpression(); - case 15 /* ObjectLiteralExpression_PropertyAssignments */: return isPropertyAssignment(inErrorRecovery); - case 16 /* ArrayLiteralExpression_AssignmentExpressions */: return isAssignmentOrOmittedExpression(); - case 17 /* ParameterList_Parameters */: return isParameter(); - case 18 /* IndexSignature_Parameters */: return isParameter(); - case 19 /* TypeArgumentList_Types */: return isType(); - case 20 /* TypeParameterList_TypeParameters */: return isTypeParameter(); - case 21 /* TupleType_Types */: return isType(); - default: throw TypeScript.Errors.invalidOperation(); - } - } - function isExpectedArgumentList_AssignmentExpression() { - var _currentToken = currentToken(); - if (isExpression(_currentToken)) { - return true; - } - if (_currentToken.kind() === 81 /* CommaToken */) { - return true; - } - return false; - } - function tryParseExpectedListItemWorker(currentListType, inErrorRecovery) { - switch (currentListType) { - case 0 /* SourceUnit_ModuleElements */: return tryParseModuleElement(inErrorRecovery); - case 1 /* ClassDeclaration_ClassElements */: return tryParseClassElement(inErrorRecovery); - case 2 /* ModuleDeclaration_ModuleElements */: return tryParseModuleElement(inErrorRecovery); - case 3 /* SwitchStatement_SwitchClauses */: return tryParseSwitchClause(); - case 4 /* SwitchClause_Statements */: return tryParseStatement(inErrorRecovery); - case 5 /* Block_Statements */: return tryParseStatement(inErrorRecovery); - case 6 /* TryBlock_Statements */: return tryParseStatement(inErrorRecovery); - case 7 /* CatchBlock_Statements */: return tryParseStatement(inErrorRecovery); - case 8 /* EnumDeclaration_EnumElements */: return tryParseEnumElement(inErrorRecovery); - case 9 /* ObjectType_TypeMembers */: return tryParseTypeMember(inErrorRecovery); - case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: return tryParseHeritageClause(); - case 11 /* HeritageClause_TypeNameList */: return tryParseHeritageClauseTypeName(); - case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: return tryParseVariableDeclarator(true, false); - case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: return tryParseVariableDeclarator(false, false); - case 14 /* ArgumentList_AssignmentExpressions */: return tryParseArgumentListExpression(); - case 15 /* ObjectLiteralExpression_PropertyAssignments */: return tryParsePropertyAssignment(inErrorRecovery); - case 16 /* ArrayLiteralExpression_AssignmentExpressions */: return tryParseAssignmentOrOmittedExpression(); - case 17 /* ParameterList_Parameters */: return tryParseParameter(); - case 18 /* IndexSignature_Parameters */: return tryParseParameter(); - case 19 /* TypeArgumentList_Types */: return tryParseType(); - case 20 /* TypeParameterList_TypeParameters */: return tryParseTypeParameter(); - case 21 /* TupleType_Types */: return tryParseType(); - default: throw TypeScript.Errors.invalidOperation(); - } - } - function getExpectedListElementType(currentListType) { - switch (currentListType) { - case 0 /* SourceUnit_ModuleElements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, undefined); - case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: return '{'; - case 1 /* ClassDeclaration_ClassElements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.constructor_function_accessor_or_variable, undefined); - case 2 /* ModuleDeclaration_ModuleElements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, undefined); - case 3 /* SwitchStatement_SwitchClauses */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.case_or_default_clause, undefined); - case 4 /* SwitchClause_Statements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, undefined); - case 5 /* Block_Statements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, undefined); - case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, undefined); - case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, undefined); - case 8 /* EnumDeclaration_EnumElements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, undefined); - case 9 /* ObjectType_TypeMembers */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.call_construct_index_property_or_function_signature, undefined); - case 14 /* ArgumentList_AssignmentExpressions */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, undefined); - case 11 /* HeritageClause_TypeNameList */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_name, undefined); - case 15 /* ObjectLiteralExpression_PropertyAssignments */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.property_or_accessor, undefined); - case 17 /* ParameterList_Parameters */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.parameter, undefined); - case 18 /* IndexSignature_Parameters */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.parameter, undefined); - case 19 /* TypeArgumentList_Types */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, undefined); - case 20 /* TypeParameterList_TypeParameters */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, undefined); - case 21 /* TupleType_Types */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, undefined); - case 16 /* ArrayLiteralExpression_AssignmentExpressions */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, undefined); - default: throw TypeScript.Errors.invalidOperation(); - } - } - return parseSyntaxTree; - } - var BinaryExpressionPrecedence; - (function (BinaryExpressionPrecedence) { - BinaryExpressionPrecedence[BinaryExpressionPrecedence["Lowest"] = 1] = "Lowest"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["LogicalOrExpressionPrecedence"] = 2] = "LogicalOrExpressionPrecedence"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["LogicalAndExpressionPrecedence"] = 3] = "LogicalAndExpressionPrecedence"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["BitwiseOrExpressionPrecedence"] = 4] = "BitwiseOrExpressionPrecedence"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["BitwiseExclusiveOrExpressionPrecedence"] = 5] = "BitwiseExclusiveOrExpressionPrecedence"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["BitwiseAndExpressionPrecedence"] = 6] = "BitwiseAndExpressionPrecedence"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["EqualityExpressionPrecedence"] = 7] = "EqualityExpressionPrecedence"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["RelationalExpressionPrecedence"] = 8] = "RelationalExpressionPrecedence"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["ShiftExpressionPrecdence"] = 9] = "ShiftExpressionPrecdence"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["AdditiveExpressionPrecedence"] = 10] = "AdditiveExpressionPrecedence"; - BinaryExpressionPrecedence[BinaryExpressionPrecedence["MultiplicativeExpressionPrecedence"] = 11] = "MultiplicativeExpressionPrecedence"; - })(BinaryExpressionPrecedence || (BinaryExpressionPrecedence = {})); - var ListParsingState; - (function (ListParsingState) { - ListParsingState[ListParsingState["SourceUnit_ModuleElements"] = 0] = "SourceUnit_ModuleElements"; - ListParsingState[ListParsingState["ClassDeclaration_ClassElements"] = 1] = "ClassDeclaration_ClassElements"; - ListParsingState[ListParsingState["ModuleDeclaration_ModuleElements"] = 2] = "ModuleDeclaration_ModuleElements"; - ListParsingState[ListParsingState["SwitchStatement_SwitchClauses"] = 3] = "SwitchStatement_SwitchClauses"; - ListParsingState[ListParsingState["SwitchClause_Statements"] = 4] = "SwitchClause_Statements"; - ListParsingState[ListParsingState["Block_Statements"] = 5] = "Block_Statements"; - ListParsingState[ListParsingState["TryBlock_Statements"] = 6] = "TryBlock_Statements"; - ListParsingState[ListParsingState["CatchBlock_Statements"] = 7] = "CatchBlock_Statements"; - ListParsingState[ListParsingState["EnumDeclaration_EnumElements"] = 8] = "EnumDeclaration_EnumElements"; - ListParsingState[ListParsingState["ObjectType_TypeMembers"] = 9] = "ObjectType_TypeMembers"; - ListParsingState[ListParsingState["ClassOrInterfaceDeclaration_HeritageClauses"] = 10] = "ClassOrInterfaceDeclaration_HeritageClauses"; - ListParsingState[ListParsingState["HeritageClause_TypeNameList"] = 11] = "HeritageClause_TypeNameList"; - ListParsingState[ListParsingState["VariableDeclaration_VariableDeclarators_AllowIn"] = 12] = "VariableDeclaration_VariableDeclarators_AllowIn"; - ListParsingState[ListParsingState["VariableDeclaration_VariableDeclarators_DisallowIn"] = 13] = "VariableDeclaration_VariableDeclarators_DisallowIn"; - ListParsingState[ListParsingState["ArgumentList_AssignmentExpressions"] = 14] = "ArgumentList_AssignmentExpressions"; - ListParsingState[ListParsingState["ObjectLiteralExpression_PropertyAssignments"] = 15] = "ObjectLiteralExpression_PropertyAssignments"; - ListParsingState[ListParsingState["ArrayLiteralExpression_AssignmentExpressions"] = 16] = "ArrayLiteralExpression_AssignmentExpressions"; - ListParsingState[ListParsingState["ParameterList_Parameters"] = 17] = "ParameterList_Parameters"; - ListParsingState[ListParsingState["IndexSignature_Parameters"] = 18] = "IndexSignature_Parameters"; - ListParsingState[ListParsingState["TypeArgumentList_Types"] = 19] = "TypeArgumentList_Types"; - ListParsingState[ListParsingState["TypeParameterList_TypeParameters"] = 20] = "TypeParameterList_TypeParameters"; - ListParsingState[ListParsingState["TupleType_Types"] = 21] = "TupleType_Types"; - ListParsingState[ListParsingState["FirstListParsingState"] = ListParsingState.SourceUnit_ModuleElements] = "FirstListParsingState"; - ListParsingState[ListParsingState["LastListParsingState"] = ListParsingState.TupleType_Types] = "LastListParsingState"; - })(ListParsingState || (ListParsingState = {})); - var parseSyntaxTree = createParseSyntaxTree(); - function parse(fileName, text, languageVersion, isDeclaration) { - return parseSource(TypeScript.Scanner.createParserSource(fileName, text, languageVersion), isDeclaration); - } - Parser.parse = parse; - function parseSource(source, isDeclaration) { - return parseSyntaxTree(source, isDeclaration); - } - Parser.parseSource = parseSource; - })(Parser = TypeScript.Parser || (TypeScript.Parser = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.SourceUnitSyntax = function (data, moduleElements, endOfFileToken) { - if (data) { - this.__data = data; - } - this.moduleElements = moduleElements, this.endOfFileToken = endOfFileToken; - moduleElements.parent = this, endOfFileToken.parent = this; - }; - TypeScript.SourceUnitSyntax.prototype.kind = function () { - return 122 /* SourceUnit */; - }; - TypeScript.QualifiedNameSyntax = function (data, left, dotToken, right) { - if (data) { - this.__data = data; - } - this.left = left, this.dotToken = dotToken, this.right = right; - left.parent = this, dotToken.parent = this, right.parent = this; - }; - TypeScript.QualifiedNameSyntax.prototype.kind = function () { - return 123 /* QualifiedName */; - }; - TypeScript.ObjectTypeSyntax = function (data, openBraceToken, typeMembers, closeBraceToken) { - if (data) { - this.__data = data; - } - this.openBraceToken = openBraceToken, this.typeMembers = typeMembers, this.closeBraceToken = closeBraceToken; - openBraceToken.parent = this, typeMembers.parent = this, closeBraceToken.parent = this; - }; - TypeScript.ObjectTypeSyntax.prototype.kind = function () { - return 124 /* ObjectType */; - }; - TypeScript.FunctionTypeSyntax = function (data, typeParameterList, parameterList, equalsGreaterThanToken, type) { - if (data) { - this.__data = data; - } - this.typeParameterList = typeParameterList, this.parameterList = parameterList, this.equalsGreaterThanToken = equalsGreaterThanToken, this.type = type; - typeParameterList && (typeParameterList.parent = this), parameterList.parent = this, equalsGreaterThanToken.parent = this, type.parent = this; - }; - TypeScript.FunctionTypeSyntax.prototype.kind = function () { - return 125 /* FunctionType */; - }; - TypeScript.ArrayTypeSyntax = function (data, type, openBracketToken, closeBracketToken) { - if (data) { - this.__data = data; - } - this.type = type, this.openBracketToken = openBracketToken, this.closeBracketToken = closeBracketToken; - type.parent = this, openBracketToken.parent = this, closeBracketToken.parent = this; - }; - TypeScript.ArrayTypeSyntax.prototype.kind = function () { - return 126 /* ArrayType */; - }; - TypeScript.ConstructorTypeSyntax = function (data, newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type) { - if (data) { - this.__data = data; - } - this.newKeyword = newKeyword, this.typeParameterList = typeParameterList, this.parameterList = parameterList, this.equalsGreaterThanToken = equalsGreaterThanToken, this.type = type; - newKeyword.parent = this, typeParameterList && (typeParameterList.parent = this), parameterList.parent = this, equalsGreaterThanToken.parent = this, type.parent = this; - }; - TypeScript.ConstructorTypeSyntax.prototype.kind = function () { - return 127 /* ConstructorType */; - }; - TypeScript.GenericTypeSyntax = function (data, name, typeArgumentList) { - if (data) { - this.__data = data; - } - this.name = name, this.typeArgumentList = typeArgumentList; - name.parent = this, typeArgumentList.parent = this; - }; - TypeScript.GenericTypeSyntax.prototype.kind = function () { - return 128 /* GenericType */; - }; - TypeScript.TypeQuerySyntax = function (data, typeOfKeyword, name) { - if (data) { - this.__data = data; - } - this.typeOfKeyword = typeOfKeyword, this.name = name; - typeOfKeyword.parent = this, name.parent = this; - }; - TypeScript.TypeQuerySyntax.prototype.kind = function () { - return 129 /* TypeQuery */; - }; - TypeScript.TupleTypeSyntax = function (data, openBracketToken, types, closeBracketToken) { - if (data) { - this.__data = data; - } - this.openBracketToken = openBracketToken, this.types = types, this.closeBracketToken = closeBracketToken; - openBracketToken.parent = this, types.parent = this, closeBracketToken.parent = this; - }; - TypeScript.TupleTypeSyntax.prototype.kind = function () { - return 130 /* TupleType */; - }; - TypeScript.UnionTypeSyntax = function (data, left, barToken, right) { - if (data) { - this.__data = data; - } - this.left = left, this.barToken = barToken, this.right = right; - left.parent = this, barToken.parent = this, right.parent = this; - }; - TypeScript.UnionTypeSyntax.prototype.kind = function () { - return 131 /* UnionType */; - }; - TypeScript.ParenthesizedTypeSyntax = function (data, openParenToken, type, closeParenToken) { - if (data) { - this.__data = data; - } - this.openParenToken = openParenToken, this.type = type, this.closeParenToken = closeParenToken; - openParenToken.parent = this, type.parent = this, closeParenToken.parent = this; - }; - TypeScript.ParenthesizedTypeSyntax.prototype.kind = function () { - return 132 /* ParenthesizedType */; - }; - TypeScript.InterfaceDeclarationSyntax = function (data, modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.interfaceKeyword = interfaceKeyword, this.identifier = identifier, this.typeParameterList = typeParameterList, this.heritageClauses = heritageClauses, this.body = body; - modifiers.parent = this, interfaceKeyword.parent = this, identifier.parent = this, typeParameterList && (typeParameterList.parent = this), heritageClauses.parent = this, body.parent = this; - }; - TypeScript.InterfaceDeclarationSyntax.prototype.kind = function () { - return 133 /* InterfaceDeclaration */; - }; - TypeScript.FunctionDeclarationSyntax = function (data, modifiers, functionKeyword, identifier, callSignature, block, semicolonToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.functionKeyword = functionKeyword, this.identifier = identifier, this.callSignature = callSignature, this.block = block, this.semicolonToken = semicolonToken; - modifiers.parent = this, functionKeyword.parent = this, identifier.parent = this, callSignature.parent = this, block && (block.parent = this), semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.FunctionDeclarationSyntax.prototype.kind = function () { - return 134 /* FunctionDeclaration */; - }; - TypeScript.ModuleDeclarationSyntax = function (data, modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.moduleKeyword = moduleKeyword, this.name = name, this.stringLiteral = stringLiteral, this.openBraceToken = openBraceToken, this.moduleElements = moduleElements, this.closeBraceToken = closeBraceToken; - modifiers.parent = this, moduleKeyword.parent = this, name && (name.parent = this), stringLiteral && (stringLiteral.parent = this), openBraceToken.parent = this, moduleElements.parent = this, closeBraceToken.parent = this; - }; - TypeScript.ModuleDeclarationSyntax.prototype.kind = function () { - return 135 /* ModuleDeclaration */; - }; - TypeScript.ClassDeclarationSyntax = function (data, modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.classKeyword = classKeyword, this.identifier = identifier, this.typeParameterList = typeParameterList, this.heritageClauses = heritageClauses, this.openBraceToken = openBraceToken, this.classElements = classElements, this.closeBraceToken = closeBraceToken; - modifiers.parent = this, classKeyword.parent = this, identifier.parent = this, typeParameterList && (typeParameterList.parent = this), heritageClauses.parent = this, openBraceToken.parent = this, classElements.parent = this, closeBraceToken.parent = this; - }; - TypeScript.ClassDeclarationSyntax.prototype.kind = function () { - return 136 /* ClassDeclaration */; - }; - TypeScript.EnumDeclarationSyntax = function (data, modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.enumKeyword = enumKeyword, this.identifier = identifier, this.openBraceToken = openBraceToken, this.enumElements = enumElements, this.closeBraceToken = closeBraceToken; - modifiers.parent = this, enumKeyword.parent = this, identifier.parent = this, openBraceToken.parent = this, enumElements.parent = this, closeBraceToken.parent = this; - }; - TypeScript.EnumDeclarationSyntax.prototype.kind = function () { - return 137 /* EnumDeclaration */; - }; - TypeScript.ImportDeclarationSyntax = function (data, modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.importKeyword = importKeyword, this.identifier = identifier, this.equalsToken = equalsToken, this.moduleReference = moduleReference, this.semicolonToken = semicolonToken; - modifiers.parent = this, importKeyword.parent = this, identifier.parent = this, equalsToken.parent = this, moduleReference.parent = this, semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.ImportDeclarationSyntax.prototype.kind = function () { - return 138 /* ImportDeclaration */; - }; - TypeScript.ExportAssignmentSyntax = function (data, exportKeyword, equalsToken, identifier, semicolonToken) { - if (data) { - this.__data = data; - } - this.exportKeyword = exportKeyword, this.equalsToken = equalsToken, this.identifier = identifier, this.semicolonToken = semicolonToken; - exportKeyword.parent = this, equalsToken.parent = this, identifier.parent = this, semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.ExportAssignmentSyntax.prototype.kind = function () { - return 139 /* ExportAssignment */; - }; - TypeScript.MemberFunctionDeclarationSyntax = function (data, modifiers, propertyName, callSignature, block, semicolonToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.propertyName = propertyName, this.callSignature = callSignature, this.block = block, this.semicolonToken = semicolonToken; - modifiers.parent = this, propertyName.parent = this, callSignature.parent = this, block && (block.parent = this), semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.MemberFunctionDeclarationSyntax.prototype.kind = function () { - return 140 /* MemberFunctionDeclaration */; - }; - TypeScript.MemberVariableDeclarationSyntax = function (data, modifiers, variableDeclarator, semicolonToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.variableDeclarator = variableDeclarator, this.semicolonToken = semicolonToken; - modifiers.parent = this, variableDeclarator.parent = this, semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.MemberVariableDeclarationSyntax.prototype.kind = function () { - return 141 /* MemberVariableDeclaration */; - }; - TypeScript.ConstructorDeclarationSyntax = function (data, modifiers, constructorKeyword, callSignature, block, semicolonToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.constructorKeyword = constructorKeyword, this.callSignature = callSignature, this.block = block, this.semicolonToken = semicolonToken; - modifiers.parent = this, constructorKeyword.parent = this, callSignature.parent = this, block && (block.parent = this), semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.ConstructorDeclarationSyntax.prototype.kind = function () { - return 142 /* ConstructorDeclaration */; - }; - TypeScript.IndexMemberDeclarationSyntax = function (data, modifiers, indexSignature, semicolonToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.indexSignature = indexSignature, this.semicolonToken = semicolonToken; - modifiers.parent = this, indexSignature.parent = this, semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.IndexMemberDeclarationSyntax.prototype.kind = function () { - return 143 /* IndexMemberDeclaration */; - }; - TypeScript.GetAccessorSyntax = function (data, modifiers, getKeyword, propertyName, callSignature, block) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.getKeyword = getKeyword, this.propertyName = propertyName, this.callSignature = callSignature, this.block = block; - modifiers.parent = this, getKeyword.parent = this, propertyName.parent = this, callSignature.parent = this, block.parent = this; - }; - TypeScript.GetAccessorSyntax.prototype.kind = function () { - return 144 /* GetAccessor */; - }; - TypeScript.SetAccessorSyntax = function (data, modifiers, setKeyword, propertyName, callSignature, block) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.setKeyword = setKeyword, this.propertyName = propertyName, this.callSignature = callSignature, this.block = block; - modifiers.parent = this, setKeyword.parent = this, propertyName.parent = this, callSignature.parent = this, block.parent = this; - }; - TypeScript.SetAccessorSyntax.prototype.kind = function () { - return 145 /* SetAccessor */; - }; - TypeScript.PropertySignatureSyntax = function (data, propertyName, questionToken, typeAnnotation) { - if (data) { - this.__data = data; - } - this.propertyName = propertyName, this.questionToken = questionToken, this.typeAnnotation = typeAnnotation; - propertyName.parent = this, questionToken && (questionToken.parent = this), typeAnnotation && (typeAnnotation.parent = this); - }; - TypeScript.PropertySignatureSyntax.prototype.kind = function () { - return 146 /* PropertySignature */; - }; - TypeScript.CallSignatureSyntax = function (data, typeParameterList, parameterList, typeAnnotation) { - if (data) { - this.__data = data; - } - this.typeParameterList = typeParameterList, this.parameterList = parameterList, this.typeAnnotation = typeAnnotation; - typeParameterList && (typeParameterList.parent = this), parameterList.parent = this, typeAnnotation && (typeAnnotation.parent = this); - }; - TypeScript.CallSignatureSyntax.prototype.kind = function () { - return 147 /* CallSignature */; - }; - TypeScript.ConstructSignatureSyntax = function (data, newKeyword, callSignature) { - if (data) { - this.__data = data; - } - this.newKeyword = newKeyword, this.callSignature = callSignature; - newKeyword.parent = this, callSignature.parent = this; - }; - TypeScript.ConstructSignatureSyntax.prototype.kind = function () { - return 148 /* ConstructSignature */; - }; - TypeScript.IndexSignatureSyntax = function (data, openBracketToken, parameters, closeBracketToken, typeAnnotation) { - if (data) { - this.__data = data; - } - this.openBracketToken = openBracketToken, this.parameters = parameters, this.closeBracketToken = closeBracketToken, this.typeAnnotation = typeAnnotation; - openBracketToken.parent = this, parameters.parent = this, closeBracketToken.parent = this, typeAnnotation && (typeAnnotation.parent = this); - }; - TypeScript.IndexSignatureSyntax.prototype.kind = function () { - return 149 /* IndexSignature */; - }; - TypeScript.MethodSignatureSyntax = function (data, propertyName, questionToken, callSignature) { - if (data) { - this.__data = data; - } - this.propertyName = propertyName, this.questionToken = questionToken, this.callSignature = callSignature; - propertyName.parent = this, questionToken && (questionToken.parent = this), callSignature.parent = this; - }; - TypeScript.MethodSignatureSyntax.prototype.kind = function () { - return 150 /* MethodSignature */; - }; - TypeScript.BlockSyntax = function (data, openBraceToken, statements, closeBraceToken) { - if (data) { - this.__data = data; - } - this.openBraceToken = openBraceToken, this.statements = statements, this.closeBraceToken = closeBraceToken; - openBraceToken.parent = this, statements.parent = this, closeBraceToken.parent = this; - }; - TypeScript.BlockSyntax.prototype.kind = function () { - return 151 /* Block */; - }; - TypeScript.IfStatementSyntax = function (data, ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause) { - if (data) { - this.__data = data; - } - this.ifKeyword = ifKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.statement = statement, this.elseClause = elseClause; - ifKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, statement.parent = this, elseClause && (elseClause.parent = this); - }; - TypeScript.IfStatementSyntax.prototype.kind = function () { - return 152 /* IfStatement */; - }; - TypeScript.VariableStatementSyntax = function (data, modifiers, variableDeclaration, semicolonToken) { - if (data) { - this.__data = data; - } - this.modifiers = modifiers, this.variableDeclaration = variableDeclaration, this.semicolonToken = semicolonToken; - modifiers.parent = this, variableDeclaration.parent = this, semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.VariableStatementSyntax.prototype.kind = function () { - return 153 /* VariableStatement */; - }; - TypeScript.ExpressionStatementSyntax = function (data, expression, semicolonToken) { - if (data) { - this.__data = data; - } - this.expression = expression, this.semicolonToken = semicolonToken; - expression.parent = this, semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.ExpressionStatementSyntax.prototype.kind = function () { - return 154 /* ExpressionStatement */; - }; - TypeScript.ReturnStatementSyntax = function (data, returnKeyword, expression, semicolonToken) { - if (data) { - this.__data = data; - } - this.returnKeyword = returnKeyword, this.expression = expression, this.semicolonToken = semicolonToken; - returnKeyword.parent = this, expression && (expression.parent = this), semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.ReturnStatementSyntax.prototype.kind = function () { - return 155 /* ReturnStatement */; - }; - TypeScript.SwitchStatementSyntax = function (data, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken) { - if (data) { - this.__data = data; - } - this.switchKeyword = switchKeyword, this.openParenToken = openParenToken, this.expression = expression, this.closeParenToken = closeParenToken, this.openBraceToken = openBraceToken, this.switchClauses = switchClauses, this.closeBraceToken = closeBraceToken; - switchKeyword.parent = this, openParenToken.parent = this, expression.parent = this, closeParenToken.parent = this, openBraceToken.parent = this, switchClauses.parent = this, closeBraceToken.parent = this; - }; - TypeScript.SwitchStatementSyntax.prototype.kind = function () { - return 156 /* SwitchStatement */; - }; - TypeScript.BreakStatementSyntax = function (data, breakKeyword, identifier, semicolonToken) { - if (data) { - this.__data = data; - } - this.breakKeyword = breakKeyword, this.identifier = identifier, this.semicolonToken = semicolonToken; - breakKeyword.parent = this, identifier && (identifier.parent = this), semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.BreakStatementSyntax.prototype.kind = function () { - return 157 /* BreakStatement */; - }; - TypeScript.ContinueStatementSyntax = function (data, continueKeyword, identifier, semicolonToken) { - if (data) { - this.__data = data; - } - this.continueKeyword = continueKeyword, this.identifier = identifier, this.semicolonToken = semicolonToken; - continueKeyword.parent = this, identifier && (identifier.parent = this), semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.ContinueStatementSyntax.prototype.kind = function () { - return 158 /* ContinueStatement */; - }; - TypeScript.ForStatementSyntax = function (data, forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement) { - if (data) { - this.__data = data; - } - this.forKeyword = forKeyword, this.openParenToken = openParenToken, this.variableDeclaration = variableDeclaration, this.initializer = initializer, this.firstSemicolonToken = firstSemicolonToken, this.condition = condition, this.secondSemicolonToken = secondSemicolonToken, this.incrementor = incrementor, this.closeParenToken = closeParenToken, this.statement = statement; - forKeyword.parent = this, openParenToken.parent = this, variableDeclaration && (variableDeclaration.parent = this), initializer && (initializer.parent = this), firstSemicolonToken.parent = this, condition && (condition.parent = this), secondSemicolonToken.parent = this, incrementor && (incrementor.parent = this), closeParenToken.parent = this, statement.parent = this; - }; - TypeScript.ForStatementSyntax.prototype.kind = function () { - return 159 /* ForStatement */; - }; - TypeScript.ForInStatementSyntax = function (data, forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement) { - if (data) { - this.__data = data; - } - this.forKeyword = forKeyword, this.openParenToken = openParenToken, this.variableDeclaration = variableDeclaration, this.left = left, this.inKeyword = inKeyword, this.expression = expression, this.closeParenToken = closeParenToken, this.statement = statement; - forKeyword.parent = this, openParenToken.parent = this, variableDeclaration && (variableDeclaration.parent = this), left && (left.parent = this), inKeyword.parent = this, expression.parent = this, closeParenToken.parent = this, statement.parent = this; - }; - TypeScript.ForInStatementSyntax.prototype.kind = function () { - return 160 /* ForInStatement */; - }; - TypeScript.EmptyStatementSyntax = function (data, semicolonToken) { - if (data) { - this.__data = data; - } - this.semicolonToken = semicolonToken; - semicolonToken.parent = this; - }; - TypeScript.EmptyStatementSyntax.prototype.kind = function () { - return 161 /* EmptyStatement */; - }; - TypeScript.ThrowStatementSyntax = function (data, throwKeyword, expression, semicolonToken) { - if (data) { - this.__data = data; - } - this.throwKeyword = throwKeyword, this.expression = expression, this.semicolonToken = semicolonToken; - throwKeyword.parent = this, expression.parent = this, semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.ThrowStatementSyntax.prototype.kind = function () { - return 162 /* ThrowStatement */; - }; - TypeScript.WhileStatementSyntax = function (data, whileKeyword, openParenToken, condition, closeParenToken, statement) { - if (data) { - this.__data = data; - } - this.whileKeyword = whileKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.statement = statement; - whileKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, statement.parent = this; - }; - TypeScript.WhileStatementSyntax.prototype.kind = function () { - return 163 /* WhileStatement */; - }; - TypeScript.TryStatementSyntax = function (data, tryKeyword, block, catchClause, finallyClause) { - if (data) { - this.__data = data; - } - this.tryKeyword = tryKeyword, this.block = block, this.catchClause = catchClause, this.finallyClause = finallyClause; - tryKeyword.parent = this, block.parent = this, catchClause && (catchClause.parent = this), finallyClause && (finallyClause.parent = this); - }; - TypeScript.TryStatementSyntax.prototype.kind = function () { - return 164 /* TryStatement */; - }; - TypeScript.LabeledStatementSyntax = function (data, identifier, colonToken, statement) { - if (data) { - this.__data = data; - } - this.identifier = identifier, this.colonToken = colonToken, this.statement = statement; - identifier.parent = this, colonToken.parent = this, statement.parent = this; - }; - TypeScript.LabeledStatementSyntax.prototype.kind = function () { - return 165 /* LabeledStatement */; - }; - TypeScript.DoStatementSyntax = function (data, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken) { - if (data) { - this.__data = data; - } - this.doKeyword = doKeyword, this.statement = statement, this.whileKeyword = whileKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.semicolonToken = semicolonToken; - doKeyword.parent = this, statement.parent = this, whileKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.DoStatementSyntax.prototype.kind = function () { - return 166 /* DoStatement */; - }; - TypeScript.DebuggerStatementSyntax = function (data, debuggerKeyword, semicolonToken) { - if (data) { - this.__data = data; - } - this.debuggerKeyword = debuggerKeyword, this.semicolonToken = semicolonToken; - debuggerKeyword.parent = this, semicolonToken && (semicolonToken.parent = this); - }; - TypeScript.DebuggerStatementSyntax.prototype.kind = function () { - return 167 /* DebuggerStatement */; - }; - TypeScript.WithStatementSyntax = function (data, withKeyword, openParenToken, condition, closeParenToken, statement) { - if (data) { - this.__data = data; - } - this.withKeyword = withKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.statement = statement; - withKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, statement.parent = this; - }; - TypeScript.WithStatementSyntax.prototype.kind = function () { - return 168 /* WithStatement */; - }; - TypeScript.PrefixUnaryExpressionSyntax = function (data, operatorToken, operand) { - if (data) { - this.__data = data; - } - this.operatorToken = operatorToken, this.operand = operand; - operatorToken.parent = this, operand.parent = this; - }; - TypeScript.PrefixUnaryExpressionSyntax.prototype.kind = function () { - return 169 /* PrefixUnaryExpression */; - }; - TypeScript.DeleteExpressionSyntax = function (data, deleteKeyword, expression) { - if (data) { - this.__data = data; - } - this.deleteKeyword = deleteKeyword, this.expression = expression; - deleteKeyword.parent = this, expression.parent = this; - }; - TypeScript.DeleteExpressionSyntax.prototype.kind = function () { - return 170 /* DeleteExpression */; - }; - TypeScript.TypeOfExpressionSyntax = function (data, typeOfKeyword, expression) { - if (data) { - this.__data = data; - } - this.typeOfKeyword = typeOfKeyword, this.expression = expression; - typeOfKeyword.parent = this, expression.parent = this; - }; - TypeScript.TypeOfExpressionSyntax.prototype.kind = function () { - return 171 /* TypeOfExpression */; - }; - TypeScript.VoidExpressionSyntax = function (data, voidKeyword, expression) { - if (data) { - this.__data = data; - } - this.voidKeyword = voidKeyword, this.expression = expression; - voidKeyword.parent = this, expression.parent = this; - }; - TypeScript.VoidExpressionSyntax.prototype.kind = function () { - return 172 /* VoidExpression */; - }; - TypeScript.ConditionalExpressionSyntax = function (data, condition, questionToken, whenTrue, colonToken, whenFalse) { - if (data) { - this.__data = data; - } - this.condition = condition, this.questionToken = questionToken, this.whenTrue = whenTrue, this.colonToken = colonToken, this.whenFalse = whenFalse; - condition.parent = this, questionToken.parent = this, whenTrue.parent = this, colonToken.parent = this, whenFalse.parent = this; - }; - TypeScript.ConditionalExpressionSyntax.prototype.kind = function () { - return 173 /* ConditionalExpression */; - }; - TypeScript.BinaryExpressionSyntax = function (data, left, operatorToken, right) { - if (data) { - this.__data = data; - } - this.left = left, this.operatorToken = operatorToken, this.right = right; - left.parent = this, operatorToken.parent = this, right.parent = this; - }; - TypeScript.BinaryExpressionSyntax.prototype.kind = function () { - return 174 /* BinaryExpression */; - }; - TypeScript.PostfixUnaryExpressionSyntax = function (data, operand, operatorToken) { - if (data) { - this.__data = data; - } - this.operand = operand, this.operatorToken = operatorToken; - operand.parent = this, operatorToken.parent = this; - }; - TypeScript.PostfixUnaryExpressionSyntax.prototype.kind = function () { - return 175 /* PostfixUnaryExpression */; - }; - TypeScript.MemberAccessExpressionSyntax = function (data, expression, dotToken, name) { - if (data) { - this.__data = data; - } - this.expression = expression, this.dotToken = dotToken, this.name = name; - expression.parent = this, dotToken.parent = this, name.parent = this; - }; - TypeScript.MemberAccessExpressionSyntax.prototype.kind = function () { - return 176 /* MemberAccessExpression */; - }; - TypeScript.InvocationExpressionSyntax = function (data, expression, argumentList) { - if (data) { - this.__data = data; - } - this.expression = expression, this.argumentList = argumentList; - expression.parent = this, argumentList.parent = this; - }; - TypeScript.InvocationExpressionSyntax.prototype.kind = function () { - return 177 /* InvocationExpression */; - }; - TypeScript.ArrayLiteralExpressionSyntax = function (data, openBracketToken, expressions, closeBracketToken) { - if (data) { - this.__data = data; - } - this.openBracketToken = openBracketToken, this.expressions = expressions, this.closeBracketToken = closeBracketToken; - openBracketToken.parent = this, expressions.parent = this, closeBracketToken.parent = this; - }; - TypeScript.ArrayLiteralExpressionSyntax.prototype.kind = function () { - return 178 /* ArrayLiteralExpression */; - }; - TypeScript.ObjectLiteralExpressionSyntax = function (data, openBraceToken, propertyAssignments, closeBraceToken) { - if (data) { - this.__data = data; - } - this.openBraceToken = openBraceToken, this.propertyAssignments = propertyAssignments, this.closeBraceToken = closeBraceToken; - openBraceToken.parent = this, propertyAssignments.parent = this, closeBraceToken.parent = this; - }; - TypeScript.ObjectLiteralExpressionSyntax.prototype.kind = function () { - return 179 /* ObjectLiteralExpression */; - }; - TypeScript.ObjectCreationExpressionSyntax = function (data, newKeyword, expression, argumentList) { - if (data) { - this.__data = data; - } - this.newKeyword = newKeyword, this.expression = expression, this.argumentList = argumentList; - newKeyword.parent = this, expression.parent = this, argumentList && (argumentList.parent = this); - }; - TypeScript.ObjectCreationExpressionSyntax.prototype.kind = function () { - return 180 /* ObjectCreationExpression */; - }; - TypeScript.ParenthesizedExpressionSyntax = function (data, openParenToken, expression, closeParenToken) { - if (data) { - this.__data = data; - } - this.openParenToken = openParenToken, this.expression = expression, this.closeParenToken = closeParenToken; - openParenToken.parent = this, expression.parent = this, closeParenToken.parent = this; - }; - TypeScript.ParenthesizedExpressionSyntax.prototype.kind = function () { - return 181 /* ParenthesizedExpression */; - }; - TypeScript.ParenthesizedArrowFunctionExpressionSyntax = function (data, callSignature, equalsGreaterThanToken, block, expression) { - if (data) { - this.__data = data; - } - this.callSignature = callSignature, this.equalsGreaterThanToken = equalsGreaterThanToken, this.block = block, this.expression = expression; - callSignature.parent = this, equalsGreaterThanToken.parent = this, block && (block.parent = this), expression && (expression.parent = this); - }; - TypeScript.ParenthesizedArrowFunctionExpressionSyntax.prototype.kind = function () { - return 182 /* ParenthesizedArrowFunctionExpression */; - }; - TypeScript.SimpleArrowFunctionExpressionSyntax = function (data, parameter, equalsGreaterThanToken, block, expression) { - if (data) { - this.__data = data; - } - this.parameter = parameter, this.equalsGreaterThanToken = equalsGreaterThanToken, this.block = block, this.expression = expression; - parameter.parent = this, equalsGreaterThanToken.parent = this, block && (block.parent = this), expression && (expression.parent = this); - }; - TypeScript.SimpleArrowFunctionExpressionSyntax.prototype.kind = function () { - return 183 /* SimpleArrowFunctionExpression */; - }; - TypeScript.CastExpressionSyntax = function (data, lessThanToken, type, greaterThanToken, expression) { - if (data) { - this.__data = data; - } - this.lessThanToken = lessThanToken, this.type = type, this.greaterThanToken = greaterThanToken, this.expression = expression; - lessThanToken.parent = this, type.parent = this, greaterThanToken.parent = this, expression.parent = this; - }; - TypeScript.CastExpressionSyntax.prototype.kind = function () { - return 184 /* CastExpression */; - }; - TypeScript.ElementAccessExpressionSyntax = function (data, expression, openBracketToken, argumentExpression, closeBracketToken) { - if (data) { - this.__data = data; - } - this.expression = expression, this.openBracketToken = openBracketToken, this.argumentExpression = argumentExpression, this.closeBracketToken = closeBracketToken; - expression.parent = this, openBracketToken.parent = this, argumentExpression.parent = this, closeBracketToken.parent = this; - }; - TypeScript.ElementAccessExpressionSyntax.prototype.kind = function () { - return 185 /* ElementAccessExpression */; - }; - TypeScript.FunctionExpressionSyntax = function (data, functionKeyword, identifier, callSignature, block) { - if (data) { - this.__data = data; - } - this.functionKeyword = functionKeyword, this.identifier = identifier, this.callSignature = callSignature, this.block = block; - functionKeyword.parent = this, identifier && (identifier.parent = this), callSignature.parent = this, block.parent = this; - }; - TypeScript.FunctionExpressionSyntax.prototype.kind = function () { - return 186 /* FunctionExpression */; - }; - TypeScript.OmittedExpressionSyntax = function (data) { - if (data) { - this.__data = data; - } - }; - TypeScript.OmittedExpressionSyntax.prototype.kind = function () { - return 187 /* OmittedExpression */; - }; - TypeScript.TemplateExpressionSyntax = function (data, templateStartToken, templateClauses) { - if (data) { - this.__data = data; - } - this.templateStartToken = templateStartToken, this.templateClauses = templateClauses; - templateStartToken.parent = this, templateClauses.parent = this; - }; - TypeScript.TemplateExpressionSyntax.prototype.kind = function () { - return 188 /* TemplateExpression */; - }; - TypeScript.TemplateAccessExpressionSyntax = function (data, expression, templateExpression) { - if (data) { - this.__data = data; - } - this.expression = expression, this.templateExpression = templateExpression; - expression.parent = this, templateExpression.parent = this; - }; - TypeScript.TemplateAccessExpressionSyntax.prototype.kind = function () { - return 189 /* TemplateAccessExpression */; - }; - TypeScript.VariableDeclarationSyntax = function (data, varKeyword, variableDeclarators) { - if (data) { - this.__data = data; - } - this.varKeyword = varKeyword, this.variableDeclarators = variableDeclarators; - varKeyword.parent = this, variableDeclarators.parent = this; - }; - TypeScript.VariableDeclarationSyntax.prototype.kind = function () { - return 190 /* VariableDeclaration */; - }; - TypeScript.VariableDeclaratorSyntax = function (data, propertyName, typeAnnotation, equalsValueClause) { - if (data) { - this.__data = data; - } - this.propertyName = propertyName, this.typeAnnotation = typeAnnotation, this.equalsValueClause = equalsValueClause; - propertyName.parent = this, typeAnnotation && (typeAnnotation.parent = this), equalsValueClause && (equalsValueClause.parent = this); - }; - TypeScript.VariableDeclaratorSyntax.prototype.kind = function () { - return 191 /* VariableDeclarator */; - }; - TypeScript.ArgumentListSyntax = function (data, typeArgumentList, openParenToken, _arguments, closeParenToken) { - if (data) { - this.__data = data; - } - this.typeArgumentList = typeArgumentList, this.openParenToken = openParenToken, this.arguments = _arguments, this.closeParenToken = closeParenToken; - typeArgumentList && (typeArgumentList.parent = this), openParenToken.parent = this, _arguments.parent = this, closeParenToken.parent = this; - }; - TypeScript.ArgumentListSyntax.prototype.kind = function () { - return 192 /* ArgumentList */; - }; - TypeScript.ParameterListSyntax = function (data, openParenToken, parameters, closeParenToken) { - if (data) { - this.__data = data; - } - this.openParenToken = openParenToken, this.parameters = parameters, this.closeParenToken = closeParenToken; - openParenToken.parent = this, parameters.parent = this, closeParenToken.parent = this; - }; - TypeScript.ParameterListSyntax.prototype.kind = function () { - return 193 /* ParameterList */; - }; - TypeScript.TypeArgumentListSyntax = function (data, lessThanToken, typeArguments, greaterThanToken) { - if (data) { - this.__data = data; - } - this.lessThanToken = lessThanToken, this.typeArguments = typeArguments, this.greaterThanToken = greaterThanToken; - lessThanToken.parent = this, typeArguments.parent = this, greaterThanToken.parent = this; - }; - TypeScript.TypeArgumentListSyntax.prototype.kind = function () { - return 194 /* TypeArgumentList */; - }; - TypeScript.TypeParameterListSyntax = function (data, lessThanToken, typeParameters, greaterThanToken) { - if (data) { - this.__data = data; - } - this.lessThanToken = lessThanToken, this.typeParameters = typeParameters, this.greaterThanToken = greaterThanToken; - lessThanToken.parent = this, typeParameters.parent = this, greaterThanToken.parent = this; - }; - TypeScript.TypeParameterListSyntax.prototype.kind = function () { - return 195 /* TypeParameterList */; - }; - TypeScript.HeritageClauseSyntax = function (data, extendsOrImplementsKeyword, typeNames) { - if (data) { - this.__data = data; - } - this.extendsOrImplementsKeyword = extendsOrImplementsKeyword, this.typeNames = typeNames; - extendsOrImplementsKeyword.parent = this, typeNames.parent = this; - }; - TypeScript.HeritageClauseSyntax.prototype.kind = function () { - return 196 /* HeritageClause */; - }; - TypeScript.EqualsValueClauseSyntax = function (data, equalsToken, value) { - if (data) { - this.__data = data; - } - this.equalsToken = equalsToken, this.value = value; - equalsToken.parent = this, value.parent = this; - }; - TypeScript.EqualsValueClauseSyntax.prototype.kind = function () { - return 197 /* EqualsValueClause */; - }; - TypeScript.CaseSwitchClauseSyntax = function (data, caseKeyword, expression, colonToken, statements) { - if (data) { - this.__data = data; - } - this.caseKeyword = caseKeyword, this.expression = expression, this.colonToken = colonToken, this.statements = statements; - caseKeyword.parent = this, expression.parent = this, colonToken.parent = this, statements.parent = this; - }; - TypeScript.CaseSwitchClauseSyntax.prototype.kind = function () { - return 198 /* CaseSwitchClause */; - }; - TypeScript.DefaultSwitchClauseSyntax = function (data, defaultKeyword, colonToken, statements) { - if (data) { - this.__data = data; - } - this.defaultKeyword = defaultKeyword, this.colonToken = colonToken, this.statements = statements; - defaultKeyword.parent = this, colonToken.parent = this, statements.parent = this; - }; - TypeScript.DefaultSwitchClauseSyntax.prototype.kind = function () { - return 199 /* DefaultSwitchClause */; - }; - TypeScript.ElseClauseSyntax = function (data, elseKeyword, statement) { - if (data) { - this.__data = data; - } - this.elseKeyword = elseKeyword, this.statement = statement; - elseKeyword.parent = this, statement.parent = this; - }; - TypeScript.ElseClauseSyntax.prototype.kind = function () { - return 200 /* ElseClause */; - }; - TypeScript.CatchClauseSyntax = function (data, catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block) { - if (data) { - this.__data = data; - } - this.catchKeyword = catchKeyword, this.openParenToken = openParenToken, this.identifier = identifier, this.typeAnnotation = typeAnnotation, this.closeParenToken = closeParenToken, this.block = block; - catchKeyword.parent = this, openParenToken.parent = this, identifier.parent = this, typeAnnotation && (typeAnnotation.parent = this), closeParenToken.parent = this, block.parent = this; - }; - TypeScript.CatchClauseSyntax.prototype.kind = function () { - return 201 /* CatchClause */; - }; - TypeScript.FinallyClauseSyntax = function (data, finallyKeyword, block) { - if (data) { - this.__data = data; - } - this.finallyKeyword = finallyKeyword, this.block = block; - finallyKeyword.parent = this, block.parent = this; - }; - TypeScript.FinallyClauseSyntax.prototype.kind = function () { - return 202 /* FinallyClause */; - }; - TypeScript.TemplateClauseSyntax = function (data, expression, templateMiddleOrEndToken) { - if (data) { - this.__data = data; - } - this.expression = expression, this.templateMiddleOrEndToken = templateMiddleOrEndToken; - expression.parent = this, templateMiddleOrEndToken.parent = this; - }; - TypeScript.TemplateClauseSyntax.prototype.kind = function () { - return 203 /* TemplateClause */; - }; - TypeScript.TypeParameterSyntax = function (data, identifier, constraint) { - if (data) { - this.__data = data; - } - this.identifier = identifier, this.constraint = constraint; - identifier.parent = this, constraint && (constraint.parent = this); - }; - TypeScript.TypeParameterSyntax.prototype.kind = function () { - return 204 /* TypeParameter */; - }; - TypeScript.ConstraintSyntax = function (data, extendsKeyword, typeOrExpression) { - if (data) { - this.__data = data; - } - this.extendsKeyword = extendsKeyword, this.typeOrExpression = typeOrExpression; - extendsKeyword.parent = this, typeOrExpression.parent = this; - }; - TypeScript.ConstraintSyntax.prototype.kind = function () { - return 205 /* Constraint */; - }; - TypeScript.SimplePropertyAssignmentSyntax = function (data, propertyName, colonToken, expression) { - if (data) { - this.__data = data; - } - this.propertyName = propertyName, this.colonToken = colonToken, this.expression = expression; - propertyName.parent = this, colonToken.parent = this, expression.parent = this; - }; - TypeScript.SimplePropertyAssignmentSyntax.prototype.kind = function () { - return 206 /* SimplePropertyAssignment */; - }; - TypeScript.FunctionPropertyAssignmentSyntax = function (data, propertyName, callSignature, block) { - if (data) { - this.__data = data; - } - this.propertyName = propertyName, this.callSignature = callSignature, this.block = block; - propertyName.parent = this, callSignature.parent = this, block.parent = this; - }; - TypeScript.FunctionPropertyAssignmentSyntax.prototype.kind = function () { - return 207 /* FunctionPropertyAssignment */; - }; - TypeScript.ParameterSyntax = function (data, dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - if (data) { - this.__data = data; - } - this.dotDotDotToken = dotDotDotToken, this.modifiers = modifiers, this.identifier = identifier, this.questionToken = questionToken, this.typeAnnotation = typeAnnotation, this.equalsValueClause = equalsValueClause; - dotDotDotToken && (dotDotDotToken.parent = this), modifiers.parent = this, identifier.parent = this, questionToken && (questionToken.parent = this), typeAnnotation && (typeAnnotation.parent = this), equalsValueClause && (equalsValueClause.parent = this); - }; - TypeScript.ParameterSyntax.prototype.kind = function () { - return 208 /* Parameter */; - }; - TypeScript.EnumElementSyntax = function (data, propertyName, equalsValueClause) { - if (data) { - this.__data = data; - } - this.propertyName = propertyName, this.equalsValueClause = equalsValueClause; - propertyName.parent = this, equalsValueClause && (equalsValueClause.parent = this); - }; - TypeScript.EnumElementSyntax.prototype.kind = function () { - return 209 /* EnumElement */; - }; - TypeScript.TypeAnnotationSyntax = function (data, colonToken, type) { - if (data) { - this.__data = data; - } - this.colonToken = colonToken, this.type = type; - colonToken.parent = this, type.parent = this; - }; - TypeScript.TypeAnnotationSyntax.prototype.kind = function () { - return 210 /* TypeAnnotation */; - }; - TypeScript.ExternalModuleReferenceSyntax = function (data, requireKeyword, openParenToken, stringLiteral, closeParenToken) { - if (data) { - this.__data = data; - } - this.requireKeyword = requireKeyword, this.openParenToken = openParenToken, this.stringLiteral = stringLiteral, this.closeParenToken = closeParenToken; - requireKeyword.parent = this, openParenToken.parent = this, stringLiteral.parent = this, closeParenToken.parent = this; - }; - TypeScript.ExternalModuleReferenceSyntax.prototype.kind = function () { - return 211 /* ExternalModuleReference */; - }; - TypeScript.ModuleNameModuleReferenceSyntax = function (data, moduleName) { - if (data) { - this.__data = data; - } - this.moduleName = moduleName; - moduleName.parent = this; - }; - TypeScript.ModuleNameModuleReferenceSyntax.prototype.kind = function () { - return 212 /* ModuleNameModuleReference */; - }; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.syntaxDiagnosticsTime = 0; - var SyntaxTree = (function () { - function SyntaxTree(sourceUnit, isDeclaration, diagnostics, fileName, text, languageVersion) { - this.text = text; - this._allDiagnostics = undefined; - this._sourceUnit = sourceUnit; - this._isDeclaration = isDeclaration; - this._parserDiagnostics = diagnostics; - this._fileName = fileName; - this._lineMap = text.lineMap(); - this._languageVersion = languageVersion; - sourceUnit.syntaxTree = this; - } - SyntaxTree.prototype.sourceUnit = function () { - return this._sourceUnit; - }; - SyntaxTree.prototype.isDeclaration = function () { - return this._isDeclaration; - }; - SyntaxTree.prototype.computeDiagnostics = function () { - if (this._parserDiagnostics.length > 0) { - return this._parserDiagnostics; - } - var diagnostics = []; - TypeScript.visitNodeOrToken(new GrammarCheckerWalker(this, diagnostics), this.sourceUnit()); - return diagnostics; - }; - SyntaxTree.prototype.diagnostics = function () { - if (!this._allDiagnostics) { - var start = new Date().getTime(); - this._allDiagnostics = this.computeDiagnostics(); - TypeScript.syntaxDiagnosticsTime += new Date().getTime() - start; - } - return this._allDiagnostics; - }; - SyntaxTree.prototype.fileName = function () { - return this._fileName; - }; - SyntaxTree.prototype.lineMap = function () { - return this._lineMap; - }; - SyntaxTree.prototype.languageVersion = function () { - return this._languageVersion; - }; - SyntaxTree.prototype.cacheSyntaxTreeInfo = function () { - var firstToken = firstSyntaxTreeToken(this); - var leadingTrivia = firstToken.leadingTrivia(this.text); - this._isExternalModule = !!externalModuleIndicatorSpanWorker(this, firstToken); - var amdDependencies = []; - for (var i = 0, n = leadingTrivia.count(); i < n; i++) { - var trivia = leadingTrivia.syntaxTriviaAt(i); - if (trivia.isComment()) { - var amdDependency = this.getAmdDependency(trivia.fullText()); - if (amdDependency) { - amdDependencies.push(amdDependency); - } - } - } - this._amdDependencies = amdDependencies; - }; - SyntaxTree.prototype.getAmdDependency = function (comment) { - var amdDependencyRegEx = /^\/\/\/\s* 0) { - var modifiers = parameter.modifiers; - for (var i = 0, n = modifiers.length; i < n; i++) { - var modifier = modifiers[i]; - if (this.checkParameterAccessibilityModifier(parameterList, modifier, i)) { - return true; - } - } - } - return false; - }; - GrammarCheckerWalker.prototype.checkParameterAccessibilityModifier = function (parameterList, modifier, modifierIndex) { - if (!TypeScript.SyntaxFacts.isAccessibilityModifier(modifier.kind())) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_parameter, [modifier.text()]); - return true; - } - else { - if (modifierIndex > 0) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.checkForTrailingComma = function (list) { - if (list.length === 0 || list.length % 2 === 1) { - return false; - } - var child = list[list.length - 1]; - this.pushDiagnostic(child, TypeScript.DiagnosticCode.Trailing_comma_not_allowed); - return true; - }; - GrammarCheckerWalker.prototype.checkForAtLeastOneElement = function (list, reportToken, listKind) { - if (TypeScript.childCount(list) > 0) { - return false; - } - this.pushDiagnostic(reportToken, TypeScript.DiagnosticCode._0_list_cannot_be_empty, [listKind]); - return true; - }; - GrammarCheckerWalker.prototype.visitParameterList = function (node) { - if (this.checkParameterListAcessibilityModifiers(node) || this.checkParameterListOrder(node) || this.checkForTrailingComma(node.parameters)) { - return; - } - _super.prototype.visitParameterList.call(this, node); - }; - GrammarCheckerWalker.prototype.visitHeritageClause = function (node) { - if (this.checkForTrailingComma(node.typeNames) || this.checkForAtLeastOneElement(node.typeNames, node.extendsOrImplementsKeyword, TypeScript.SyntaxFacts.getText(node.extendsOrImplementsKeyword.kind()))) { - return; - } - _super.prototype.visitHeritageClause.call(this, node); - }; - GrammarCheckerWalker.prototype.visitArgumentList = function (node) { - if (this.checkForTrailingComma(node.arguments)) { - return; - } - _super.prototype.visitArgumentList.call(this, node); - }; - GrammarCheckerWalker.prototype.visitVariableDeclaration = function (node) { - if (this.checkForAtLeastOneElement(node.variableDeclarators, node.varKeyword, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.variable_declaration, undefined)) || this.checkForTrailingComma(node.variableDeclarators)) { - return; - } - _super.prototype.visitVariableDeclaration.call(this, node); - }; - GrammarCheckerWalker.prototype.visitTypeArgumentList = function (node) { - if (this.checkForTrailingComma(node.typeArguments) || this.checkForAtLeastOneElement(node.typeArguments, node.lessThanToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_argument, undefined))) { - return; - } - _super.prototype.visitTypeArgumentList.call(this, node); - }; - GrammarCheckerWalker.prototype.visitTupleType = function (node) { - if (this.checkForTrailingComma(node.types) || this.checkForAtLeastOneElement(node.types, node.openBracketToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, undefined))) { - return; - } - _super.prototype.visitTupleType.call(this, node); - }; - GrammarCheckerWalker.prototype.visitTypeParameterList = function (node) { - if (this.checkForTrailingComma(node.typeParameters) || this.checkForAtLeastOneElement(node.typeParameters, node.lessThanToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, undefined))) { - return; - } - _super.prototype.visitTypeParameterList.call(this, node); - }; - GrammarCheckerWalker.prototype.checkIndexSignatureParameter = function (node) { - if (node.parameters.length !== 1) { - this.pushDiagnostic(node.openBracketToken, TypeScript.DiagnosticCode.Index_signature_must_have_exactly_one_parameter); - return true; - } - var parameter = TypeScript.nonSeparatorAt(node.parameters, 0); - if (parameter.dotDotDotToken) { - this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.Index_signatures_cannot_have_rest_parameters); - return true; - } - else if (parameter.modifiers.length > 0) { - this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.Index_signature_parameter_cannot_have_accessibility_modifiers); - return true; - } - else if (parameter.questionToken) { - this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.Index_signature_parameter_cannot_have_a_question_mark); - return true; - } - else if (parameter.equalsValueClause) { - this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.Index_signature_parameter_cannot_have_an_initializer); - return true; - } - else if (!parameter.typeAnnotation) { - this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.Index_signature_parameter_must_have_a_type_annotation); - return true; - } - else if (parameter.typeAnnotation.type.kind() !== 71 /* StringKeyword */ && parameter.typeAnnotation.type.kind() !== 69 /* NumberKeyword */) { - this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.Index_signature_parameter_type_must_be_string_or_number); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitIndexSignature = function (node) { - if (this.checkIndexSignatureParameter(node)) { - return; - } - if (!node.typeAnnotation) { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.Index_signature_must_have_a_type_annotation); - return; - } - _super.prototype.visitIndexSignature.call(this, node); - }; - GrammarCheckerWalker.prototype.checkClassDeclarationHeritageClauses = function (node) { - var seenExtendsClause = false; - var seenImplementsClause = false; - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - TypeScript.Debug.assert(i <= 2); - var heritageClause = node.heritageClauses[i]; - if (heritageClause.extendsOrImplementsKeyword.kind() === 50 /* ExtendsKeyword */) { - if (seenExtendsClause) { - this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.extends_clause_already_seen); - return true; - } - if (seenImplementsClause) { - this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.extends_clause_must_precede_implements_clause); - return true; - } - if (TypeScript.nonSeparatorCount(heritageClause.typeNames) > 1) { - this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.Classes_can_only_extend_a_single_class); - return true; - } - seenExtendsClause = true; - } - else { - TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.kind() === 53 /* ImplementsKeyword */); - if (seenImplementsClause) { - this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.implements_clause_already_seen); - return true; - } - seenImplementsClause = true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.checkForDisallowedDeclareModifier = function (modifiers) { - if (this.inAmbientDeclaration) { - var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 65 /* DeclareKeyword */); - if (declareToken) { - this.pushDiagnostic(declareToken, TypeScript.DiagnosticCode.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.checkForRequiredDeclareModifier = function (moduleElement, reportToken, modifiers) { - if (!this.inAmbientDeclaration && this.syntaxTree.isDeclaration()) { - if (!TypeScript.SyntaxUtilities.containsToken(modifiers, 65 /* DeclareKeyword */)) { - this.pushDiagnostic(reportToken, TypeScript.DiagnosticCode.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); - return true; - } - } - }; - GrammarCheckerWalker.prototype.visitClassDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.identifier, node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkClassDeclarationHeritageClauses(node)) { - return; - } - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); - _super.prototype.visitClassDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - GrammarCheckerWalker.prototype.checkInterfaceDeclarationHeritageClauses = function (node) { - var seenExtendsClause = false; - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - TypeScript.Debug.assert(i <= 1); - var heritageClause = node.heritageClauses[i]; - if (heritageClause.extendsOrImplementsKeyword.kind() === 50 /* ExtendsKeyword */) { - if (seenExtendsClause) { - this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.extends_clause_already_seen); - return true; - } - seenExtendsClause = true; - } - else { - TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.kind() === 53 /* ImplementsKeyword */); - this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.Interface_declaration_cannot_have_implements_clause); - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.checkInterfaceModifiers = function (modifiers) { - for (var i = 0, n = modifiers.length; i < n; i++) { - var modifier = modifiers[i]; - if (modifier.kind() === 65 /* DeclareKeyword */) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode.A_declare_modifier_cannot_be_used_with_an_interface_declaration); - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.visitInterfaceDeclaration = function (node) { - if (this.checkInterfaceModifiers(node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkInterfaceDeclarationHeritageClauses(node)) { - return; - } - _super.prototype.visitInterfaceDeclaration.call(this, node); - }; - GrammarCheckerWalker.prototype.checkClassElementModifiers = function (list) { - var seenAccessibilityModifier = false; - var seenStaticModifier = false; - for (var i = 0, n = list.length; i < n; i++) { - var modifier = list[i]; - if (TypeScript.SyntaxFacts.isAccessibilityModifier(modifier.kind())) { - if (seenAccessibilityModifier) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); - return true; - } - if (seenStaticModifier) { - var previousToken = list[i - 1]; - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_must_precede_1_modifier, [modifier.text(), previousToken.text()]); - return true; - } - seenAccessibilityModifier = true; - } - else if (modifier.kind() === 60 /* StaticKeyword */) { - if (seenStaticModifier) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_already_seen, [modifier.text()]); - return true; - } - seenStaticModifier = true; - } - else { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_class_element, [modifier.text()]); - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.visitMemberVariableDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers)) { - return; - } - _super.prototype.visitMemberVariableDeclaration.call(this, node); - }; - GrammarCheckerWalker.prototype.visitMethodSignature = function (node) { - if (this.checkForTemplatePropertyName(node.propertyName)) { - return; - } - _super.prototype.visitMethodSignature.call(this, node); - }; - GrammarCheckerWalker.prototype.visitPropertySignature = function (node) { - if (this.checkForTemplatePropertyName(node.propertyName)) { - return; - } - _super.prototype.visitPropertySignature.call(this, node); - }; - GrammarCheckerWalker.prototype.visitMemberFunctionDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers) || this.checkForTemplatePropertyName(node.propertyName)) { - return; - } - _super.prototype.visitMemberFunctionDeclaration.call(this, node); - }; - GrammarCheckerWalker.prototype.checkGetAccessorParameter = function (node) { - if (node.callSignature.parameterList.parameters.length !== 0) { - this.pushDiagnostic(node.propertyName, TypeScript.DiagnosticCode.get_accessor_cannot_have_parameters); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitIndexMemberDeclaration = function (node) { - if (this.checkIndexMemberModifiers(node)) { - return; - } - _super.prototype.visitIndexMemberDeclaration.call(this, node); - }; - GrammarCheckerWalker.prototype.checkIndexMemberModifiers = function (node) { - if (node.modifiers.length > 0) { - this.pushDiagnostic(node.modifiers[0], TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.checkEcmaScriptVersionIsAtLeast = function (reportToken, languageVersion, diagnosticKey) { - if (this.syntaxTree.languageVersion() < languageVersion) { - this.pushDiagnostic(reportToken, diagnosticKey); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitObjectLiteralExpression = function (node) { - var savedInObjectLiteralExpression = this.inObjectLiteralExpression; - this.inObjectLiteralExpression = true; - _super.prototype.visitObjectLiteralExpression.call(this, node); - this.inObjectLiteralExpression = savedInObjectLiteralExpression; - }; - GrammarCheckerWalker.prototype.visitGetAccessor = function (node) { - if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node.propertyName, 1 /* ES5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkForDisallowedAccessorTypeParameters(node.callSignature) || this.checkGetAccessorParameter(node) || this.checkForTemplatePropertyName(node.propertyName)) { - return; - } - _super.prototype.visitGetAccessor.call(this, node); - }; - GrammarCheckerWalker.prototype.checkForDisallowedSetAccessorTypeAnnotation = function (accessor) { - if (accessor.callSignature.typeAnnotation) { - this.pushDiagnostic(accessor.callSignature.typeAnnotation, TypeScript.DiagnosticCode.Type_annotation_cannot_appear_on_a_set_accessor); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.checkForDisallowedAccessorTypeParameters = function (callSignature) { - if (callSignature.typeParameterList) { - this.pushDiagnostic(callSignature.typeParameterList, TypeScript.DiagnosticCode.Type_parameters_cannot_appear_on_an_accessor); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.checkForAccessorDeclarationInAmbientContext = function (accessor) { - if (this.inAmbientDeclaration) { - this.pushDiagnostic(accessor, TypeScript.DiagnosticCode.Accessors_are_not_allowed_in_ambient_contexts); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.checkSetAccessorParameter = function (node) { - var parameters = node.callSignature.parameterList.parameters; - if (TypeScript.nonSeparatorCount(parameters) !== 1) { - this.pushDiagnostic(node.propertyName, TypeScript.DiagnosticCode.set_accessor_must_have_exactly_one_parameter); - return true; - } - var parameter = TypeScript.nonSeparatorAt(parameters, 0); - if (parameter.questionToken) { - this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.set_accessor_parameter_cannot_be_optional); - return true; - } - if (parameter.equalsValueClause) { - this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.set_accessor_parameter_cannot_have_an_initializer); - return true; - } - if (parameter.dotDotDotToken) { - this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.set_accessor_cannot_have_rest_parameter); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitSimplePropertyAssignment = function (node) { - if (this.checkForTemplatePropertyName(node.propertyName)) { - return; - } - _super.prototype.visitSimplePropertyAssignment.call(this, node); - }; - GrammarCheckerWalker.prototype.visitSetAccessor = function (node) { - if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node.propertyName, 1 /* ES5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkForDisallowedAccessorTypeParameters(node.callSignature) || this.checkForDisallowedSetAccessorTypeAnnotation(node) || this.checkSetAccessorParameter(node) || this.checkForTemplatePropertyName(node.propertyName)) { - return; - } - _super.prototype.visitSetAccessor.call(this, node); - }; - GrammarCheckerWalker.prototype.visitEnumDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.identifier, node.modifiers) || this.checkModuleElementModifiers(node.modifiers), this.checkEnumElements(node)) { - return; - } - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); - _super.prototype.visitEnumDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - GrammarCheckerWalker.prototype.checkEnumElements = function (node) { - var previousValueWasComputed = false; - for (var i = 0, n = TypeScript.nonSeparatorCount(node.enumElements); i < n; i++) { - var enumElement = TypeScript.nonSeparatorAt(node.enumElements, i); - if (!enumElement.equalsValueClause && previousValueWasComputed) { - this.pushDiagnostic(enumElement, TypeScript.DiagnosticCode.Enum_member_must_have_initializer); - return true; - } - if (enumElement.equalsValueClause) { - var value = enumElement.equalsValueClause.value; - previousValueWasComputed = !TypeScript.Syntax.isIntegerLiteral(value); - } - } - return false; - }; - GrammarCheckerWalker.prototype.visitEnumElement = function (node) { - if (this.checkForTemplatePropertyName(node.propertyName)) { - return; - } - if (this.inAmbientDeclaration && node.equalsValueClause) { - var expression = node.equalsValueClause.value; - if (!TypeScript.Syntax.isIntegerLiteral(expression)) { - this.pushDiagnostic(node.equalsValueClause.value, TypeScript.DiagnosticCode.Ambient_enum_elements_can_only_have_integer_literal_initializers); - return; - } - } - _super.prototype.visitEnumElement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitInvocationExpression = function (node) { - if (node.expression.kind() === 52 /* SuperKeyword */ && node.argumentList.typeArgumentList) { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.super_invocation_cannot_have_type_arguments); - } - _super.prototype.visitInvocationExpression.call(this, node); - }; - GrammarCheckerWalker.prototype.checkModuleElementModifiers = function (modifiers) { - var seenExportModifier = false; - var seenDeclareModifier = false; - for (var i = 0, n = modifiers.length; i < n; i++) { - var modifier = modifiers[i]; - if (TypeScript.SyntaxFacts.isAccessibilityModifier(modifier.kind()) || modifier.kind() === 60 /* StaticKeyword */) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]); - return true; - } - if (modifier.kind() === 65 /* DeclareKeyword */) { - if (seenDeclareModifier) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); - return; - } - seenDeclareModifier = true; - } - else if (modifier.kind() === 49 /* ExportKeyword */) { - if (seenExportModifier) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_already_seen, [modifier.text()]); - return; - } - if (seenDeclareModifier) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_must_precede_1_modifier, [TypeScript.SyntaxFacts.getText(49 /* ExportKeyword */), TypeScript.SyntaxFacts.getText(65 /* DeclareKeyword */)]); - return; - } - seenExportModifier = true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.checkForDisallowedImportDeclaration = function (node) { - if (!node.stringLiteral) { - for (var i = 0, n = node.moduleElements.length; i < n; i++) { - var child = node.moduleElements[i]; - if (child.kind() === 138 /* ImportDeclaration */) { - var importDeclaration = child; - if (importDeclaration.moduleReference.kind() === 211 /* ExternalModuleReference */) { - this.pushDiagnostic(importDeclaration, TypeScript.DiagnosticCode.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); - } - } - } - } - return false; - }; - GrammarCheckerWalker.prototype.checkForDisallowedDeclareModifierOnImportDeclaration = function (modifiers) { - var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 65 /* DeclareKeyword */); - if (declareToken) { - this.pushDiagnostic(declareToken, TypeScript.DiagnosticCode.A_declare_modifier_cannot_be_used_with_an_import_declaration); - return true; - } - }; - GrammarCheckerWalker.prototype.visitImportDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifierOnImportDeclaration(node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { - return; - } - _super.prototype.visitImportDeclaration.call(this, node); - }; - GrammarCheckerWalker.prototype.visitModuleDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.stringLiteral ? node.stringLiteral : TypeScript.firstToken(node.name), node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkForDisallowedImportDeclaration(node)) { - return; - } - if (node.stringLiteral) { - if (!this.inAmbientDeclaration && !TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */)) { - this.pushDiagnostic(node.stringLiteral, TypeScript.DiagnosticCode.Only_ambient_modules_can_use_quoted_names); - return; - } - } - if (!node.stringLiteral && this.checkForDisallowedExportAssignment(node)) { - return; - } - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); - _super.prototype.visitModuleDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - GrammarCheckerWalker.prototype.checkForDisallowedExportAssignment = function (node) { - for (var i = 0, n = node.moduleElements.length; i < n; i++) { - var child = node.moduleElements[i]; - if (child.kind() === 139 /* ExportAssignment */) { - this.pushDiagnostic(child, TypeScript.DiagnosticCode.Export_assignment_cannot_be_used_in_internal_modules); - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.visitBlock = function (node) { - if (this.checkForBlockInAmbientContext(node)) { - return; - } - var savedInBlock = this.inBlock; - this.inBlock = true; - _super.prototype.visitBlock.call(this, node); - this.inBlock = savedInBlock; - }; - GrammarCheckerWalker.prototype.checkForBlockInAmbientContext = function (node) { - if (this.inAmbientDeclaration || this.syntaxTree.isDeclaration()) { - if (node.parent.kind() === 1 /* List */) { - this.pushDiagnostic(TypeScript.firstToken(node), TypeScript.DiagnosticCode.Statements_are_not_allowed_in_ambient_contexts); - } - else { - this.pushDiagnostic(TypeScript.firstToken(node), TypeScript.DiagnosticCode.A_function_implementation_cannot_be_declared_in_an_ambient_context); - } - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.checkForStatementInAmbientContxt = function (node) { - if (this.inAmbientDeclaration || this.syntaxTree.isDeclaration()) { - this.pushDiagnostic(TypeScript.firstToken(node), TypeScript.DiagnosticCode.Statements_are_not_allowed_in_ambient_contexts); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitBreakStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node) || this.checkBreakStatementTarget(node)) { - return; - } - _super.prototype.visitBreakStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitContinueStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node) || this.checkContinueStatementTarget(node)) { - return; - } - _super.prototype.visitContinueStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.checkBreakStatementTarget = function (node) { - if (node.identifier) { - var breakableLabels = this.getEnclosingLabels(node, true, false); - if (!TypeScript.ArrayUtilities.any(breakableLabels, function (s) { return TypeScript.tokenValueText(s.identifier) === TypeScript.tokenValueText(node.identifier); })) { - var breakableLabels = this.getEnclosingLabels(node, true, true); - if (TypeScript.ArrayUtilities.any(breakableLabels, function (s) { return TypeScript.tokenValueText(s.identifier) === TypeScript.tokenValueText(node.identifier); })) { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary); - } - else { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.Jump_target_not_found); - } - return true; - } - } - else if (!this.inIterationStatement(node, false) && !this.inSwitchStatement(node)) { - if (this.inIterationStatement(node, true)) { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary); - } - else { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement); - } - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.inSwitchStatement = function (ast) { - while (ast) { - if (ast.kind() === 156 /* SwitchStatement */) { - return true; - } - if (TypeScript.SyntaxUtilities.isAnyFunctionExpressionOrDeclaration(ast)) { - return false; - } - ast = ast.parent; - } - return false; - }; - GrammarCheckerWalker.prototype.isIterationStatement = function (ast) { - switch (ast.kind()) { - case 159 /* ForStatement */: - case 160 /* ForInStatement */: - case 163 /* WhileStatement */: - case 166 /* DoStatement */: - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.inIterationStatement = function (element, crossFunctions) { - while (element) { - if (this.isIterationStatement(element)) { - return true; - } - if (!crossFunctions && TypeScript.SyntaxUtilities.isAnyFunctionExpressionOrDeclaration(element)) { - return false; - } - element = element.parent; - } - return false; - }; - GrammarCheckerWalker.prototype.getEnclosingLabels = function (element, breakable, crossFunctions) { - var result = []; - element = element.parent; - while (element) { - if (element.kind() === 165 /* LabeledStatement */) { - var labeledStatement = element; - if (breakable) { - result.push(labeledStatement); - } - else { - if (this.labelIsOnContinuableConstruct(labeledStatement.statement)) { - result.push(labeledStatement); - } - } - } - if (!crossFunctions && TypeScript.SyntaxUtilities.isAnyFunctionExpressionOrDeclaration(element)) { - break; - } - element = element.parent; - } - return result; - }; - GrammarCheckerWalker.prototype.labelIsOnContinuableConstruct = function (statement) { - switch (statement.kind()) { - case 165 /* LabeledStatement */: - return this.labelIsOnContinuableConstruct(statement.statement); - case 163 /* WhileStatement */: - case 159 /* ForStatement */: - case 160 /* ForInStatement */: - case 166 /* DoStatement */: - return true; - default: - return false; - } - }; - GrammarCheckerWalker.prototype.checkContinueStatementTarget = function (node) { - if (!this.inIterationStatement(node, false)) { - if (this.inIterationStatement(node, true)) { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary); - } - else { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.continue_statement_can_only_be_used_within_an_enclosing_iteration_statement); - } - return true; - } - else if (node.identifier) { - var continuableLabels = this.getEnclosingLabels(node, false, false); - if (!TypeScript.ArrayUtilities.any(continuableLabels, function (s) { return TypeScript.tokenValueText(s.identifier) === TypeScript.tokenValueText(node.identifier); })) { - var continuableLabels = this.getEnclosingLabels(node, false, true); - if (TypeScript.ArrayUtilities.any(continuableLabels, function (s) { return TypeScript.tokenValueText(s.identifier) === TypeScript.tokenValueText(node.identifier); })) { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.Jump_target_cannot_cross_function_boundary); - } - else { - this.pushDiagnostic(node, TypeScript.DiagnosticCode.Jump_target_not_found); - } - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.visitDebuggerStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitDebuggerStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitDoStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitDoStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitEmptyStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitEmptyStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitExpressionStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitExpressionStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitForInStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node) || this.checkForInStatementVariableDeclaration(node) || this.checkForInLeftHandSideExpression(node)) { - return; - } - _super.prototype.visitForInStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.checkForInLeftHandSideExpression = function (node) { - if (node.left && !TypeScript.SyntaxUtilities.isLeftHandSizeExpression(node.left)) { - this.pushDiagnostic(node.left, TypeScript.DiagnosticCode.Invalid_left_hand_side_in_for_in_statement); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.checkForInStatementVariableDeclaration = function (node) { - if (node.variableDeclaration && node.variableDeclaration.variableDeclarators.length > 1) { - this.pushDiagnostic(node.variableDeclaration, TypeScript.DiagnosticCode.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitForStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitForStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitIfStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitIfStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitLabeledStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node) || this.checkForInvalidLabelIdentifier(node)) { - return; - } - _super.prototype.visitLabeledStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.checkForInvalidLabelIdentifier = function (node) { - var labelIdentifier = TypeScript.tokenValueText(node.identifier); - var breakableLabels = this.getEnclosingLabels(node, true, false); - var matchingLabel = TypeScript.ArrayUtilities.firstOrDefault(breakableLabels, function (s) { return TypeScript.tokenValueText(s.identifier) === labelIdentifier; }); - if (matchingLabel) { - this.pushDiagnostic(node.identifier, TypeScript.DiagnosticCode.Duplicate_identifier_0, [labelIdentifier]); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitReturnStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node) || this.checkForReturnStatementNotInFunctionBody(node)) { - return; - } - _super.prototype.visitReturnStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.checkForReturnStatementNotInFunctionBody = function (node) { - for (var element = node; element; element = element.parent) { - if (TypeScript.SyntaxUtilities.isAnyFunctionExpressionOrDeclaration(element)) { - return false; - } - } - this.pushDiagnostic(TypeScript.firstToken(node), TypeScript.DiagnosticCode.return_statement_must_be_contained_within_a_function_body); - return true; - }; - GrammarCheckerWalker.prototype.visitSwitchStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitSwitchStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitThrowStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitThrowStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitTryStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitTryStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitWhileStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node)) { - return; - } - _super.prototype.visitWhileStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.visitWithStatement = function (node) { - if (this.checkForStatementInAmbientContxt(node) || this.checkForWithInStrictMode(node)) { - return; - } - _super.prototype.visitWithStatement.call(this, node); - }; - GrammarCheckerWalker.prototype.checkForWithInStrictMode = function (node) { - if (TypeScript.parsedInStrictMode(node)) { - this.pushDiagnostic(TypeScript.firstToken(node), TypeScript.DiagnosticCode.with_statements_are_not_allowed_in_strict_mode); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.checkForDisallowedModifiers = function (modifiers) { - if (this.inBlock || this.inObjectLiteralExpression) { - if (modifiers.length > 0) { - this.pushDiagnostic(modifiers[0], TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.visitFunctionDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.identifier, node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkForDisallowedEvalOrArguments(node, node.identifier)) { - return; - } - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); - _super.prototype.visitFunctionDeclaration.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - GrammarCheckerWalker.prototype.visitFunctionExpression = function (node) { - if (this.checkForDisallowedEvalOrArguments(node, node.identifier)) { - return; - } - _super.prototype.visitFunctionExpression.call(this, node); - }; - GrammarCheckerWalker.prototype.visitFunctionPropertyAssignment = function (node) { - if (this.checkForTemplatePropertyName(node.propertyName)) { - return; - } - _super.prototype.visitFunctionPropertyAssignment.call(this, node); - }; - GrammarCheckerWalker.prototype.visitVariableStatement = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.variableDeclaration.varKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { - return; - } - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); - _super.prototype.visitVariableStatement.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - GrammarCheckerWalker.prototype.checkListSeparators = function (list, kind) { - for (var i = 0, n = TypeScript.separatorCount(list); i < n; i++) { - var child = TypeScript.separatorAt(list, i); - if (child.kind() !== kind) { - this.pushDiagnostic(child, TypeScript.DiagnosticCode._0_expected, [TypeScript.SyntaxFacts.getText(kind)]); - } - } - return false; - }; - GrammarCheckerWalker.prototype.visitObjectType = function (node) { - if (this.checkListSeparators(node.typeMembers, 80 /* SemicolonToken */)) { - return; - } - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitObjectType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - GrammarCheckerWalker.prototype.visitArrayType = function (node) { - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitArrayType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - GrammarCheckerWalker.prototype.visitFunctionType = function (node) { - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitFunctionType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - GrammarCheckerWalker.prototype.visitConstructorType = function (node) { - var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = true; - _super.prototype.visitConstructorType.call(this, node); - this.inAmbientDeclaration = savedInAmbientDeclaration; - }; - GrammarCheckerWalker.prototype.visitVariableDeclarator = function (node) { - if (this.checkVariableDeclaratorInitializer(node) || this.checkVariableDeclaratorIdentifier(node) || this.checkForTemplatePropertyName(node.propertyName)) { - return; - } - _super.prototype.visitVariableDeclarator.call(this, node); - }; - GrammarCheckerWalker.prototype.checkForTemplatePropertyName = function (token) { - if (token.kind() === 13 /* NoSubstitutionTemplateToken */) { - this.pushDiagnostic(token, TypeScript.DiagnosticCode.Template_literal_cannot_be_used_as_an_element_name); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.checkVariableDeclaratorIdentifier = function (node) { - if (node.parent.kind() !== 141 /* MemberVariableDeclaration */) { - if (this.checkForDisallowedEvalOrArguments(node, node.propertyName)) { - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.checkVariableDeclaratorInitializer = function (node) { - if (this.inAmbientDeclaration && node.equalsValueClause) { - this.pushDiagnostic(TypeScript.firstToken(node.equalsValueClause.value), TypeScript.DiagnosticCode.Initializers_are_not_allowed_in_ambient_contexts); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitConstructorDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers) || this.checkConstructorModifiers(node.modifiers) || this.checkConstructorTypeParameterList(node) || this.checkConstructorTypeAnnotation(node)) { - return; - } - _super.prototype.visitConstructorDeclaration.call(this, node); - }; - GrammarCheckerWalker.prototype.checkConstructorModifiers = function (modifiers) { - for (var i = 0, n = modifiers.length; i < n; i++) { - var child = modifiers[i]; - if (child.kind() !== 59 /* PublicKeyword */) { - this.pushDiagnostic(child, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_constructor_declaration, [TypeScript.SyntaxFacts.getText(child.kind())]); - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.checkConstructorTypeParameterList = function (node) { - if (node.callSignature.typeParameterList) { - this.pushDiagnostic(node.callSignature.typeParameterList, TypeScript.DiagnosticCode.Type_parameters_cannot_appear_on_a_constructor_declaration); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.checkConstructorTypeAnnotation = function (node) { - if (node.callSignature.typeAnnotation) { - this.pushDiagnostic(node.callSignature.typeAnnotation, TypeScript.DiagnosticCode.Type_annotation_cannot_appear_on_a_constructor_declaration); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitBinaryExpression = function (node) { - if (this.checkIllegalAssignment(node)) { - return; - } - _super.prototype.visitBinaryExpression.call(this, node); - }; - GrammarCheckerWalker.prototype.visitPrefixUnaryExpression = function (node) { - if (TypeScript.parsedInStrictMode(node) && this.isPreIncrementOrDecrementExpression(node) && this.isEvalOrArguments(node.operand)) { - this.pushDiagnostic(node.operatorToken, TypeScript.DiagnosticCode.Invalid_use_of_0_in_strict_mode, [this.getEvalOrArguments(node.operand)]); - } - _super.prototype.visitPrefixUnaryExpression.call(this, node); - }; - GrammarCheckerWalker.prototype.visitPostfixUnaryExpression = function (node) { - if (TypeScript.parsedInStrictMode(node) && this.isEvalOrArguments(node.operand)) { - this.pushDiagnostic(node.operatorToken, TypeScript.DiagnosticCode.Invalid_use_of_0_in_strict_mode, [this.getEvalOrArguments(node.operand)]); - } - _super.prototype.visitPostfixUnaryExpression.call(this, node); - }; - GrammarCheckerWalker.prototype.visitParameter = function (node) { - if (this.checkForDisallowedEvalOrArguments(node, node.identifier)) { - return; - } - _super.prototype.visitParameter.call(this, node); - }; - GrammarCheckerWalker.prototype.checkForDisallowedEvalOrArguments = function (node, token) { - if (token) { - if (TypeScript.parsedInStrictMode(node) && this.isEvalOrArguments(token)) { - this.pushDiagnostic(token, TypeScript.DiagnosticCode.Invalid_use_of_0_in_strict_mode, [this.getEvalOrArguments(token)]); - return true; - } - } - return false; - }; - GrammarCheckerWalker.prototype.isPreIncrementOrDecrementExpression = function (node) { - switch (node.operatorToken.kind()) { - case 96 /* MinusMinusToken */: - case 95 /* PlusPlusToken */: - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.visitDeleteExpression = function (node) { - if (TypeScript.parsedInStrictMode(node) && node.expression.kind() === 9 /* IdentifierName */) { - this.pushDiagnostic(TypeScript.firstToken(node), TypeScript.DiagnosticCode.delete_cannot_be_called_on_an_identifier_in_strict_mode); - return; - } - _super.prototype.visitDeleteExpression.call(this, node); - }; - GrammarCheckerWalker.prototype.checkIllegalAssignment = function (node) { - if (TypeScript.parsedInStrictMode(node) && TypeScript.SyntaxFacts.isAssignmentOperatorToken(node.operatorToken.kind()) && this.isEvalOrArguments(node.left)) { - this.pushDiagnostic(node.operatorToken, TypeScript.DiagnosticCode.Invalid_use_of_0_in_strict_mode, [this.getEvalOrArguments(node.left)]); - return true; - } - return false; - }; - GrammarCheckerWalker.prototype.getEvalOrArguments = function (expr) { - if (expr.kind() === 9 /* IdentifierName */) { - var text = TypeScript.tokenValueText(expr); - if (text === "eval" || text === "arguments") { - return text; - } - } - return undefined; - }; - GrammarCheckerWalker.prototype.isEvalOrArguments = function (expr) { - return !!this.getEvalOrArguments(expr); - }; - GrammarCheckerWalker.prototype.visitConstraint = function (node) { - if (this.checkConstraintType(node)) { - return; - } - _super.prototype.visitConstraint.call(this, node); - }; - GrammarCheckerWalker.prototype.checkConstraintType = function (node) { - if (!TypeScript.SyntaxFacts.isType(node.typeOrExpression.kind())) { - this.pushDiagnostic(node.typeOrExpression, TypeScript.DiagnosticCode.Type_expected); - return true; - } - return false; - }; - return GrammarCheckerWalker; - })(TypeScript.SyntaxWalker); - function firstSyntaxTreeToken(syntaxTree) { - var scanner = TypeScript.Scanner.createScanner(syntaxTree.languageVersion(), syntaxTree.text, function () { - }); - return scanner.scan(false); - } - function externalModuleIndicatorSpan(syntaxTree) { - var firstToken = firstSyntaxTreeToken(syntaxTree); - return externalModuleIndicatorSpanWorker(syntaxTree, firstToken); - } - TypeScript.externalModuleIndicatorSpan = externalModuleIndicatorSpan; - function externalModuleIndicatorSpanWorker(syntaxTree, firstToken) { - var leadingTrivia = firstToken.leadingTrivia(syntaxTree.text); - return implicitImportSpan(leadingTrivia) || topLevelImportOrExportSpan(syntaxTree.sourceUnit()); - } - TypeScript.externalModuleIndicatorSpanWorker = externalModuleIndicatorSpanWorker; - function implicitImportSpan(sourceUnitLeadingTrivia) { - for (var i = 0, n = sourceUnitLeadingTrivia.count(); i < n; i++) { - var trivia = sourceUnitLeadingTrivia.syntaxTriviaAt(i); - if (trivia.isComment()) { - var span = implicitImportSpanWorker(trivia); - if (span) { - return span; - } - } - } - return undefined; - } - function implicitImportSpanWorker(trivia) { - var implicitImportRegEx = /^(\/\/\/\s*/gim; - var match = implicitImportRegEx.exec(trivia.fullText()); - if (match) { - return new TypeScript.TextSpan(trivia.fullStart(), trivia.fullWidth()); - } - return undefined; - } - function topLevelImportOrExportSpan(node) { - for (var i = 0, n = node.moduleElements.length; i < n; i++) { - var moduleElement = node.moduleElements[i]; - var _firstToken = TypeScript.firstToken(moduleElement); - if (_firstToken && _firstToken.kind() === 49 /* ExportKeyword */) { - return new TypeScript.TextSpan(TypeScript.start(_firstToken), TypeScript.width(_firstToken)); - } - if (moduleElement.kind() === 138 /* ImportDeclaration */) { - var importDecl = moduleElement; - if (importDecl.moduleReference.kind() === 211 /* ExternalModuleReference */) { - var literal = importDecl.moduleReference.stringLiteral; - return new TypeScript.TextSpan(TypeScript.start(literal), TypeScript.width(literal)); - } - } - } - return undefined; - } -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Unicode = (function () { - function Unicode() { - } - Unicode.lookupInUnicodeMap = function (code, map) { - if (code < map[0]) { - return false; - } - var lo = 0; - var hi = map.length; - var mid; - while (lo + 1 < hi) { - mid = lo + (hi - lo) / 2; - mid -= mid % 2; - if (map[mid] <= code && code <= map[mid + 1]) { - return true; - } - if (code < map[mid]) { - hi = mid; - } - else { - lo = mid + 2; - } - } - return false; - }; - Unicode.isIdentifierStart = function (code, languageVersion) { - if (languageVersion === 0 /* ES3 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierStart); - } - else if (languageVersion >= 1 /* ES5 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierStart); - } - else { - throw TypeScript.Errors.argumentOutOfRange("languageVersion"); - } - }; - Unicode.isIdentifierPart = function (code, languageVersion) { - if (languageVersion === 0 /* ES3 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierPart); - } - else if (languageVersion >= 1 /* ES5 */) { - return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierPart); - } - else { - throw TypeScript.Errors.argumentOutOfRange("languageVersion"); - } - }; - Unicode.unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - Unicode.unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - Unicode.unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - Unicode.unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - return Unicode; - })(); - TypeScript.Unicode = Unicode; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var IncrementalParser; - (function (IncrementalParser) { - function createParserSource(oldSyntaxTree, textChangeRange, text) { - var fileName = oldSyntaxTree.fileName(); - var languageVersion = oldSyntaxTree.languageVersion(); - var _scannerParserSource; - var _changeRange; - var _changeRangeNewSpan; - var _changeDelta = 0; - var _oldSourceUnitCursor = getSyntaxCursor(); - var oldSourceUnit = oldSyntaxTree.sourceUnit(); - var _outstandingRewindPointCount = 0; - if (oldSourceUnit.moduleElements.length > 0) { - _oldSourceUnitCursor.pushElement(TypeScript.childAt(oldSourceUnit.moduleElements, 0), 0); - } - _changeRange = extendToAffectedRange(textChangeRange, oldSourceUnit); - _changeRangeNewSpan = _changeRange.newSpan(); - if (TypeScript.Debug.shouldAssert(2 /* Aggressive */)) { - TypeScript.Debug.assert((TypeScript.fullWidth(oldSourceUnit) - _changeRange.span().length() + _changeRange.newLength()) === text.length()); - } - _scannerParserSource = TypeScript.Scanner.createParserSource(oldSyntaxTree.fileName(), text, oldSyntaxTree.languageVersion()); - function release() { - _scannerParserSource.release(); - _scannerParserSource = undefined; - _oldSourceUnitCursor = undefined; - _outstandingRewindPointCount = 0; - } - function extendToAffectedRange(changeRange, sourceUnit) { - var maxLookahead = 1; - var start = changeRange.span().start(); - for (var i = 0; start > 0 && i <= maxLookahead; i++) { - var token = TypeScript.findToken(sourceUnit, start); - var position = token.fullStart(); - start = Math.max(0, position - 1); - } - var finalSpan = TypeScript.TextSpan.fromBounds(start, changeRange.span().end()); - var finalLength = changeRange.newLength() + (changeRange.span().start() - start); - return new TypeScript.TextChangeRange(finalSpan, finalLength); - } - function absolutePosition() { - return _scannerParserSource.absolutePosition(); - } - function tokenDiagnostics() { - return _scannerParserSource.tokenDiagnostics(); - } - function getRewindPoint() { - var rewindPoint = _scannerParserSource.getRewindPoint(); - var oldSourceUnitCursorClone = cloneSyntaxCursor(_oldSourceUnitCursor); - rewindPoint.changeDelta = _changeDelta; - rewindPoint.changeRange = _changeRange; - rewindPoint.oldSourceUnitCursor = _oldSourceUnitCursor; - _oldSourceUnitCursor = oldSourceUnitCursorClone; - _outstandingRewindPointCount++; - return rewindPoint; - } - function rewind(rewindPoint) { - _changeRange = rewindPoint.changeRange; - _changeDelta = rewindPoint.changeDelta; - returnSyntaxCursor(_oldSourceUnitCursor); - _oldSourceUnitCursor = rewindPoint.oldSourceUnitCursor; - rewindPoint.oldSourceUnitCursor = undefined; - _scannerParserSource.rewind(rewindPoint); - } - function releaseRewindPoint(rewindPoint) { - if (rewindPoint.oldSourceUnitCursor) { - returnSyntaxCursor(rewindPoint.oldSourceUnitCursor); - } - _scannerParserSource.releaseRewindPoint(rewindPoint); - _outstandingRewindPointCount--; - TypeScript.Debug.assert(_outstandingRewindPointCount >= 0); - } - function isPinned() { - return _outstandingRewindPointCount > 0; - } - function canReadFromOldSourceUnit() { - if (isPinned()) { - return false; - } - if (_changeRange && _changeRangeNewSpan.intersectsWithPosition(absolutePosition())) { - return false; - } - syncCursorToNewTextIfBehind(); - return _changeDelta === 0 && !_oldSourceUnitCursor.isFinished(); - } - function updateTokens(nodeOrToken) { - if (isPastChangeRange()) { - var position = absolutePosition(); - if (TypeScript.isToken(nodeOrToken)) { - nodeOrToken.setFullStart(position); - } - else { - var tokens = getTokens(nodeOrToken); - for (var i = 0, n = tokens.length; i < n; i++) { - var token = tokens[i]; - token.setFullStart(position); - position += token.fullWidth(); - } - } - } - } - function getTokens(node) { - var tokens = node.__cachedTokens; - if (!tokens) { - tokens = []; - tokenCollectorWalker.tokens = tokens; - TypeScript.visitNodeOrToken(tokenCollectorWalker, node); - node.__cachedTokens = tokens; - tokenCollectorWalker.tokens = undefined; - } - return tokens; - } - function currentNode() { - if (canReadFromOldSourceUnit()) { - var node = tryGetNodeFromOldSourceUnit(); - if (node) { - updateTokens(node); - return node; - } - } - return undefined; - } - function currentToken() { - if (canReadFromOldSourceUnit()) { - var token = tryGetTokenFromOldSourceUnit(); - if (token) { - updateTokens(token); - return token; - } - } - return _scannerParserSource.currentToken(); - } - function currentContextualToken() { - return _scannerParserSource.currentContextualToken(); - } - function syncCursorToNewTextIfBehind() { - while (true) { - if (_oldSourceUnitCursor.isFinished()) { - break; - } - if (_changeDelta >= 0) { - break; - } - var currentNodeOrToken = _oldSourceUnitCursor.currentNodeOrToken(); - if (TypeScript.isNode(currentNodeOrToken) && (TypeScript.fullWidth(currentNodeOrToken) > Math.abs(_changeDelta))) { - _oldSourceUnitCursor.moveToFirstChild(); - } - else { - _oldSourceUnitCursor.moveToNextSibling(); - _changeDelta += TypeScript.fullWidth(currentNodeOrToken); - } - } - } - function intersectsWithChangeRangeSpanInOriginalText(start, length) { - return !isPastChangeRange() && _changeRange.span().intersectsWith(start, length); - } - function tryGetNodeFromOldSourceUnit() { - while (true) { - var node = _oldSourceUnitCursor.currentNode(); - if (node === undefined) { - return undefined; - } - if (!intersectsWithChangeRangeSpanInOriginalText(absolutePosition(), TypeScript.fullWidth(node))) { - var isIncrementallyUnusuable = TypeScript.isIncrementallyUnusable(node); - if (!isIncrementallyUnusuable) { - return node; - } - } - _oldSourceUnitCursor.moveToFirstChild(); - } - } - function canReuseTokenFromOldSourceUnit(position, token) { - if (token) { - if (!intersectsWithChangeRangeSpanInOriginalText(position, token.fullWidth())) { - if (!token.isIncrementallyUnusable() && !TypeScript.Scanner.isContextualToken(token)) { - return true; - } - } - } - return false; - } - function tryGetTokenFromOldSourceUnit() { - var token = _oldSourceUnitCursor.currentToken(); - return canReuseTokenFromOldSourceUnit(absolutePosition(), token) ? token : undefined; - } - function peekToken(n) { - if (canReadFromOldSourceUnit()) { - var token = tryPeekTokenFromOldSourceUnit(n); - if (token) { - return token; - } - } - return _scannerParserSource.peekToken(n); - } - function tryPeekTokenFromOldSourceUnit(n) { - var cursorClone = cloneSyntaxCursor(_oldSourceUnitCursor); - var token = tryPeekTokenFromOldSourceUnitWorker(n); - returnSyntaxCursor(_oldSourceUnitCursor); - _oldSourceUnitCursor = cursorClone; - return token; - } - function tryPeekTokenFromOldSourceUnitWorker(n) { - var currentPosition = absolutePosition(); - _oldSourceUnitCursor.moveToFirstToken(); - for (var i = 0; i < n; i++) { - var interimToken = _oldSourceUnitCursor.currentToken(); - if (!canReuseTokenFromOldSourceUnit(currentPosition, interimToken)) { - return undefined; - } - currentPosition += interimToken.fullWidth(); - _oldSourceUnitCursor.moveToNextSibling(); - } - var token = _oldSourceUnitCursor.currentToken(); - return canReuseTokenFromOldSourceUnit(currentPosition, token) ? token : undefined; - } - function consumeNode(node) { - _oldSourceUnitCursor.moveToNextSibling(); - var _absolutePosition = absolutePosition() + TypeScript.fullWidth(node); - _scannerParserSource.resetToPosition(_absolutePosition); - } - function consumeToken(currentToken) { - if (_oldSourceUnitCursor.currentToken() === currentToken) { - _oldSourceUnitCursor.moveToNextSibling(); - var _absolutePosition = absolutePosition() + currentToken.fullWidth(); - _scannerParserSource.resetToPosition(_absolutePosition); - } - else { - _changeDelta -= currentToken.fullWidth(); - _scannerParserSource.consumeToken(currentToken); - if (!isPastChangeRange()) { - if (absolutePosition() >= _changeRangeNewSpan.end()) { - _changeDelta += _changeRange.newLength() - _changeRange.span().length(); - _changeRange = undefined; - } - } - } - } - function isPastChangeRange() { - return _changeRange === undefined; - } - return { - text: text, - fileName: fileName, - languageVersion: languageVersion, - currentNode: currentNode, - currentToken: currentToken, - currentContextualToken: currentContextualToken, - peekToken: peekToken, - consumeNode: consumeNode, - consumeToken: consumeToken, - getRewindPoint: getRewindPoint, - rewind: rewind, - releaseRewindPoint: releaseRewindPoint, - tokenDiagnostics: tokenDiagnostics, - release: release - }; - } - function createSyntaxCursorPiece(element, indexInParent) { - return { element: element, indexInParent: indexInParent }; - } - var syntaxCursorPool = []; - var syntaxCursorPoolCount = 0; - function returnSyntaxCursor(cursor) { - cursor.clean(); - syntaxCursorPool[syntaxCursorPoolCount] = cursor; - syntaxCursorPoolCount++; - } - function getSyntaxCursor() { - var cursor = syntaxCursorPoolCount > 0 ? syntaxCursorPool[syntaxCursorPoolCount - 1] : createSyntaxCursor(); - if (syntaxCursorPoolCount > 0) { - syntaxCursorPoolCount--; - syntaxCursorPool[syntaxCursorPoolCount] = undefined; - } - return cursor; - } - function cloneSyntaxCursor(cursor) { - var newCursor = getSyntaxCursor(); - newCursor.deepCopyFrom(cursor); - return newCursor; - } - function createSyntaxCursor() { - var pieces = []; - var currentPieceIndex = -1; - function clean() { - for (var i = 0, n = pieces.length; i < n; i++) { - var piece = pieces[i]; - if (piece.element === undefined) { - break; - } - piece.element = undefined; - piece.indexInParent = -1; - } - currentPieceIndex = -1; - } - function deepCopyFrom(other) { - for (var i = 0, n = other.pieces.length; i < n; i++) { - var piece = other.pieces[i]; - if (piece.element === undefined) { - break; - } - pushElement(piece.element, piece.indexInParent); - } - } - function isFinished() { - return currentPieceIndex < 0; - } - function currentNodeOrToken() { - if (isFinished()) { - return undefined; - } - var result = pieces[currentPieceIndex].element; - return result; - } - function currentNode() { - var element = currentNodeOrToken(); - return TypeScript.isNode(element) ? element : undefined; - } - function isEmptyList(element) { - return TypeScript.isList(element) && element.length === 0; - } - function moveToFirstChild() { - var nodeOrToken = currentNodeOrToken(); - if (nodeOrToken === undefined) { - return; - } - if (TypeScript.isToken(nodeOrToken)) { - return; - } - for (var i = 0, n = TypeScript.childCount(nodeOrToken); i < n; i++) { - var child = TypeScript.childAt(nodeOrToken, i); - if (child && !isEmptyList(child)) { - pushElement(child, i); - moveToFirstChildIfList(); - return; - } - } - moveToNextSibling(); - } - function moveToNextSibling() { - while (!isFinished()) { - var currentPiece = pieces[currentPieceIndex]; - var parent = currentPiece.element.parent; - for (var i = currentPiece.indexInParent + 1, n = TypeScript.childCount(parent); i < n; i++) { - var sibling = TypeScript.childAt(parent, i); - if (sibling && !isEmptyList(sibling)) { - currentPiece.element = sibling; - currentPiece.indexInParent = i; - moveToFirstChildIfList(); - return; - } - } - currentPiece.element = undefined; - currentPiece.indexInParent = -1; - currentPieceIndex--; - } - } - function moveToFirstChildIfList() { - var element = pieces[currentPieceIndex].element; - if (TypeScript.isList(element)) { - pushElement(TypeScript.childAt(element, 0), 0); - } - } - function pushElement(element, indexInParent) { - currentPieceIndex++; - if (currentPieceIndex === pieces.length) { - pieces.push(createSyntaxCursorPiece(element, indexInParent)); - } - else { - var piece = pieces[currentPieceIndex]; - piece.element = element; - piece.indexInParent = indexInParent; - } - } - function moveToFirstToken() { - while (!isFinished()) { - var element = pieces[currentPieceIndex].element; - if (TypeScript.isNode(element)) { - moveToFirstChild(); - continue; - } - return; - } - } - function currentToken() { - moveToFirstToken(); - var element = currentNodeOrToken(); - return element; - } - return { - pieces: pieces, - clean: clean, - isFinished: isFinished, - moveToFirstChild: moveToFirstChild, - moveToFirstToken: moveToFirstToken, - moveToNextSibling: moveToNextSibling, - currentNodeOrToken: currentNodeOrToken, - currentNode: currentNode, - currentToken: currentToken, - pushElement: pushElement, - deepCopyFrom: deepCopyFrom - }; - } - var TokenCollectorWalker = (function (_super) { - __extends(TokenCollectorWalker, _super); - function TokenCollectorWalker() { - _super.apply(this, arguments); - this.tokens = []; - } - TokenCollectorWalker.prototype.visitToken = function (token) { - this.tokens.push(token); - }; - return TokenCollectorWalker; - })(TypeScript.SyntaxWalker); - var tokenCollectorWalker = new TokenCollectorWalker(); - function parse(oldSyntaxTree, textChangeRange, newText) { - if (textChangeRange.isUnchanged()) { - return oldSyntaxTree; - } - return TypeScript.Parser.parseSource(createParserSource(oldSyntaxTree, textChangeRange, newText), oldSyntaxTree.isDeclaration()); - } - IncrementalParser.parse = parse; - })(IncrementalParser = TypeScript.IncrementalParser || (TypeScript.IncrementalParser = {})); -})(TypeScript || (TypeScript = {})); + ts.TextChangeRange = TextChangeRange; +})(ts || (ts = {})); var ts; (function (ts) { var OutliningElementsCollector; @@ -28119,8 +16278,8 @@ var ts; function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { if (hintSpanNode && startElement && endElement) { var span = { - textSpan: TypeScript.TextSpan.fromBounds(startElement.pos, endElement.end), - hintSpan: TypeScript.TextSpan.fromBounds(hintSpanNode.getStart(), hintSpanNode.end), + textSpan: ts.TextSpan.fromBounds(startElement.pos, endElement.end), + hintSpan: ts.TextSpan.fromBounds(hintSpanNode.getStart(), hintSpanNode.end), bannerText: collapseText, autoCollapse: autoCollapse }; @@ -28129,10 +16288,10 @@ var ts; } function autoCollapse(node) { switch (node.kind) { - case 189 /* ModuleBlock */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 187 /* EnumDeclaration */: + case 192 /* ModuleBlock */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: return false; } return true; @@ -28144,15 +16303,15 @@ var ts; return; } switch (n.kind) { - case 158 /* Block */: + case 161 /* Block */: var parent = n.parent; var openBrace = ts.findChildOfKind(n, 13 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 14 /* CloseBraceToken */, sourceFile); - if (parent.kind === 163 /* DoStatement */ || parent.kind === 166 /* ForInStatement */ || parent.kind === 165 /* ForStatement */ || parent.kind === 162 /* IfStatement */ || parent.kind === 164 /* WhileStatement */ || parent.kind === 170 /* WithStatement */) { + if (parent.kind === 166 /* DoStatement */ || parent.kind === 169 /* ForInStatement */ || parent.kind === 168 /* ForStatement */ || parent.kind === 165 /* IfStatement */ || parent.kind === 167 /* WhileStatement */ || parent.kind === 173 /* WithStatement */) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); } else { - var span = TypeScript.TextSpan.fromBounds(n.getStart(), n.end); + var span = ts.TextSpan.fromBounds(n.getStart(), n.end); elements.push({ textSpan: span, hintSpan: span, @@ -28161,25 +16320,25 @@ var ts; }); } break; - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: var openBrace = ts.findChildOfKind(n, 13 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 14 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 187 /* EnumDeclaration */: - case 140 /* ObjectLiteral */: - case 171 /* SwitchStatement */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: + case 142 /* ObjectLiteral */: + case 174 /* SwitchStatement */: var openBrace = ts.findChildOfKind(n, 13 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 14 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: var openBracket = ts.findChildOfKind(n, 17 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 18 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -28207,14 +16366,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: do { current = current.parent; - } while (current.kind === 188 /* ModuleDeclaration */); - case 184 /* ClassDeclaration */: - case 187 /* EnumDeclaration */: - case 185 /* InterfaceDeclaration */: - case 182 /* FunctionDeclaration */: + } while (current.kind === 191 /* ModuleDeclaration */); + case 187 /* ClassDeclaration */: + case 190 /* EnumDeclaration */: + case 188 /* InterfaceDeclaration */: + case 185 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -28225,10 +16384,10 @@ var ts; var childNodes = []; for (var i = 0, n = nodes.length; i < n; i++) { var node = nodes[i]; - if (node.kind === 184 /* ClassDeclaration */ || node.kind === 187 /* EnumDeclaration */ || node.kind === 185 /* InterfaceDeclaration */ || node.kind === 188 /* ModuleDeclaration */ || node.kind === 182 /* FunctionDeclaration */) { + if (node.kind === 187 /* ClassDeclaration */ || node.kind === 190 /* EnumDeclaration */ || node.kind === 188 /* InterfaceDeclaration */ || node.kind === 191 /* ModuleDeclaration */ || node.kind === 185 /* FunctionDeclaration */) { childNodes.push(node); } - else if (node.kind === 159 /* VariableStatement */) { + else if (node.kind === 162 /* VariableStatement */) { childNodes.push.apply(childNodes, node.declarations); } } @@ -28249,7 +16408,7 @@ var ts; return 1; } else if (n2.name) { - -1; + return -1; } else { return n1.kind - n2.kind; @@ -28261,17 +16420,17 @@ var ts; for (var i = 0, n = nodes.length; i < n; i++) { var node = nodes[i]; switch (node.kind) { - case 184 /* ClassDeclaration */: - case 187 /* EnumDeclaration */: - case 185 /* InterfaceDeclaration */: + case 187 /* ClassDeclaration */: + case 190 /* EnumDeclaration */: + case 188 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -28282,12 +16441,12 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 182 /* FunctionDeclaration */) { - if (functionDeclaration.body && functionDeclaration.body.kind === 183 /* FunctionBlock */) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 182 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 185 /* FunctionDeclaration */) { + if (functionDeclaration.body && functionDeclaration.body.kind === 186 /* FunctionBlock */) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 185 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { return true; } - if (functionDeclaration.parent.kind !== 183 /* FunctionBlock */) { + if (functionDeclaration.parent.kind !== 186 /* FunctionBlock */) { return true; } } @@ -28350,7 +16509,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 131 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 192 /* EnumMember */: + case 195 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 129 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -28358,9 +16517,9 @@ var ts; return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); case 124 /* Property */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: if (node.flags & 4096 /* Const */) { return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.constantElement); } @@ -28397,17 +16556,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 193 /* SourceFile */: + case 196 /* SourceFile */: return createSourceFileItem(node); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: return createClassItem(node); - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: return createEnumItem(node); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: return createIterfaceItem(node); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return createModuleItem(node); - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; @@ -28417,7 +16576,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 188 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 191 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -28429,7 +16588,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.name && node.body && node.body.kind === 183 /* FunctionBlock */) { + if (node.name && node.body && node.body.kind === 186 /* FunctionBlock */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -28450,7 +16609,7 @@ var ts; var constructor = ts.forEach(node.members, function (member) { return member.kind === 126 /* Constructor */ && member; }); - var nodes = constructor ? constructor.parameters.concat(node.members) : node.members; + var nodes = constructor ? node.members.concat(constructor.parameters) : node.members; var childItems = getItemsWorker(sortNodes(nodes), createChildItem); } return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); @@ -28465,13 +16624,13 @@ var ts; } } function getInnermostModule(node) { - while (node.body.kind === 188 /* ModuleDeclaration */) { + while (node.body.kind === 191 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 193 /* SourceFile */ ? TypeScript.TextSpan.fromBounds(node.getFullStart(), node.getEnd()) : TypeScript.TextSpan.fromBounds(node.getStart(), node.getEnd()); + return node.kind === 196 /* SourceFile */ ? ts.TextSpan.fromBounds(node.getFullStart(), node.getEnd()) : ts.TextSpan.fromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -28480,106 +16639,6 @@ var ts; NavigationBar.getNavigationBarItems = getNavigationBarItems; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); -var TypeScript; -(function (TypeScript) { - var Indentation; - (function (Indentation) { - function columnForEndOfTokenAtPosition(syntaxTree, position, options) { - var token = TypeScript.findToken(syntaxTree.sourceUnit(), position); - return columnForStartOfTokenAtPosition(syntaxTree, position, options) + TypeScript.width(token); - } - Indentation.columnForEndOfTokenAtPosition = columnForEndOfTokenAtPosition; - function columnForStartOfTokenAtPosition(syntaxTree, position, options) { - var token = TypeScript.findToken(syntaxTree.sourceUnit(), position); - var firstTokenInLine = TypeScript.Syntax.firstTokenInLineContainingPosition(syntaxTree, token.fullStart()); - var leadingTextInReverse = []; - var current = token; - while (current !== firstTokenInLine) { - current = TypeScript.previousToken(current); - if (current === firstTokenInLine) { - leadingTextInReverse.push(current.trailingTrivia().fullText()); - leadingTextInReverse.push(current.text()); - } - else { - leadingTextInReverse.push(current.fullText()); - } - } - collectLeadingTriviaTextToStartOfLine(firstTokenInLine, leadingTextInReverse); - return columnForLeadingTextInReverse(leadingTextInReverse, options); - } - Indentation.columnForStartOfTokenAtPosition = columnForStartOfTokenAtPosition; - function columnForStartOfFirstTokenInLineContainingPosition(syntaxTree, position, options) { - var firstTokenInLine = TypeScript.Syntax.firstTokenInLineContainingPosition(syntaxTree, position); - var leadingTextInReverse = []; - collectLeadingTriviaTextToStartOfLine(firstTokenInLine, leadingTextInReverse); - return columnForLeadingTextInReverse(leadingTextInReverse, options); - } - Indentation.columnForStartOfFirstTokenInLineContainingPosition = columnForStartOfFirstTokenInLineContainingPosition; - function collectLeadingTriviaTextToStartOfLine(firstTokenInLine, leadingTextInReverse) { - var leadingTrivia = firstTokenInLine.leadingTrivia(); - for (var i = leadingTrivia.count() - 1; i >= 0; i--) { - var trivia = leadingTrivia.syntaxTriviaAt(i); - if (trivia.kind() === 3 /* NewLineTrivia */) { - break; - } - if (trivia.kind() === 4 /* MultiLineCommentTrivia */) { - var lineSegments = TypeScript.Syntax.splitMultiLineCommentTriviaIntoMultipleLines(trivia); - leadingTextInReverse.push(TypeScript.ArrayUtilities.last(lineSegments)); - if (lineSegments.length > 0) { - break; - } - } - leadingTextInReverse.push(trivia.fullText()); - } - } - function columnForLeadingTextInReverse(leadingTextInReverse, options) { - var column = 0; - for (var i = leadingTextInReverse.length - 1; i >= 0; i--) { - var text = leadingTextInReverse[i]; - column = columnForPositionInStringWorker(text, text.length, column, options); - } - return column; - } - function columnForPositionInString(input, position, options) { - return columnForPositionInStringWorker(input, position, 0, options); - } - Indentation.columnForPositionInString = columnForPositionInString; - function columnForPositionInStringWorker(input, position, startColumn, options) { - var column = startColumn; - var spacesPerTab = options.spacesPerTab; - for (var j = 0; j < position; j++) { - var ch = input.charCodeAt(j); - if (ch === 9 /* tab */) { - column += spacesPerTab - column % spacesPerTab; - } - else { - column++; - } - } - return column; - } - function indentationString(column, options) { - var numberOfTabs = 0; - var numberOfSpaces = Math.max(0, column); - if (options.useTabs) { - numberOfTabs = Math.floor(column / options.spacesPerTab); - numberOfSpaces -= numberOfTabs * options.spacesPerTab; - } - return TypeScript.StringUtilities.repeat('\t', numberOfTabs) + TypeScript.StringUtilities.repeat(' ', numberOfSpaces); - } - Indentation.indentationString = indentationString; - function firstNonWhitespacePosition(value) { - for (var i = 0; i < value.length; i++) { - var ch = value.charCodeAt(i); - if (!TypeScript.CharacterInfo.isWhitespace(ch)) { - return i; - } - } - return value.length; - } - Indentation.firstNonWhitespacePosition = firstNonWhitespacePosition; - })(Indentation = TypeScript.Indentation || (TypeScript.Indentation = {})); -})(TypeScript || (TypeScript = {})); var ts; (function (ts) { var SignatureHelp; @@ -28604,7 +16663,7 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind !== 144 /* CallExpression */ && node.parent.kind !== 145 /* NewExpression */) { + if (node.parent.kind !== 147 /* CallExpression */ && node.parent.kind !== 148 /* NewExpression */) { return undefined; } var parent = node.parent; @@ -28619,8 +16678,8 @@ var ts; return ts.findListItemInfo(node); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 193 /* SourceFile */; n = n.parent) { - if (n.kind === 183 /* FunctionBlock */) { + for (var n = node; n.kind !== 196 /* SourceFile */; n = n.parent) { + if (n.kind === 186 /* FunctionBlock */) { return undefined; } if (n.pos < n.parent.pos || n.end > n.parent.end) { @@ -28698,7 +16757,7 @@ var ts; }); var applicableSpanStart = argumentListOrTypeArgumentList.getFullStart(); var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentListOrTypeArgumentList.end, false); - var applicableSpan = new TypeScript.TextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + var applicableSpan = new ts.TextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); var argumentIndex = (argumentInfoOrTypeArgumentInfo.listItemIndex + 1) >> 1; var argumentCount = argumentListOrTypeArgumentList.getChildCount() === 0 ? 0 : 1 + ts.countWhere(argumentListOrTypeArgumentList.getChildren(), function (arg) { return arg.kind === 22 /* CommaToken */; }); var selectedItemIndex = candidates.indexOf(bestSignature); @@ -28738,6 +16797,57 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 1); + var lineStarts = sourceFile.getLineStarts(); + var lineIndex = line - 1; + if (lineIndex === lineStarts.length - 1) { + return sourceFile.text.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceFile.text.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 1); + return sourceFile.getLineStarts()[line - 1]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; + function getStartLinePositionForPosition(position, sourceFile) { + var lineStarts = sourceFile.getLineStarts(); + var line = sourceFile.getLineAndCharacterFromPosition(position).line; + return lineStarts[line - 1]; + } + ts.getStartLinePositionForPosition = getStartLinePositionForPosition; + function rangeContainsRange(r1, r2) { + return startEndContainsRange(r1.pos, r1.end, r2); + } + ts.rangeContainsRange = rangeContainsRange; + function startEndContainsRange(start, end, range) { + return start <= range.pos && end >= range.end; + } + ts.startEndContainsRange = startEndContainsRange; + function rangeContainsStartEnd(range, start, end) { + return range.pos <= start && range.end >= end; + } + ts.rangeContainsStartEnd = rangeContainsStartEnd; + function rangeOverlapsWithStartEnd(r1, start, end) { + return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end); + } + ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd; + function startEndOverlapsWithStartEnd(start1, end1, start2, end2) { + var start = Math.max(start1, start2); + var end = Math.min(end1, end2); + return start < end; + } + ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; function findListItemInfo(node) { var syntaxList = findContainingList(node); if (!syntaxList) { @@ -28757,7 +16867,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 195 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 198 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -28765,7 +16875,7 @@ var ts; } ts.findContainingList = findContainingList; function findListItemIndexContainingPosition(list, position) { - ts.Debug.assert(list.kind === 195 /* SyntaxList */); + ts.Debug.assert(list.kind === 198 /* SyntaxList */); var children = list.getChildren(); for (var i = 0; i < children.length; i++) { if (children[i].pos <= position && children[i].end > position) { @@ -28776,11 +16886,11 @@ var ts; } ts.findListItemIndexContainingPosition = findListItemIndexContainingPosition; function getTouchingWord(sourceFile, position) { - return getTouchingToken(sourceFile, position, isWord); + return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); } ts.getTouchingWord = getTouchingWord; function getTouchingPropertyName(sourceFile, position) { - return getTouchingToken(sourceFile, position, isPropertyName); + return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); } ts.getTouchingPropertyName = getTouchingPropertyName; function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { @@ -28872,7 +16982,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 193 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 196 /* SourceFile */); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -28888,19 +16998,16 @@ var ts; } ts.findPrecedingToken = findPrecedingToken; function nodeHasTokens(n) { - if (n.kind === 161 /* ExpressionStatement */) { - return nodeHasTokens(n.expression); - } - if (n.kind === 1 /* EndOfFileToken */ || n.kind === 157 /* OmittedExpression */ || n.kind === 120 /* Missing */) { + if (n.kind === 0 /* Unknown */) { return false; } - return n.kind !== 195 /* SyntaxList */ || n.getChildCount() !== 0; + return n.getWidth() !== 0; } function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 132 /* TypeReference */ || node.kind === 144 /* CallExpression */) { + if (node.kind === 132 /* TypeReference */ || node.kind === 147 /* CallExpression */) { return node.typeArguments; } - if (ts.isAnyFunction(node) || node.kind === 184 /* ClassDeclaration */ || node.kind === 185 /* InterfaceDeclaration */) { + if (ts.isAnyFunction(node) || node.kind === 187 /* ClassDeclaration */ || node.kind === 188 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -28910,1885 +17017,21 @@ var ts; return n.kind >= 1 /* FirstToken */ && n.kind <= 119 /* LastToken */; } ts.isToken = isToken; - function isWord(n) { - return n.kind === 63 /* Identifier */ || ts.isKeyword(n.kind); + function isWord(kind) { + return kind === 63 /* Identifier */ || ts.isKeyword(kind); } - function isPropertyName(n) { - return n.kind === 7 /* StringLiteral */ || n.kind === 6 /* NumericLiteral */ || isWord(n); + function isPropertyName(kind) { + return kind === 7 /* StringLiteral */ || kind === 6 /* NumericLiteral */ || isWord(kind); } - function isComment(n) { - return n.kind === 2 /* SingleLineCommentTrivia */ || n.kind === 3 /* MultiLineCommentTrivia */; + function isComment(kind) { + return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */; } ts.isComment = isComment; - function isPunctuation(n) { - return 13 /* FirstPunctuation */ <= n.kind && n.kind <= 62 /* LastPunctuation */; + function isPunctuation(kind) { + return 13 /* FirstPunctuation */ <= kind && kind <= 62 /* LastPunctuation */; } ts.isPunctuation = isPunctuation; })(ts || (ts = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var TextSnapshot = (function () { - function TextSnapshot(snapshot) { - this.snapshot = snapshot; - this.lines = []; - } - TextSnapshot.prototype.getLength = function () { - return this.snapshot.length(); - }; - TextSnapshot.prototype.getText = function (span) { - return this.snapshot.substr(span.start(), span.length()); - }; - TextSnapshot.prototype.getLineNumberFromPosition = function (position) { - return this.snapshot.lineMap().getLineNumberFromPosition(position); - }; - TextSnapshot.prototype.getLineFromPosition = function (position) { - var lineNumber = this.getLineNumberFromPosition(position); - return this.getLineFromLineNumber(lineNumber); - }; - TextSnapshot.prototype.getLineFromLineNumber = function (lineNumber) { - var line = this.lines[lineNumber]; - if (line === undefined) { - line = this.getLineFromLineNumberWorker(lineNumber); - this.lines[lineNumber] = line; - } - return line; - }; - TextSnapshot.prototype.getLineFromLineNumberWorker = function (lineNumber) { - var lineMap = this.snapshot.lineMap().lineStarts(); - var lineMapIndex = lineNumber; - if (lineMapIndex < 0 || lineMapIndex >= lineMap.length) - throw new Error(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Invalid_line_number_0, [lineMapIndex])); - var start = lineMap[lineMapIndex]; - var end; - var endIncludingLineBreak; - var lineBreak = ""; - if (lineMapIndex == lineMap.length) { - end = endIncludingLineBreak = this.snapshot.length(); - } - else { - endIncludingLineBreak = (lineMapIndex >= lineMap.length - 1 ? this.snapshot.length() : lineMap[lineMapIndex + 1]); - for (var p = endIncludingLineBreak - 1; p >= start; p--) { - var c = this.snapshot.substr(p, 1); - if (c != "\r" && c != "\n") { - break; - } - } - end = p + 1; - lineBreak = this.snapshot.substr(end, endIncludingLineBreak - end); - } - var result = new Formatting.TextSnapshotLine(this, lineNumber, start, end, lineBreak); - return result; - }; - return TextSnapshot; - })(); - Formatting.TextSnapshot = TextSnapshot; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var TextSnapshotLine = (function () { - function TextSnapshotLine(_snapshot, _lineNumber, _start, _end, _lineBreak) { - this._snapshot = _snapshot; - this._lineNumber = _lineNumber; - this._start = _start; - this._end = _end; - this._lineBreak = _lineBreak; - } - TextSnapshotLine.prototype.snapshot = function () { - return this._snapshot; - }; - TextSnapshotLine.prototype.start = function () { - return new Formatting.SnapshotPoint(this._snapshot, this._start); - }; - TextSnapshotLine.prototype.startPosition = function () { - return this._start; - }; - TextSnapshotLine.prototype.end = function () { - return new Formatting.SnapshotPoint(this._snapshot, this._end); - }; - TextSnapshotLine.prototype.endPosition = function () { - return this._end; - }; - TextSnapshotLine.prototype.endIncludingLineBreak = function () { - return new Formatting.SnapshotPoint(this._snapshot, this._end + this._lineBreak.length); - }; - TextSnapshotLine.prototype.endIncludingLineBreakPosition = function () { - return this._end + this._lineBreak.length; - }; - TextSnapshotLine.prototype.length = function () { - return this._end - this._start; - }; - TextSnapshotLine.prototype.lineNumber = function () { - return this._lineNumber; - }; - TextSnapshotLine.prototype.getText = function () { - return this._snapshot.getText(TypeScript.TextSpan.fromBounds(this._start, this._end)); - }; - return TextSnapshotLine; - })(); - Formatting.TextSnapshotLine = TextSnapshotLine; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var SnapshotPoint = (function () { - function SnapshotPoint(snapshot, position) { - this.snapshot = snapshot; - this.position = position; - } - SnapshotPoint.prototype.getContainingLine = function () { - return this.snapshot.getLineFromPosition(this.position); - }; - SnapshotPoint.prototype.add = function (offset) { - return new SnapshotPoint(this.snapshot, this.position + offset); - }; - return SnapshotPoint; - })(); - Formatting.SnapshotPoint = SnapshotPoint; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var FormattingContext = (function () { - function FormattingContext(snapshot, formattingRequestKind) { - this.snapshot = snapshot; - this.formattingRequestKind = formattingRequestKind; - this.currentTokenSpan = null; - this.nextTokenSpan = null; - this.contextNode = null; - this.currentTokenParent = null; - this.nextTokenParent = null; - this.contextNodeAllOnSameLine = null; - this.nextNodeAllOnSameLine = null; - this.tokensAreOnSameLine = null; - this.contextNodeBlockIsOnOneLine = null; - this.nextNodeBlockIsOnOneLine = null; - TypeScript.Debug.assert(this.snapshot != null, "snapshot is null"); - } - FormattingContext.prototype.updateContext = function (currentTokenSpan, currentTokenParent, nextTokenSpan, nextTokenParent, commonParent) { - TypeScript.Debug.assert(currentTokenSpan != null, "currentTokenSpan is null"); - TypeScript.Debug.assert(currentTokenParent != null, "currentTokenParent is null"); - TypeScript.Debug.assert(nextTokenSpan != null, "nextTokenSpan is null"); - TypeScript.Debug.assert(nextTokenParent != null, "nextTokenParent is null"); - TypeScript.Debug.assert(commonParent != null, "commonParent is null"); - this.currentTokenSpan = currentTokenSpan; - this.currentTokenParent = currentTokenParent; - this.nextTokenSpan = nextTokenSpan; - this.nextTokenParent = nextTokenParent; - this.contextNode = commonParent; - this.contextNodeAllOnSameLine = null; - this.nextNodeAllOnSameLine = null; - this.tokensAreOnSameLine = null; - this.contextNodeBlockIsOnOneLine = null; - this.nextNodeBlockIsOnOneLine = null; - }; - FormattingContext.prototype.ContextNodeAllOnSameLine = function () { - if (this.contextNodeAllOnSameLine === null) { - this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode); - } - return this.contextNodeAllOnSameLine; - }; - FormattingContext.prototype.NextNodeAllOnSameLine = function () { - if (this.nextNodeAllOnSameLine === null) { - this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent); - } - return this.nextNodeAllOnSameLine; - }; - FormattingContext.prototype.TokensAreOnSameLine = function () { - if (this.tokensAreOnSameLine === null) { - var startLine = this.snapshot.getLineNumberFromPosition(this.currentTokenSpan.start()); - var endLine = this.snapshot.getLineNumberFromPosition(this.nextTokenSpan.start()); - this.tokensAreOnSameLine = (startLine == endLine); - } - return this.tokensAreOnSameLine; - }; - FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () { - if (this.contextNodeBlockIsOnOneLine === null) { - this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode); - } - return this.contextNodeBlockIsOnOneLine; - }; - FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () { - if (this.nextNodeBlockIsOnOneLine === null) { - this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent); - } - return this.nextNodeBlockIsOnOneLine; - }; - FormattingContext.prototype.NodeIsOnOneLine = function (node) { - var startLine = this.snapshot.getLineNumberFromPosition(node.start()); - var endLine = this.snapshot.getLineNumberFromPosition(node.end()); - return startLine == endLine; - }; - FormattingContext.prototype.BlockIsOnOneLine = function (node) { - var block = node.node(); - return this.snapshot.getLineNumberFromPosition(TypeScript.end(block.openBraceToken)) === this.snapshot.getLineNumberFromPosition(TypeScript.start(block.closeBraceToken)); - }; - return FormattingContext; - })(); - Formatting.FormattingContext = FormattingContext; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var FormattingManager = (function () { - function FormattingManager(syntaxTree, snapshot, rulesProvider, editorOptions) { - this.syntaxTree = syntaxTree; - this.snapshot = snapshot; - this.rulesProvider = rulesProvider; - this.options = new TypeScript.FormattingOptions(!editorOptions.ConvertTabsToSpaces, editorOptions.TabSize, editorOptions.IndentSize, editorOptions.NewLineCharacter); - } - FormattingManager.prototype.formatSelection = function (minChar, limChar) { - var span = TypeScript.TextSpan.fromBounds(minChar, limChar); - return this.formatSpan(span, 1 /* FormatSelection */); - }; - FormattingManager.prototype.formatDocument = function () { - var span = TypeScript.TextSpan.fromBounds(0, this.snapshot.getLength()); - return this.formatSpan(span, 0 /* FormatDocument */); - }; - FormattingManager.prototype.formatOnSemicolon = function (caretPosition) { - var sourceUnit = this.syntaxTree.sourceUnit(); - var semicolonPositionedToken = TypeScript.findToken(sourceUnit, caretPosition - 1); - if (semicolonPositionedToken.kind() === 80 /* SemicolonToken */) { - var current = semicolonPositionedToken; - while (current.parent !== null && TypeScript.end(current.parent) === TypeScript.end(semicolonPositionedToken) && current.parent.kind() !== 1 /* List */) { - current = current.parent; - } - var span = new TypeScript.TextSpan(TypeScript.fullStart(current), TypeScript.fullWidth(current)); - return this.formatSpan(span, 3 /* FormatOnSemicolon */); - } - return []; - }; - FormattingManager.prototype.formatOnClosingCurlyBrace = function (caretPosition) { - var sourceUnit = this.syntaxTree.sourceUnit(); - var closeBracePositionedToken = TypeScript.findToken(sourceUnit, caretPosition - 1); - if (closeBracePositionedToken.kind() === 73 /* CloseBraceToken */) { - var current = closeBracePositionedToken; - while (current.parent !== null && TypeScript.end(current.parent) === TypeScript.end(closeBracePositionedToken) && current.parent.kind() !== 1 /* List */) { - current = current.parent; - } - var span = new TypeScript.TextSpan(TypeScript.fullStart(current), TypeScript.fullWidth(current)); - return this.formatSpan(span, 4 /* FormatOnClosingCurlyBrace */); - } - return []; - }; - FormattingManager.prototype.formatOnEnter = function (caretPosition) { - var lineNumber = this.snapshot.getLineNumberFromPosition(caretPosition); - if (lineNumber > 0) { - var prevLine = this.snapshot.getLineFromLineNumber(lineNumber - 1); - var currentLine = this.snapshot.getLineFromLineNumber(lineNumber); - var span = TypeScript.TextSpan.fromBounds(prevLine.startPosition(), currentLine.endPosition()); - return this.formatSpan(span, 2 /* FormatOnEnter */); - } - return []; - }; - FormattingManager.prototype.formatSpan = function (span, formattingRequestKind) { - var startLine = this.snapshot.getLineFromPosition(span.start()); - span = TypeScript.TextSpan.fromBounds(startLine.startPosition(), span.end()); - var result = []; - var formattingEdits = Formatting.Formatter.getEdits(span, this.syntaxTree.sourceUnit(), this.options, true, this.snapshot, this.rulesProvider, formattingRequestKind); - formattingEdits.forEach(function (item) { - result.push({ - span: new TypeScript.TextSpan(item.position, item.length), - newText: item.replaceWith - }); - }); - return result; - }; - return FormattingManager; - })(); - Formatting.FormattingManager = FormattingManager; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - (function (FormattingRequestKind) { - FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument"; - FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection"; - FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter"; - FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon"; - FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace"; - FormattingRequestKind[FormattingRequestKind["FormatOnPaste"] = 5] = "FormatOnPaste"; - })(Formatting.FormattingRequestKind || (Formatting.FormattingRequestKind = {})); - var FormattingRequestKind = Formatting.FormattingRequestKind; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var Rule = (function () { - function Rule(Descriptor, Operation, Flag) { - if (Flag === void 0) { Flag = 0 /* None */; } - this.Descriptor = Descriptor; - this.Operation = Operation; - this.Flag = Flag; - } - Rule.prototype.toString = function () { - return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; - }; - return Rule; - })(); - Formatting.Rule = Rule; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - (function (RuleAction) { - RuleAction[RuleAction["Ignore"] = 0] = "Ignore"; - RuleAction[RuleAction["Space"] = 1] = "Space"; - RuleAction[RuleAction["NewLine"] = 2] = "NewLine"; - RuleAction[RuleAction["Delete"] = 3] = "Delete"; - })(Formatting.RuleAction || (Formatting.RuleAction = {})); - var RuleAction = Formatting.RuleAction; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var RuleDescriptor = (function () { - function RuleDescriptor(LeftTokenRange, RightTokenRange) { - this.LeftTokenRange = LeftTokenRange; - this.RightTokenRange = RightTokenRange; - } - RuleDescriptor.prototype.toString = function () { - return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; - }; - RuleDescriptor.create1 = function (left, right) { - return RuleDescriptor.create4(Formatting.Shared.TokenRange.FromToken(left), Formatting.Shared.TokenRange.FromToken(right)); - }; - RuleDescriptor.create2 = function (left, right) { - return RuleDescriptor.create4(left, Formatting.Shared.TokenRange.FromToken(right)); - }; - RuleDescriptor.create3 = function (left, right) { - return RuleDescriptor.create4(Formatting.Shared.TokenRange.FromToken(left), right); - }; - RuleDescriptor.create4 = function (left, right) { - return new RuleDescriptor(left, right); - }; - return RuleDescriptor; - })(); - Formatting.RuleDescriptor = RuleDescriptor; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - (function (RuleFlags) { - RuleFlags[RuleFlags["None"] = 0] = "None"; - RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines"; - })(Formatting.RuleFlags || (Formatting.RuleFlags = {})); - var RuleFlags = Formatting.RuleFlags; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var RuleOperation = (function () { - function RuleOperation() { - this.Context = null; - this.Action = null; - } - RuleOperation.prototype.toString = function () { - return "[context=" + this.Context + "," + "action=" + this.Action + "]"; - }; - RuleOperation.create1 = function (action) { - return RuleOperation.create2(Formatting.RuleOperationContext.Any, action); - }; - RuleOperation.create2 = function (context, action) { - var result = new RuleOperation(); - result.Context = context; - result.Action = action; - return result; - }; - return RuleOperation; - })(); - Formatting.RuleOperation = RuleOperation; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var RuleOperationContext = (function () { - function RuleOperationContext() { - var funcs = []; - for (var _i = 0; _i < arguments.length; _i++) { - funcs[_i - 0] = arguments[_i]; - } - this.customContextChecks = funcs; - } - RuleOperationContext.prototype.IsAny = function () { - return this == RuleOperationContext.Any; - }; - RuleOperationContext.prototype.InContext = function (context) { - if (this.IsAny()) { - return true; - } - for (var i = 0, len = this.customContextChecks.length; i < len; i++) { - if (!this.customContextChecks[i](context)) { - return false; - } - } - return true; - }; - RuleOperationContext.Any = new RuleOperationContext(); - return RuleOperationContext; - })(); - Formatting.RuleOperationContext = RuleOperationContext; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var Rules = (function () { - function Rules() { - this.IgnoreBeforeComment = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.Comments), Formatting.RuleOperation.create1(0 /* Ignore */)); - this.IgnoreAfterLineComment = new Formatting.Rule(Formatting.RuleDescriptor.create3(5 /* SingleLineCommentTrivia */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create1(0 /* Ignore */)); - this.NoSpaceBeforeSemicolon = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 80 /* SemicolonToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeColon = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 108 /* ColonToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); - this.NoSpaceBeforeQMark = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 107 /* QuestionToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); - this.SpaceAfterColon = new Formatting.Rule(Formatting.RuleDescriptor.create3(108 /* ColonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 1 /* Space */)); - this.SpaceAfterQMark = new Formatting.Rule(Formatting.RuleDescriptor.create3(107 /* QuestionToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 1 /* Space */)); - this.SpaceAfterSemicolon = new Formatting.Rule(Formatting.RuleDescriptor.create3(80 /* SemicolonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceAfterCloseBrace = new Formatting.Rule(Formatting.RuleDescriptor.create3(73 /* CloseBraceToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 1 /* Space */)); - this.SpaceBetweenCloseBraceAndElse = new Formatting.Rule(Formatting.RuleDescriptor.create1(73 /* CloseBraceToken */, 25 /* ElseKeyword */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceBetweenCloseBraceAndWhile = new Formatting.Rule(Formatting.RuleDescriptor.create1(73 /* CloseBraceToken */, 44 /* WhileKeyword */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceAfterCloseBrace = new Formatting.Rule(Formatting.RuleDescriptor.create3(73 /* CloseBraceToken */, Formatting.Shared.TokenRange.FromTokens([75 /* CloseParenToken */, 77 /* CloseBracketToken */, 81 /* CommaToken */, 80 /* SemicolonToken */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeDot = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 78 /* DotToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterDot = new Formatting.Rule(Formatting.RuleDescriptor.create3(78 /* DotToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeOpenBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 76 /* OpenBracketToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterOpenBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(76 /* OpenBracketToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeCloseBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 77 /* CloseBracketToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterCloseBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(77 /* CloseBracketToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.FunctionOpenBraceLeftTokenRange = Formatting.Shared.TokenRange.AnyIncludingMultilineComments; - this.SpaceBeforeOpenBraceInFunction = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 1 /* Space */), 1 /* CanDeleteNewLines */); - this.TypeScriptOpenBraceLeftTokenRange = Formatting.Shared.TokenRange.FromTokens([9 /* IdentifierName */, 4 /* MultiLineCommentTrivia */]); - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 1 /* Space */), 1 /* CanDeleteNewLines */); - this.ControlOpenBraceLeftTokenRange = Formatting.Shared.TokenRange.FromTokens([75 /* CloseParenToken */, 4 /* MultiLineCommentTrivia */, 24 /* DoKeyword */, 40 /* TryKeyword */, 27 /* FinallyKeyword */, 25 /* ElseKeyword */]); - this.SpaceBeforeOpenBraceInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 1 /* Space */), 1 /* CanDeleteNewLines */); - this.SpaceAfterOpenBrace = new Formatting.Rule(Formatting.RuleDescriptor.create3(72 /* OpenBraceToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 1 /* Space */)); - this.SpaceBeforeCloseBrace = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 73 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 1 /* Space */)); - this.NoSpaceBetweenEmptyBraceBrackets = new Formatting.Rule(Formatting.RuleDescriptor.create1(72 /* OpenBraceToken */, 73 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 3 /* Delete */)); - this.NewLineAfterOpenBraceInBlockContext = new Formatting.Rule(Formatting.RuleDescriptor.create3(72 /* OpenBraceToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 2 /* NewLine */)); - this.NewLineBeforeCloseBraceInBlockContext = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.AnyIncludingMultilineComments, 73 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 2 /* NewLine */)); - this.NoSpaceAfterUnaryPrefixOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.UnaryPrefixOperators, Formatting.Shared.TokenRange.UnaryPrefixExpressions), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); - this.NoSpaceAfterUnaryPreincrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create3(95 /* PlusPlusToken */, Formatting.Shared.TokenRange.UnaryPreincrementExpressions), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterUnaryPredecrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create3(96 /* MinusMinusToken */, Formatting.Shared.TokenRange.UnaryPredecrementExpressions), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeUnaryPostincrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.UnaryPostincrementExpressions, 95 /* PlusPlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 96 /* MinusMinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceAfterPostincrementWhenFollowedByAdd = new Formatting.Rule(Formatting.RuleDescriptor.create1(95 /* PlusPlusToken */, 91 /* PlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new Formatting.Rule(Formatting.RuleDescriptor.create1(91 /* PlusToken */, 91 /* PlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterAddWhenFollowedByPreincrement = new Formatting.Rule(Formatting.RuleDescriptor.create1(91 /* PlusToken */, 95 /* PlusPlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new Formatting.Rule(Formatting.RuleDescriptor.create1(96 /* MinusMinusToken */, 92 /* MinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new Formatting.Rule(Formatting.RuleDescriptor.create1(92 /* MinusToken */, 92 /* MinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new Formatting.Rule(Formatting.RuleDescriptor.create1(92 /* MinusToken */, 96 /* MinusMinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.NoSpaceBeforeComma = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 81 /* CommaToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceAfterCertainKeywords = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.FromTokens([42 /* VarKeyword */, 38 /* ThrowKeyword */, 33 /* NewKeyword */, 23 /* DeleteKeyword */, 35 /* ReturnKeyword */, 41 /* TypeOfKeyword */]), Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncCall = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext), 3 /* Delete */)); - this.SpaceAfterFunctionInFuncDecl = new Formatting.Rule(Formatting.RuleDescriptor.create3(29 /* FunctionKeyword */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 1 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncDecl = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 3 /* Delete */)); - this.SpaceAfterVoidOperator = new Formatting.Rule(Formatting.RuleDescriptor.create3(43 /* VoidKeyword */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 1 /* Space */)); - this.NoSpaceBetweenReturnAndSemicolon = new Formatting.Rule(Formatting.RuleDescriptor.create1(35 /* ReturnKeyword */, 80 /* SemicolonToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceBetweenStatements = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.FromTokens([75 /* CloseParenToken */, 24 /* DoKeyword */, 25 /* ElseKeyword */, 18 /* CaseKeyword */]), Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 1 /* Space */)); - this.SpaceAfterTryFinally = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.FromTokens([40 /* TryKeyword */, 27 /* FinallyKeyword */]), 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceAfterGetSetInMember = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.FromTokens([66 /* GetKeyword */, 70 /* SetKeyword */]), 9 /* IdentifierName */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 1 /* Space */)); - this.SpaceBeforeBinaryKeywordOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.BinaryKeywordOperators), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterBinaryKeywordOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.BinaryKeywordOperators, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.NoSpaceAfterConstructor = new Formatting.Rule(Formatting.RuleDescriptor.create1(64 /* ConstructorKeyword */, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterModuleImport = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.FromTokens([67 /* ModuleKeyword */, 68 /* RequireKeyword */]), 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceAfterCertainTypeScriptKeywords = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.FromTokens([46 /* ClassKeyword */, 65 /* DeclareKeyword */, 48 /* EnumKeyword */, 49 /* ExportKeyword */, 50 /* ExtendsKeyword */, 66 /* GetKeyword */, 53 /* ImplementsKeyword */, 51 /* ImportKeyword */, 54 /* InterfaceKeyword */, 67 /* ModuleKeyword */, 57 /* PrivateKeyword */, 59 /* PublicKeyword */, 70 /* SetKeyword */, 60 /* StaticKeyword */]), Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.FromTokens([50 /* ExtendsKeyword */, 53 /* ImplementsKeyword */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceAfterModuleName = new Formatting.Rule(Formatting.RuleDescriptor.create1(12 /* StringLiteral */, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsModuleDeclContext), 1 /* Space */)); - this.SpaceAfterArrow = new Formatting.Rule(Formatting.RuleDescriptor.create3(87 /* EqualsGreaterThanToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceAfterEllipsis = new Formatting.Rule(Formatting.RuleDescriptor.create1(79 /* DotDotDotToken */, 9 /* IdentifierName */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterOptionalParameters = new Formatting.Rule(Formatting.RuleDescriptor.create3(107 /* QuestionToken */, Formatting.Shared.TokenRange.FromTokens([75 /* CloseParenToken */, 81 /* CommaToken */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); - this.NoSpaceBeforeOpenAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.TypeNames, 82 /* LessThanToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceBetweenCloseParenAndAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create1(75 /* CloseParenToken */, 82 /* LessThanToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceAfterOpenAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(82 /* LessThanToken */, Formatting.Shared.TokenRange.TypeNames), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceBeforeCloseAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 83 /* GreaterThanToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceAfterCloseAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(83 /* GreaterThanToken */, Formatting.Shared.TokenRange.FromTokens([74 /* OpenParenToken */, 76 /* OpenBracketToken */, 83 /* GreaterThanToken */, 81 /* CommaToken */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new Formatting.Rule(Formatting.RuleDescriptor.create1(72 /* OpenBraceToken */, 73 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 3 /* Delete */)); - this.HighPriorityCommonRules = [ - this.IgnoreBeforeComment, - this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, - this.SpaceAfterColon, - this.NoSpaceBeforeQMark, - this.SpaceAfterQMark, - this.NoSpaceBeforeDot, - this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, - this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, - this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, - this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, - this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, - this.SpaceBeforeCloseBrace, - this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, - this.SpaceBetweenCloseBraceAndElse, - this.SpaceBetweenCloseBraceAndWhile, - this.NoSpaceBetweenEmptyBraceBrackets, - this.SpaceAfterFunctionInFuncDecl, - this.NewLineAfterOpenBraceInBlockContext, - this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, - this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.NoSpaceAfterConstructor, - this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, - this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket - ]; - this.LowPriorityCommonRules = [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, - this.SpaceBeforeOpenBraceInFunction, - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, - this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, - this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, - this.SpaceAfterTryFinally - ]; - this.SpaceAfterComma = new Formatting.Rule(Formatting.RuleDescriptor.create3(81 /* CommaToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceAfterComma = new Formatting.Rule(Formatting.RuleDescriptor.create3(81 /* CommaToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceBeforeBinaryOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.BinaryOperators), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterBinaryOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.BinaryOperators, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.NoSpaceBeforeBinaryOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.BinaryOperators), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 3 /* Delete */)); - this.NoSpaceAfterBinaryOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.BinaryOperators, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 3 /* Delete */)); - this.SpaceAfterKeywordInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Keywords, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext), 1 /* Space */)); - this.NoSpaceAfterKeywordInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Keywords, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext), 3 /* Delete */)); - this.NewLineBeforeOpenBraceInFunction = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 2 /* NewLine */), 1 /* CanDeleteNewLines */); - this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 2 /* NewLine */), 1 /* CanDeleteNewLines */); - this.NewLineBeforeOpenBraceInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 2 /* NewLine */), 1 /* CanDeleteNewLines */); - this.SpaceAfterSemicolonInFor = new Formatting.Rule(Formatting.RuleDescriptor.create3(80 /* SemicolonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 1 /* Space */)); - this.NoSpaceAfterSemicolonInFor = new Formatting.Rule(Formatting.RuleDescriptor.create3(80 /* SemicolonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 3 /* Delete */)); - this.SpaceAfterOpenParen = new Formatting.Rule(Formatting.RuleDescriptor.create3(74 /* OpenParenToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceBeforeCloseParen = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 75 /* CloseParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceBetweenParens = new Formatting.Rule(Formatting.RuleDescriptor.create1(74 /* OpenParenToken */, 75 /* CloseParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterOpenParen = new Formatting.Rule(Formatting.RuleDescriptor.create3(74 /* OpenParenToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeCloseParen = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 75 /* CloseParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceAfterAnonymousFunctionKeyword = new Formatting.Rule(Formatting.RuleDescriptor.create1(29 /* FunctionKeyword */, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 1 /* Space */)); - this.NoSpaceAfterAnonymousFunctionKeyword = new Formatting.Rule(Formatting.RuleDescriptor.create1(29 /* FunctionKeyword */, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 3 /* Delete */)); - } - Rules.prototype.getRuleName = function (rule) { - var o = this; - for (var name in o) { - if (o[name] === rule) { - return name; - } - } - throw new Error(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Unknown_rule, null)); - }; - Rules.IsForContext = function (context) { - return context.contextNode.kind() === 159 /* ForStatement */; - }; - Rules.IsNotForContext = function (context) { - return !Rules.IsForContext(context); - }; - Rules.IsBinaryOpContext = function (context) { - switch (context.contextNode.kind()) { - case 174 /* BinaryExpression */: - case 173 /* ConditionalExpression */: - return true; - case 138 /* ImportDeclaration */: - case 191 /* VariableDeclarator */: - case 197 /* EqualsValueClause */: - return context.currentTokenSpan.kind === 109 /* EqualsToken */ || context.nextTokenSpan.kind === 109 /* EqualsToken */; - case 160 /* ForInStatement */: - return context.currentTokenSpan.kind === 31 /* InKeyword */ || context.nextTokenSpan.kind === 31 /* InKeyword */; - } - return false; - }; - Rules.IsNotBinaryOpContext = function (context) { - return !Rules.IsBinaryOpContext(context); - }; - Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { - return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); - }; - Rules.IsBeforeMultilineBlockContext = function (context) { - return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); - }; - Rules.IsMultilineBlockContext = function (context) { - return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); - }; - Rules.IsSingleLineBlockContext = function (context) { - return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); - }; - Rules.IsBlockContext = function (context) { - return Rules.NodeIsBlockContext(context.contextNode); - }; - Rules.IsBeforeBlockContext = function (context) { - return Rules.NodeIsBlockContext(context.nextTokenParent); - }; - Rules.NodeIsBlockContext = function (node) { - if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) { - return true; - } - switch (node.kind()) { - case 151 /* Block */: - case 156 /* SwitchStatement */: - case 179 /* ObjectLiteralExpression */: - return true; - } - return false; - }; - Rules.IsFunctionDeclContext = function (context) { - switch (context.contextNode.kind()) { - case 134 /* FunctionDeclaration */: - case 140 /* MemberFunctionDeclaration */: - case 144 /* GetAccessor */: - case 145 /* SetAccessor */: - case 150 /* MethodSignature */: - case 147 /* CallSignature */: - case 186 /* FunctionExpression */: - case 142 /* ConstructorDeclaration */: - case 183 /* SimpleArrowFunctionExpression */: - case 182 /* ParenthesizedArrowFunctionExpression */: - case 133 /* InterfaceDeclaration */: - return true; - } - return false; - }; - Rules.IsTypeScriptDeclWithBlockContext = function (context) { - return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); - }; - Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { - switch (node.kind()) { - case 136 /* ClassDeclaration */: - case 137 /* EnumDeclaration */: - case 124 /* ObjectType */: - case 135 /* ModuleDeclaration */: - return true; - } - return false; - }; - Rules.IsAfterCodeBlockContext = function (context) { - switch (context.currentTokenParent.kind()) { - case 136 /* ClassDeclaration */: - case 135 /* ModuleDeclaration */: - case 137 /* EnumDeclaration */: - case 151 /* Block */: - case 156 /* SwitchStatement */: - return true; - } - return false; - }; - Rules.IsControlDeclContext = function (context) { - switch (context.contextNode.kind()) { - case 152 /* IfStatement */: - case 156 /* SwitchStatement */: - case 159 /* ForStatement */: - case 160 /* ForInStatement */: - case 163 /* WhileStatement */: - case 164 /* TryStatement */: - case 166 /* DoStatement */: - case 168 /* WithStatement */: - case 200 /* ElseClause */: - case 201 /* CatchClause */: - case 202 /* FinallyClause */: - return true; - default: - return false; - } - }; - Rules.IsObjectContext = function (context) { - return context.contextNode.kind() === 179 /* ObjectLiteralExpression */; - }; - Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind() === 177 /* InvocationExpression */; - }; - Rules.IsNewContext = function (context) { - return context.contextNode.kind() === 180 /* ObjectCreationExpression */; - }; - Rules.IsFunctionCallOrNewContext = function (context) { - return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); - }; - Rules.IsSameLineTokenContext = function (context) { - return context.TokensAreOnSameLine(); - }; - Rules.IsNotFormatOnEnter = function (context) { - return context.formattingRequestKind != 2 /* FormatOnEnter */; - }; - Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind() === 135 /* ModuleDeclaration */; - }; - Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind() === 124 /* ObjectType */ && context.contextNode.parent().kind() !== 133 /* InterfaceDeclaration */; - }; - Rules.IsTypeArgumentOrParameter = function (tokenKind, parentKind) { - return ((tokenKind === 82 /* LessThanToken */ || tokenKind === 83 /* GreaterThanToken */) && (parentKind === 195 /* TypeParameterList */ || parentKind === 194 /* TypeArgumentList */)); - }; - Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan.kind, context.currentTokenParent.kind()) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan.kind, context.nextTokenParent.kind()); - }; - Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 43 /* VoidKeyword */ && context.currentTokenParent.kind() === 172 /* VoidExpression */; - }; - return Rules; - })(); - Formatting.Rules = Rules; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var RulesMap = (function () { - function RulesMap() { - this.map = []; - this.mapRowLength = 0; - } - RulesMap.create = function (rules) { - var result = new RulesMap(); - result.Initialize(rules); - return result; - }; - RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = TypeScript.SyntaxKind.LastToken + 1; - this.map = new Array(this.mapRowLength * this.mapRowLength); - var rulesBucketConstructionStateList = new Array(this.map.length); - this.FillRules(rules, rulesBucketConstructionStateList); - return this.map; - }; - RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) { - var _this = this; - rules.forEach(function (rule) { - _this.FillRule(rule, rulesBucketConstructionStateList); - }); - }; - RulesMap.prototype.GetRuleBucketIndex = function (row, column) { - var rulesBucketIndex = (row * this.mapRowLength) + column; - return rulesBucketIndex; - }; - RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { - var _this = this; - var specificRule = rule.Descriptor.LeftTokenRange != Formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != Formatting.Shared.TokenRange.Any; - rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { - rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { - var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); - var rulesBucket = _this.map[rulesBucketIndex]; - if (rulesBucket == undefined) { - rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket(); - } - rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex); - }); - }); - }; - RulesMap.prototype.GetRule = function (context) { - var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); - var bucket = this.map[bucketIndex]; - if (bucket != null) { - for (var i = 0, len = bucket.Rules().length; i < len; i++) { - var rule = bucket.Rules()[i]; - if (rule.Operation.Context.InContext(context)) - return rule; - } - } - return null; - }; - return RulesMap; - })(); - Formatting.RulesMap = RulesMap; - var MaskBitSize = 5; - var Mask = 0x1f; - (function (RulesPosition) { - RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; - RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny"; - RulesPosition[RulesPosition["ContextRulesSpecific"] = MaskBitSize * 2] = "ContextRulesSpecific"; - RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny"; - RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific"; - RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny"; - })(Formatting.RulesPosition || (Formatting.RulesPosition = {})); - var RulesPosition = Formatting.RulesPosition; - var RulesBucketConstructionState = (function () { - function RulesBucketConstructionState() { - this.rulesInsertionIndexBitmap = 0; - } - RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) { - var index = 0; - var pos = 0; - var indexBitmap = this.rulesInsertionIndexBitmap; - while (pos <= maskPosition) { - index += (indexBitmap & Mask); - indexBitmap >>= MaskBitSize; - pos += MaskBitSize; - } - return index; - }; - RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) { - var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask; - value++; - TypeScript.Debug.assert((value & Mask) == value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."); - var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition); - temp |= value << maskPosition; - this.rulesInsertionIndexBitmap = temp; - }; - return RulesBucketConstructionState; - })(); - Formatting.RulesBucketConstructionState = RulesBucketConstructionState; - var RulesBucket = (function () { - function RulesBucket() { - this.rules = []; - } - RulesBucket.prototype.Rules = function () { - return this.rules; - }; - RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { - var position; - if (rule.Operation.Action == 0 /* Ignore */) { - position = specificTokens ? 0 /* IgnoreRulesSpecific */ : RulesPosition.IgnoreRulesAny; - } - else if (!rule.Operation.Context.IsAny()) { - position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; - } - else { - position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; - } - var state = constructionState[rulesBucketIndex]; - if (state === undefined) { - state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState(); - } - var index = state.GetInsertionIndex(position); - this.rules.splice(index, 0, rule); - state.IncreaseInsertionIndex(position); - }; - return RulesBucket; - })(); - Formatting.RulesBucket = RulesBucket; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var RulesProvider = (function () { - function RulesProvider(logger) { - this.logger = logger; - this.globalRules = new Formatting.Rules(); - } - RulesProvider.prototype.getRuleName = function (rule) { - return this.globalRules.getRuleName(rule); - }; - RulesProvider.prototype.getRuleByName = function (name) { - return this.globalRules[name]; - }; - RulesProvider.prototype.getRulesMap = function () { - return this.rulesMap; - }; - RulesProvider.prototype.ensureUpToDate = function (options) { - if (this.options == null || !ts.compareDataObjects(this.options, options)) { - var activeRules = this.createActiveRules(options); - var rulesMap = Formatting.RulesMap.create(activeRules); - this.activeRules = activeRules; - this.rulesMap = rulesMap; - this.options = ts.clone(options); - } - }; - RulesProvider.prototype.createActiveRules = function (options) { - var rules = this.globalRules.HighPriorityCommonRules.slice(0); - if (options.InsertSpaceAfterCommaDelimiter) { - rules.push(this.globalRules.SpaceAfterComma); - } - else { - rules.push(this.globalRules.NoSpaceAfterComma); - } - if (options.InsertSpaceAfterFunctionKeywordForAnonymousFunctions) { - rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword); - } - else { - rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword); - } - if (options.InsertSpaceAfterKeywordsInControlFlowStatements) { - rules.push(this.globalRules.SpaceAfterKeywordInControl); - } - else { - rules.push(this.globalRules.NoSpaceAfterKeywordInControl); - } - if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) { - rules.push(this.globalRules.SpaceAfterOpenParen); - rules.push(this.globalRules.SpaceBeforeCloseParen); - rules.push(this.globalRules.NoSpaceBetweenParens); - } - else { - rules.push(this.globalRules.NoSpaceAfterOpenParen); - rules.push(this.globalRules.NoSpaceBeforeCloseParen); - rules.push(this.globalRules.NoSpaceBetweenParens); - } - if (options.InsertSpaceAfterSemicolonInForStatements) { - rules.push(this.globalRules.SpaceAfterSemicolonInFor); - } - else { - rules.push(this.globalRules.NoSpaceAfterSemicolonInFor); - } - if (options.InsertSpaceBeforeAndAfterBinaryOperators) { - rules.push(this.globalRules.SpaceBeforeBinaryOperator); - rules.push(this.globalRules.SpaceAfterBinaryOperator); - } - else { - rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); - rules.push(this.globalRules.NoSpaceAfterBinaryOperator); - } - if (options.PlaceOpenBraceOnNewLineForControlBlocks) { - rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); - } - if (options.PlaceOpenBraceOnNewLineForFunctions) { - rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction); - rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock); - } - rules = rules.concat(this.globalRules.LowPriorityCommonRules); - return rules; - }; - return RulesProvider; - })(); - Formatting.RulesProvider = RulesProvider; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var TextEditInfo = (function () { - function TextEditInfo(position, length, replaceWith) { - this.position = position; - this.length = length; - this.replaceWith = replaceWith; - } - TextEditInfo.prototype.toString = function () { - return "[ position: " + this.position + ", length: " + this.length + ", replaceWith: '" + this.replaceWith + "' ]"; - }; - return TextEditInfo; - })(); - Formatting.TextEditInfo = TextEditInfo; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var Shared; - (function (Shared) { - var TokenRangeAccess = (function () { - function TokenRangeAccess(from, to, except) { - this.tokens = []; - for (var token = from; token <= to; token++) { - if (except.indexOf(token) < 0) { - this.tokens.push(token); - } - } - } - TokenRangeAccess.prototype.GetTokens = function () { - return this.tokens; - }; - TokenRangeAccess.prototype.Contains = function (token) { - return this.tokens.indexOf(token) >= 0; - }; - TokenRangeAccess.prototype.toString = function () { - return "[tokenRangeStart=" + TypeScript.SyntaxKind[this.tokens[0]] + "," + "tokenRangeEnd=" + TypeScript.SyntaxKind[this.tokens[this.tokens.length - 1]] + "]"; - }; - return TokenRangeAccess; - })(); - Shared.TokenRangeAccess = TokenRangeAccess; - var TokenValuesAccess = (function () { - function TokenValuesAccess(tks) { - this.tokens = tks && tks.length ? tks : []; - } - TokenValuesAccess.prototype.GetTokens = function () { - return this.tokens; - }; - TokenValuesAccess.prototype.Contains = function (token) { - return this.tokens.indexOf(token) >= 0; - }; - return TokenValuesAccess; - })(); - Shared.TokenValuesAccess = TokenValuesAccess; - var TokenSingleValueAccess = (function () { - function TokenSingleValueAccess(token) { - this.token = token; - } - TokenSingleValueAccess.prototype.GetTokens = function () { - return [this.token]; - }; - TokenSingleValueAccess.prototype.Contains = function (tokenValue) { - return tokenValue == this.token; - }; - TokenSingleValueAccess.prototype.toString = function () { - return "[singleTokenKind=" + TypeScript.SyntaxKind[this.token] + "]"; - }; - return TokenSingleValueAccess; - })(); - Shared.TokenSingleValueAccess = TokenSingleValueAccess; - var TokenAllAccess = (function () { - function TokenAllAccess() { - } - TokenAllAccess.prototype.GetTokens = function () { - var result = []; - for (var token = TypeScript.SyntaxKind.FirstToken; token <= TypeScript.SyntaxKind.LastToken; token++) { - result.push(token); - } - return result; - }; - TokenAllAccess.prototype.Contains = function (tokenValue) { - return true; - }; - TokenAllAccess.prototype.toString = function () { - return "[allTokens]"; - }; - return TokenAllAccess; - })(); - Shared.TokenAllAccess = TokenAllAccess; - var TokenRange = (function () { - function TokenRange(tokenAccess) { - this.tokenAccess = tokenAccess; - } - TokenRange.FromToken = function (token) { - return new TokenRange(new TokenSingleValueAccess(token)); - }; - TokenRange.FromTokens = function (tokens) { - return new TokenRange(new TokenValuesAccess(tokens)); - }; - TokenRange.FromRange = function (f, to, except) { - if (except === void 0) { except = []; } - return new TokenRange(new TokenRangeAccess(f, to, except)); - }; - TokenRange.AllTokens = function () { - return new TokenRange(new TokenAllAccess()); - }; - TokenRange.prototype.GetTokens = function () { - return this.tokenAccess.GetTokens(); - }; - TokenRange.prototype.Contains = function (token) { - return this.tokenAccess.Contains(token); - }; - TokenRange.prototype.toString = function () { - return this.tokenAccess.toString(); - }; - TokenRange.Any = TokenRange.AllTokens(); - TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([4 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(TypeScript.SyntaxKind.FirstKeyword, TypeScript.SyntaxKind.LastKeyword); - TokenRange.Operators = TokenRange.FromRange(80 /* SemicolonToken */, 121 /* SlashEqualsToken */); - TokenRange.BinaryOperators = TokenRange.FromRange(82 /* LessThanToken */, 121 /* SlashEqualsToken */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([31 /* InKeyword */, 32 /* InstanceOfKeyword */]); - TokenRange.ReservedKeywords = TokenRange.FromRange(TypeScript.SyntaxKind.FirstFutureReservedStrictKeyword, TypeScript.SyntaxKind.LastFutureReservedStrictKeyword); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([95 /* PlusPlusToken */, 96 /* MinusMinusToken */, 104 /* TildeToken */, 103 /* ExclamationToken */]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([11 /* NumericLiteral */, 9 /* IdentifierName */, 74 /* OpenParenToken */, 76 /* OpenBracketToken */, 72 /* OpenBraceToken */, 37 /* ThisKeyword */, 33 /* NewKeyword */]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([9 /* IdentifierName */, 74 /* OpenParenToken */, 37 /* ThisKeyword */, 33 /* NewKeyword */]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([9 /* IdentifierName */, 75 /* CloseParenToken */, 77 /* CloseBracketToken */, 33 /* NewKeyword */]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([9 /* IdentifierName */, 74 /* OpenParenToken */, 37 /* ThisKeyword */, 33 /* NewKeyword */]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([9 /* IdentifierName */, 75 /* CloseParenToken */, 77 /* CloseBracketToken */, 33 /* NewKeyword */]); - TokenRange.Comments = TokenRange.FromTokens([5 /* SingleLineCommentTrivia */, 4 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([9 /* IdentifierName */, 69 /* NumberKeyword */, 71 /* StringKeyword */, 63 /* BooleanKeyword */, 43 /* VoidKeyword */, 62 /* AnyKeyword */]); - return TokenRange; - })(); - Shared.TokenRange = TokenRange; - })(Shared = Formatting.Shared || (Formatting.Shared = {})); - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var TokenSpan = (function (_super) { - __extends(TokenSpan, _super); - function TokenSpan(kind, start, length) { - _super.call(this, start, length); - this.kind = kind; - } - return TokenSpan; - })(TypeScript.TextSpan); - Formatting.TokenSpan = TokenSpan; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var IndentationNodeContext = (function () { - function IndentationNodeContext(parent, node, fullStart, indentationAmount, childIndentationAmountDelta) { - this.update(parent, node, fullStart, indentationAmount, childIndentationAmountDelta); - } - IndentationNodeContext.prototype.parent = function () { - return this._parent; - }; - IndentationNodeContext.prototype.node = function () { - return this._node; - }; - IndentationNodeContext.prototype.fullStart = function () { - return this._fullStart; - }; - IndentationNodeContext.prototype.fullWidth = function () { - return TypeScript.fullWidth(this._node); - }; - IndentationNodeContext.prototype.start = function () { - return this._fullStart + TypeScript.leadingTriviaWidth(this._node); - }; - IndentationNodeContext.prototype.end = function () { - return this._fullStart + TypeScript.leadingTriviaWidth(this._node) + TypeScript.width(this._node); - }; - IndentationNodeContext.prototype.indentationAmount = function () { - return this._indentationAmount; - }; - IndentationNodeContext.prototype.childIndentationAmountDelta = function () { - return this._childIndentationAmountDelta; - }; - IndentationNodeContext.prototype.depth = function () { - return this._depth; - }; - IndentationNodeContext.prototype.kind = function () { - return this._node.kind(); - }; - IndentationNodeContext.prototype.hasSkippedOrMissingTokenChild = function () { - if (this._hasSkippedOrMissingTokenChild === null) { - this._hasSkippedOrMissingTokenChild = TypeScript.Syntax.nodeHasSkippedOrMissingTokens(this._node); - } - return this._hasSkippedOrMissingTokenChild; - }; - IndentationNodeContext.prototype.clone = function (pool) { - var parent = null; - if (this._parent) { - parent = this._parent.clone(pool); - } - return pool.getNode(parent, this._node, this._fullStart, this._indentationAmount, this._childIndentationAmountDelta); - }; - IndentationNodeContext.prototype.update = function (parent, node, fullStart, indentationAmount, childIndentationAmountDelta) { - this._parent = parent; - this._node = node; - this._fullStart = fullStart; - this._indentationAmount = indentationAmount; - this._childIndentationAmountDelta = childIndentationAmountDelta; - this._hasSkippedOrMissingTokenChild = null; - if (parent) { - this._depth = parent.depth() + 1; - } - else { - this._depth = 0; - } - }; - return IndentationNodeContext; - })(); - Formatting.IndentationNodeContext = IndentationNodeContext; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var IndentationNodeContextPool = (function () { - function IndentationNodeContextPool() { - this.nodes = []; - } - IndentationNodeContextPool.prototype.getNode = function (parent, node, fullStart, indentationLevel, childIndentationLevelDelta) { - if (this.nodes.length > 0) { - var cachedNode = this.nodes.pop(); - cachedNode.update(parent, node, fullStart, indentationLevel, childIndentationLevelDelta); - return cachedNode; - } - return new Formatting.IndentationNodeContext(parent, node, fullStart, indentationLevel, childIndentationLevelDelta); - }; - IndentationNodeContextPool.prototype.releaseNode = function (node, recursive) { - if (recursive === void 0) { recursive = false; } - this.nodes.push(node); - if (recursive) { - var parent = node.parent(); - if (parent) { - this.releaseNode(parent, recursive); - } - } - }; - return IndentationNodeContextPool; - })(); - Formatting.IndentationNodeContextPool = IndentationNodeContextPool; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var IndentationTrackingWalker = (function () { - function IndentationTrackingWalker(textSpan, sourceUnit, snapshot, indentFirstToken, options) { - this.options = options; - this._position = 0; - this._parent = null; - this._indentationNodeContextPool = new Formatting.IndentationNodeContextPool(); - this._textSpan = textSpan; - this._text = sourceUnit.syntaxTree.text; - this._snapshot = snapshot; - this._parent = this._indentationNodeContextPool.getNode(null, sourceUnit, 0, 0, 0); - this._lastTriviaWasNewLine = indentFirstToken; - } - IndentationTrackingWalker.prototype.position = function () { - return this._position; - }; - IndentationTrackingWalker.prototype.parent = function () { - return this._parent; - }; - IndentationTrackingWalker.prototype.textSpan = function () { - return this._textSpan; - }; - IndentationTrackingWalker.prototype.snapshot = function () { - return this._snapshot; - }; - IndentationTrackingWalker.prototype.indentationNodeContextPool = function () { - return this._indentationNodeContextPool; - }; - IndentationTrackingWalker.prototype.forceIndentNextToken = function (tokenStart) { - this._lastTriviaWasNewLine = true; - this.forceRecomputeIndentationOfParent(tokenStart, true); - }; - IndentationTrackingWalker.prototype.forceSkipIndentingNextToken = function (tokenStart) { - this._lastTriviaWasNewLine = false; - this.forceRecomputeIndentationOfParent(tokenStart, false); - }; - IndentationTrackingWalker.prototype.indentToken = function (token, indentationAmount, commentIndentationAmount) { - throw TypeScript.Errors.abstract(); - }; - IndentationTrackingWalker.prototype.visitTokenInSpan = function (token) { - if (this._lastTriviaWasNewLine) { - var indentationAmount = this.getTokenIndentationAmount(token); - var commentIndentationAmount = this.getCommentIndentationAmount(token); - this.indentToken(token, indentationAmount, commentIndentationAmount); - } - }; - IndentationTrackingWalker.prototype.visitToken = function (token) { - var tokenSpan = new TypeScript.TextSpan(this._position, token.fullWidth()); - if (tokenSpan.intersectsWithTextSpan(this._textSpan)) { - this.visitTokenInSpan(token); - var trivia = token.trailingTrivia(); - this._lastTriviaWasNewLine = trivia.hasNewLine() && trivia.syntaxTriviaAt(trivia.count() - 1).kind() == 3 /* NewLineTrivia */; - } - this._position += token.fullWidth(); - }; - IndentationTrackingWalker.prototype.walk = function (element) { - if (element) { - if (TypeScript.isToken(element)) { - this.visitToken(element); - } - else if (element.kind() === 1 /* List */) { - for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { - this.walk(TypeScript.childAt(element, i)); - } - } - else { - this.visitNode(element); - } - } - }; - IndentationTrackingWalker.prototype.visitNode = function (node) { - var nodeSpan = new TypeScript.TextSpan(this._position, TypeScript.fullWidth(node)); - if (nodeSpan.intersectsWithTextSpan(this._textSpan)) { - var indentation = this.getNodeIndentation(node); - var currentParent = this._parent; - this._parent = this._indentationNodeContextPool.getNode(currentParent, node, this._position, indentation.indentationAmount, indentation.indentationAmountDelta); - for (var i = 0, n = TypeScript.childCount(node); i < n; i++) { - this.walk(TypeScript.childAt(node, i)); - } - this._indentationNodeContextPool.releaseNode(this._parent); - this._parent = currentParent; - } - else { - this._position += TypeScript.fullWidth(node); - } - }; - IndentationTrackingWalker.prototype.getTokenIndentationAmount = function (token) { - if (TypeScript.firstToken(this._parent.node()) === token || token.kind() === 72 /* OpenBraceToken */ || token.kind() === 73 /* CloseBraceToken */ || token.kind() === 76 /* OpenBracketToken */ || token.kind() === 77 /* CloseBracketToken */ || (token.kind() === 44 /* WhileKeyword */ && this._parent.node().kind() == 166 /* DoStatement */)) { - return this._parent.indentationAmount(); - } - return (this._parent.indentationAmount() + this._parent.childIndentationAmountDelta()); - }; - IndentationTrackingWalker.prototype.getCommentIndentationAmount = function (token) { - if (token.kind() === 73 /* CloseBraceToken */ || token.kind() === 77 /* CloseBracketToken */) { - return (this._parent.indentationAmount() + this._parent.childIndentationAmountDelta()); - } - return this._parent.indentationAmount(); - }; - IndentationTrackingWalker.prototype.getNodeIndentation = function (node, newLineInsertedByFormatting) { - var parent = this._parent; - var parentIndentationAmount; - if (this._textSpan.containsPosition(parent.start())) { - parentIndentationAmount = parent.indentationAmount(); - } - else { - if (parent.kind() === 151 /* Block */ && !this.shouldIndentBlockInParent(this._parent.parent())) { - parent = this._parent.parent(); - } - var line = this._snapshot.getLineFromPosition(parent.start()).getText(); - var firstNonWhiteSpacePosition = TypeScript.Indentation.firstNonWhitespacePosition(line); - parentIndentationAmount = TypeScript.Indentation.columnForPositionInString(line, firstNonWhiteSpacePosition, this.options); - } - var parentIndentationAmountDelta = parent.childIndentationAmountDelta(); - var indentationAmount; - var indentationAmountDelta; - var parentNode = parent.node(); - switch (node.kind()) { - default: - indentationAmount = (parentIndentationAmount + parentIndentationAmountDelta); - indentationAmountDelta = 0; - break; - case 136 /* ClassDeclaration */: - case 135 /* ModuleDeclaration */: - case 124 /* ObjectType */: - case 137 /* EnumDeclaration */: - case 156 /* SwitchStatement */: - case 179 /* ObjectLiteralExpression */: - case 142 /* ConstructorDeclaration */: - case 134 /* FunctionDeclaration */: - case 186 /* FunctionExpression */: - case 140 /* MemberFunctionDeclaration */: - case 144 /* GetAccessor */: - case 145 /* SetAccessor */: - case 143 /* IndexMemberDeclaration */: - case 201 /* CatchClause */: - case 178 /* ArrayLiteralExpression */: - case 126 /* ArrayType */: - case 185 /* ElementAccessExpression */: - case 149 /* IndexSignature */: - case 159 /* ForStatement */: - case 160 /* ForInStatement */: - case 163 /* WhileStatement */: - case 166 /* DoStatement */: - case 168 /* WithStatement */: - case 198 /* CaseSwitchClause */: - case 199 /* DefaultSwitchClause */: - case 155 /* ReturnStatement */: - case 162 /* ThrowStatement */: - case 183 /* SimpleArrowFunctionExpression */: - case 182 /* ParenthesizedArrowFunctionExpression */: - case 190 /* VariableDeclaration */: - case 139 /* ExportAssignment */: - case 177 /* InvocationExpression */: - case 180 /* ObjectCreationExpression */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - indentationAmount = (parentIndentationAmount + parentIndentationAmountDelta); - indentationAmountDelta = this.options.indentSpaces; - break; - case 152 /* IfStatement */: - if (parent.kind() === 200 /* ElseClause */ && !TypeScript.SyntaxUtilities.isLastTokenOnLine(parentNode.elseKeyword, this._text)) { - indentationAmount = parentIndentationAmount; - } - else { - indentationAmount = (parentIndentationAmount + parentIndentationAmountDelta); - } - indentationAmountDelta = this.options.indentSpaces; - break; - case 200 /* ElseClause */: - indentationAmount = parentIndentationAmount; - indentationAmountDelta = this.options.indentSpaces; - break; - case 151 /* Block */: - if (this.shouldIndentBlockInParent(parent)) { - indentationAmount = parentIndentationAmount + parentIndentationAmountDelta; - } - else { - indentationAmount = parentIndentationAmount; - } - indentationAmountDelta = this.options.indentSpaces; - break; - } - if (parentNode) { - if (!newLineInsertedByFormatting) { - var parentStartLine = this._snapshot.getLineNumberFromPosition(parent.start()); - var currentNodeStartLine = this._snapshot.getLineNumberFromPosition(this._position + TypeScript.leadingTriviaWidth(node)); - if (parentStartLine === currentNodeStartLine || newLineInsertedByFormatting === false) { - indentationAmount = parentIndentationAmount; - indentationAmountDelta = Math.min(this.options.indentSpaces, parentIndentationAmountDelta + indentationAmountDelta); - } - } - } - return { - indentationAmount: indentationAmount, - indentationAmountDelta: indentationAmountDelta - }; - }; - IndentationTrackingWalker.prototype.shouldIndentBlockInParent = function (parent) { - switch (parent.kind()) { - case 122 /* SourceUnit */: - case 135 /* ModuleDeclaration */: - case 151 /* Block */: - case 198 /* CaseSwitchClause */: - case 199 /* DefaultSwitchClause */: - return true; - default: - return false; - } - }; - IndentationTrackingWalker.prototype.forceRecomputeIndentationOfParent = function (tokenStart, newLineAdded) { - var parent = this._parent; - if (parent.fullStart() === tokenStart) { - this._parent = parent.parent(); - var indentation = this.getNodeIndentation(parent.node(), newLineAdded); - parent.update(parent.parent(), parent.node(), parent.fullStart(), indentation.indentationAmount, indentation.indentationAmountDelta); - this._parent = parent; - } - }; - return IndentationTrackingWalker; - })(); - Formatting.IndentationTrackingWalker = IndentationTrackingWalker; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var MultipleTokenIndenter = (function (_super) { - __extends(MultipleTokenIndenter, _super); - function MultipleTokenIndenter(textSpan, sourceUnit, snapshot, indentFirstToken, options) { - _super.call(this, textSpan, sourceUnit, snapshot, indentFirstToken, options); - this._edits = []; - } - MultipleTokenIndenter.prototype.indentToken = function (token, indentationAmount, commentIndentationAmount) { - if (token.fullWidth() === 0) { - return; - } - if (this.parent().hasSkippedOrMissingTokenChild()) { - return; - } - var tokenSpan = new TypeScript.TextSpan(this.position() + token.leadingTriviaWidth(), TypeScript.width(token)); - if (!this.textSpan().containsTextSpan(tokenSpan)) { - return; - } - var indentationString = TypeScript.Indentation.indentationString(indentationAmount, this.options); - var commentIndentationString = TypeScript.Indentation.indentationString(commentIndentationAmount, this.options); - this.recordIndentationEditsForToken(token, indentationString, commentIndentationString); - }; - MultipleTokenIndenter.prototype.edits = function () { - return this._edits; - }; - MultipleTokenIndenter.prototype.recordEdit = function (position, length, replaceWith) { - this._edits.push(new Formatting.TextEditInfo(position, length, replaceWith)); - }; - MultipleTokenIndenter.prototype.recordIndentationEditsForToken = function (token, indentationString, commentIndentationString) { - var position = this.position(); - var indentNextTokenOrTrivia = true; - var leadingWhiteSpace = ""; - var triviaList = token.leadingTrivia(); - if (triviaList) { - for (var i = 0, length = triviaList.count(); i < length; i++, position += trivia.fullWidth()) { - var trivia = triviaList.syntaxTriviaAt(i); - if (!this.textSpan().containsTextSpan(new TypeScript.TextSpan(position, trivia.fullWidth()))) { - continue; - } - switch (trivia.kind()) { - case 4 /* MultiLineCommentTrivia */: - this.recordIndentationEditsForMultiLineComment(trivia, position, commentIndentationString, leadingWhiteSpace, !indentNextTokenOrTrivia); - indentNextTokenOrTrivia = false; - leadingWhiteSpace = ""; - break; - case 5 /* SingleLineCommentTrivia */: - case 6 /* SkippedTokenTrivia */: - if (indentNextTokenOrTrivia) { - this.recordIndentationEditsForSingleLineOrSkippedText(trivia, position, commentIndentationString); - indentNextTokenOrTrivia = false; - } - break; - case 2 /* WhitespaceTrivia */: - var nextTrivia = length > i + 1 && triviaList.syntaxTriviaAt(i + 1); - var whiteSpaceIndentationString = nextTrivia && nextTrivia.isComment() ? commentIndentationString : indentationString; - if (indentNextTokenOrTrivia) { - if (!(nextTrivia && nextTrivia.isNewLine())) { - this.recordIndentationEditsForWhitespace(trivia, position, whiteSpaceIndentationString); - } - indentNextTokenOrTrivia = false; - } - leadingWhiteSpace += trivia.fullText(); - break; - case 3 /* NewLineTrivia */: - indentNextTokenOrTrivia = true; - leadingWhiteSpace = ""; - break; - default: - throw TypeScript.Errors.invalidOperation(); - } - } - } - if (token.kind() !== 8 /* EndOfFileToken */ && indentNextTokenOrTrivia) { - if (indentationString.length > 0) { - this.recordEdit(position, 0, indentationString); - } - } - }; - MultipleTokenIndenter.prototype.recordIndentationEditsForSingleLineOrSkippedText = function (trivia, fullStart, indentationString) { - if (indentationString.length > 0) { - this.recordEdit(fullStart, 0, indentationString); - } - }; - MultipleTokenIndenter.prototype.recordIndentationEditsForWhitespace = function (trivia, fullStart, indentationString) { - var text = trivia.fullText(); - if (indentationString === text) { - return; - } - this.recordEdit(fullStart, text.length, indentationString); - }; - MultipleTokenIndenter.prototype.recordIndentationEditsForMultiLineComment = function (trivia, fullStart, indentationString, leadingWhiteSpace, firstLineAlreadyIndented) { - var position = fullStart; - var segments = TypeScript.Syntax.splitMultiLineCommentTriviaIntoMultipleLines(trivia); - if (segments.length <= 1) { - if (!firstLineAlreadyIndented) { - this.recordIndentationEditsForSingleLineOrSkippedText(trivia, fullStart, indentationString); - } - return; - } - var whiteSpaceColumnsInFirstSegment = TypeScript.Indentation.columnForPositionInString(leadingWhiteSpace, leadingWhiteSpace.length, this.options); - var indentationColumns = TypeScript.Indentation.columnForPositionInString(indentationString, indentationString.length, this.options); - var startIndex = 0; - if (firstLineAlreadyIndented) { - startIndex = 1; - position += segments[0].length; - } - for (var i = startIndex; i < segments.length; i++) { - var segment = segments[i]; - this.recordIndentationEditsForSegment(segment, position, indentationColumns, whiteSpaceColumnsInFirstSegment); - position += segment.length; - } - }; - MultipleTokenIndenter.prototype.recordIndentationEditsForSegment = function (segment, fullStart, indentationColumns, whiteSpaceColumnsInFirstSegment) { - var firstNonWhitespacePosition = TypeScript.Indentation.firstNonWhitespacePosition(segment); - var leadingWhiteSpaceColumns = TypeScript.Indentation.columnForPositionInString(segment, firstNonWhitespacePosition, this.options); - var deltaFromFirstSegment = leadingWhiteSpaceColumns - whiteSpaceColumnsInFirstSegment; - var finalColumns = indentationColumns + deltaFromFirstSegment; - if (finalColumns < 0) { - finalColumns = 0; - } - var indentationString = TypeScript.Indentation.indentationString(finalColumns, this.options); - if (firstNonWhitespacePosition < segment.length && TypeScript.CharacterInfo.isLineTerminator(segment.charCodeAt(firstNonWhitespacePosition))) { - return; - } - if (indentationString === segment.substring(0, firstNonWhitespacePosition)) { - return; - } - this.recordEdit(fullStart, firstNonWhitespacePosition, indentationString); - }; - return MultipleTokenIndenter; - })(Formatting.IndentationTrackingWalker); - Formatting.MultipleTokenIndenter = MultipleTokenIndenter; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var Formatter = (function (_super) { - __extends(Formatter, _super); - function Formatter(textSpan, sourceUnit, indentFirstToken, options, snapshot, rulesProvider, formattingRequestKind) { - _super.call(this, textSpan, sourceUnit, snapshot, indentFirstToken, options); - this.previousTokenSpan = null; - this.previousTokenParent = null; - this.scriptHasErrors = false; - this.previousTokenParent = this.parent().clone(this.indentationNodeContextPool()); - this.rulesProvider = rulesProvider; - this.formattingRequestKind = formattingRequestKind; - this.formattingContext = new Formatting.FormattingContext(this.snapshot(), this.formattingRequestKind); - } - Formatter.getEdits = function (textSpan, sourceUnit, options, indentFirstToken, snapshot, rulesProvider, formattingRequestKind) { - var walker = new Formatter(textSpan, sourceUnit, indentFirstToken, options, snapshot, rulesProvider, formattingRequestKind); - walker.walk(sourceUnit); - return walker.edits(); - }; - Formatter.prototype.visitTokenInSpan = function (token) { - if (token.fullWidth() !== 0) { - var tokenSpan = new TypeScript.TextSpan(this.position() + token.leadingTriviaWidth(), TypeScript.width(token)); - if (this.textSpan().containsTextSpan(tokenSpan)) { - this.processToken(token); - } - } - _super.prototype.visitTokenInSpan.call(this, token); - }; - Formatter.prototype.processToken = function (token) { - var position = this.position(); - if (token.leadingTriviaWidth() !== 0) { - this.processTrivia(token.leadingTrivia(), position); - position += token.leadingTriviaWidth(); - } - var currentTokenSpan = new Formatting.TokenSpan(token.kind(), position, TypeScript.width(token)); - if (!this.parent().hasSkippedOrMissingTokenChild()) { - if (this.previousTokenSpan) { - this.formatPair(this.previousTokenSpan, this.previousTokenParent, currentTokenSpan, this.parent()); - } - else { - this.trimWhitespaceInLineRange(this.getLineNumber(this.textSpan()), this.getLineNumber(currentTokenSpan)); - } - } - this.previousTokenSpan = currentTokenSpan; - if (this.previousTokenParent) { - this.indentationNodeContextPool().releaseNode(this.previousTokenParent, true); - } - this.previousTokenParent = this.parent().clone(this.indentationNodeContextPool()); - position += TypeScript.width(token); - if (token.trailingTriviaWidth() !== 0) { - this.processTrivia(token.trailingTrivia(), position); - } - }; - Formatter.prototype.processTrivia = function (triviaList, fullStart) { - var position = fullStart; - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - if (trivia.isComment() || trivia.isSkippedToken()) { - var currentTokenSpan = new Formatting.TokenSpan(trivia.kind(), position, trivia.fullWidth()); - if (this.textSpan().containsTextSpan(currentTokenSpan)) { - if (trivia.isComment() && this.previousTokenSpan) { - this.formatPair(this.previousTokenSpan, this.previousTokenParent, currentTokenSpan, this.parent()); - } - else { - var startLine = this.getLineNumber(this.previousTokenSpan || this.textSpan()); - this.trimWhitespaceInLineRange(startLine, this.getLineNumber(currentTokenSpan)); - } - this.previousTokenSpan = currentTokenSpan; - if (this.previousTokenParent) { - this.indentationNodeContextPool().releaseNode(this.previousTokenParent, true); - } - this.previousTokenParent = this.parent().clone(this.indentationNodeContextPool()); - } - } - position += trivia.fullWidth(); - } - }; - Formatter.prototype.findCommonParents = function (parent1, parent2) { - var shallowParent; - var shallowParentDepth; - var deepParent; - var deepParentDepth; - if (parent1.depth() < parent2.depth()) { - shallowParent = parent1; - shallowParentDepth = parent1.depth(); - deepParent = parent2; - deepParentDepth = parent2.depth(); - } - else { - shallowParent = parent2; - shallowParentDepth = parent2.depth(); - deepParent = parent1; - deepParentDepth = parent1.depth(); - } - TypeScript.Debug.assert(shallowParentDepth >= 0, "Expected shallowParentDepth >= 0"); - TypeScript.Debug.assert(deepParentDepth >= 0, "Expected deepParentDepth >= 0"); - TypeScript.Debug.assert(deepParentDepth >= shallowParentDepth, "Expected deepParentDepth >= shallowParentDepth"); - while (deepParentDepth > shallowParentDepth) { - deepParent = deepParent.parent(); - deepParentDepth--; - } - TypeScript.Debug.assert(deepParentDepth === shallowParentDepth, "Expected deepParentDepth === shallowParentDepth"); - while (deepParent.node() && shallowParent.node()) { - if (deepParent.node() === shallowParent.node()) { - return deepParent; - } - deepParent = deepParent.parent(); - shallowParent = shallowParent.parent(); - } - throw TypeScript.Errors.invalidOperation(); - }; - Formatter.prototype.formatPair = function (t1, t1Parent, t2, t2Parent) { - var token1Line = this.getLineNumber(t1); - var token2Line = this.getLineNumber(t2); - var commonParent = this.findCommonParents(t1Parent, t2Parent); - this.formattingContext.updateContext(t1, t1Parent, t2, t2Parent, commonParent); - var rule = this.rulesProvider.getRulesMap().GetRule(this.formattingContext); - if (rule != null) { - this.RecordRuleEdits(rule, t1, t2); - if ((rule.Operation.Action == 1 /* Space */ || rule.Operation.Action == 3 /* Delete */) && token1Line != token2Line) { - this.forceSkipIndentingNextToken(t2.start()); - } - if (rule.Operation.Action == 2 /* NewLine */ && token1Line == token2Line) { - this.forceIndentNextToken(t2.start()); - } - } - if (token1Line != token2Line && (!rule || (rule.Operation.Action != 3 /* Delete */ && rule.Flag != 1 /* CanDeleteNewLines */))) { - this.trimWhitespaceInLineRange(token1Line, token2Line, t1); - } - }; - Formatter.prototype.getLineNumber = function (span) { - return this.snapshot().getLineNumberFromPosition(span.start()); - }; - Formatter.prototype.trimWhitespaceInLineRange = function (startLine, endLine, token) { - for (var lineNumber = startLine; lineNumber < endLine; ++lineNumber) { - var line = this.snapshot().getLineFromLineNumber(lineNumber); - this.trimWhitespace(line, token); - } - }; - Formatter.prototype.trimWhitespace = function (line, token) { - if (token && (token.kind == 4 /* MultiLineCommentTrivia */ || token.kind == 5 /* SingleLineCommentTrivia */) && token.start() <= line.endPosition() && token.end() >= line.endPosition()) - return; - var text = line.getText(); - var index = 0; - for (index = text.length - 1; index >= 0; --index) { - if (!TypeScript.CharacterInfo.isWhitespace(text.charCodeAt(index))) { - break; - } - } - ++index; - if (index < text.length) { - this.recordEdit(line.startPosition() + index, line.length() - index, ""); - } - }; - Formatter.prototype.RecordRuleEdits = function (rule, t1, t2) { - if (rule.Operation.Action == 0 /* Ignore */) { - return; - } - var betweenSpan; - switch (rule.Operation.Action) { - case 3 /* Delete */: - { - betweenSpan = new TypeScript.TextSpan(t1.end(), t2.start() - t1.end()); - if (betweenSpan.length() > 0) { - this.recordEdit(betweenSpan.start(), betweenSpan.length(), ""); - return; - } - } - break; - case 2 /* NewLine */: - { - if (!(rule.Flag == 1 /* CanDeleteNewLines */ || this.getLineNumber(t1) == this.getLineNumber(t2))) { - return; - } - betweenSpan = new TypeScript.TextSpan(t1.end(), t2.start() - t1.end()); - var doEdit = false; - var betweenText = this.snapshot().getText(betweenSpan); - var lineFeedLoc = betweenText.indexOf(this.options.newLineCharacter); - if (lineFeedLoc < 0) { - doEdit = true; - } - else { - lineFeedLoc = betweenText.indexOf(this.options.newLineCharacter, lineFeedLoc + 1); - if (lineFeedLoc >= 0) { - doEdit = true; - } - } - if (doEdit) { - this.recordEdit(betweenSpan.start(), betweenSpan.length(), this.options.newLineCharacter); - return; - } - } - break; - case 1 /* Space */: - { - if (!(rule.Flag == 1 /* CanDeleteNewLines */ || this.getLineNumber(t1) == this.getLineNumber(t2))) { - return; - } - betweenSpan = new TypeScript.TextSpan(t1.end(), t2.start() - t1.end()); - if (betweenSpan.length() > 1 || this.snapshot().getText(betweenSpan) != " ") { - this.recordEdit(betweenSpan.start(), betweenSpan.length(), " "); - return; - } - } - break; - } - }; - return Formatter; - })(Formatting.MultipleTokenIndenter); - Formatting.Formatter = Formatter; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); var ts; (function (ts) { var formatting; @@ -30807,7 +17050,7 @@ var ts; return 0; } var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (precedingToken.kind === 22 /* CommaToken */ && precedingToken.parent.kind !== 153 /* BinaryExpression */) { + if (precedingToken.kind === 22 /* CommaToken */ && precedingToken.parent.kind !== 156 /* BinaryExpression */) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -30818,13 +17061,13 @@ var ts; var currentStart; var indentationDelta; while (current) { - if (positionBelongsToNode(current, position, sourceFile) && nodeContentIsIndented(current, previous)) { + if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : 0 /* Unknown */)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { indentationDelta = 0; } else { - indentationDelta = lineAtPosition !== currentStart.line ? options.indentSpaces : 0; + indentationDelta = lineAtPosition !== currentStart.line ? options.IndentSize : 0; } break; } @@ -30838,21 +17081,39 @@ var ts; if (!current) { return 0; } + return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options); + } + SmartIndenter.getIndentation = getIndentation; + function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { + var start = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options); + } + SmartIndenter.getIndentationForNode = getIndentationForNode; + function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { var parent = current.parent; var parentStart; while (parent) { - var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); - if (actualIndentation !== -1) { - return actualIndentation + indentationDelta; + var useActualIndentation = true; + if (ignoreActualIndentationRange) { + var start = current.getStart(sourceFile); + useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end; } - parentStart = sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + if (useActualIndentation) { + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + parentStart = getParentStart(parent, current, sourceFile); var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); - var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); - if (actualIndentation !== -1) { - return actualIndentation + indentationDelta; + if (useActualIndentation) { + var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } } - if (nodeContentIsIndented(parent, current) && !parentAndChildShareLine) { - indentationDelta += options.indentSpaces; + if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + indentationDelta += options.IndentSize; } current = parent; currentStart = parentStart; @@ -30860,14 +17121,20 @@ var ts; } return indentationDelta; } - SmartIndenter.getIndentation = getIndentation; + function getParentStart(parent, child, sourceFile) { + var containingList = getContainingList(child, sourceFile); + if (containingList) { + return sourceFile.getLineAndCharacterFromPosition(containingList.pos); + } + return sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + } function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { var commaItemInfo = ts.findListItemInfo(commaToken); ts.Debug.assert(commaItemInfo && commaItemInfo.listItemIndex > 0); return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 193 /* SourceFile */ || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 196 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -30894,46 +17161,50 @@ var ts; return candidate.end > position || !isCompletedNode(candidate, sourceFile); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 162 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 165 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 74 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; } + return false; } - function getActualIndentationForListItem(node, sourceFile, options) { + SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { case 132 /* TypeReference */: if (node.parent.typeArguments) { - return getActualIndentationFromList(node.parent.typeArguments); + return node.parent.typeArguments; } break; - case 140 /* ObjectLiteral */: - return getActualIndentationFromList(node.parent.properties); - case 134 /* TypeLiteral */: - return getActualIndentationFromList(node.parent.members); - case 139 /* ArrayLiteral */: - return getActualIndentationFromList(node.parent.elements); - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 142 /* ObjectLiteral */: + return node.parent.properties; + case 141 /* ArrayLiteral */: + return node.parent.elements; + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: case 125 /* Method */: case 129 /* CallSignature */: case 130 /* ConstructSignature */: if (node.parent.typeParameters && node.end < node.parent.typeParameters.end) { - return getActualIndentationFromList(node.parent.typeParameters); + return node.parent.typeParameters; } - return getActualIndentationFromList(node.parent.parameters); - case 145 /* NewExpression */: - case 144 /* CallExpression */: + return node.parent.parameters; + case 148 /* NewExpression */: + case 147 /* CallExpression */: if (node.parent.typeArguments && node.end < node.parent.typeArguments.end) { - return getActualIndentationFromList(node.parent.typeArguments); + return node.parent.typeArguments; } - return getActualIndentationFromList(node.parent.arguments); + return node.parent.arguments; } } - return -1; + return undefined; + } + function getActualIndentationForListItem(node, sourceFile, options) { + var containingList = getContainingList(node, sourceFile); + return containingList ? getActualIndentationFromList(containingList) : -1; function getActualIndentationFromList(list) { var index = ts.indexOf(list, node); return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1; @@ -30957,14 +17228,17 @@ var ts; } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); + } + function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { var column = 0; - for (var i = 0; i < lineAndCharacter.character; ++i) { - var charCode = sourceFile.text.charCodeAt(lineStart + i); - if (!ts.isWhiteSpace(charCode)) { + for (var pos = startPos; pos < endPos; ++pos) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts.isWhiteSpace(ch)) { return column; } - if (charCode === 9 /* tab */) { - column += options.spacesPerTab; + if (ch === 9 /* tab */) { + column += options.TabSize + (column % options.TabSize); } else { column++; @@ -30972,52 +17246,59 @@ var ts; } return column; } - function nodeContentIsIndented(parent, child) { - switch (parent.kind) { - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 187 /* EnumDeclaration */: + SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; + function nodeContentIsAlwaysIndented(kind) { + switch (kind) { + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: + case 141 /* ArrayLiteral */: + case 161 /* Block */: + case 186 /* FunctionBlock */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 192 /* ModuleBlock */: + case 142 /* ObjectLiteral */: + case 136 /* TypeLiteral */: + case 174 /* SwitchStatement */: + case 176 /* DefaultClause */: + case 175 /* CaseClause */: + case 151 /* ParenExpression */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: + case 162 /* VariableStatement */: + case 184 /* VariableDeclaration */: + case 194 /* ExportAssignment */: + case 172 /* ReturnStatement */: return true; - case 188 /* ModuleDeclaration */: - return false; - case 182 /* FunctionDeclaration */: + } + return false; + } + function shouldIndentChildNode(parent, child) { + if (nodeContentIsAlwaysIndented(parent)) { + return true; + } + switch (parent) { + case 166 /* DoStatement */: + case 167 /* WhileStatement */: + case 169 /* ForInStatement */: + case 168 /* ForStatement */: + case 165 /* IfStatement */: + return child !== 161 /* Block */; + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: case 125 /* Method */: - case 149 /* FunctionExpression */: + case 153 /* ArrowFunction */: + case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 126 /* Constructor */: - return false; - case 163 /* DoStatement */: - case 164 /* WhileStatement */: - case 166 /* ForInStatement */: - case 165 /* ForStatement */: - return child && child.kind !== 158 /* Block */; - case 162 /* IfStatement */: - return child && child.kind !== 158 /* Block */; - case 176 /* TryStatement */: - return false; - case 139 /* ArrayLiteral */: - case 158 /* Block */: - case 183 /* FunctionBlock */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: - case 189 /* ModuleBlock */: - case 140 /* ObjectLiteral */: - case 134 /* TypeLiteral */: - case 171 /* SwitchStatement */: - case 173 /* DefaultClause */: - case 172 /* CaseClause */: - case 148 /* ParenExpression */: - case 144 /* CallExpression */: - case 145 /* NewExpression */: - case 159 /* VariableStatement */: - case 181 /* VariableDeclaration */: - return true; + return child !== 186 /* FunctionBlock */; default: return false; } } + SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; function nodeEndsWith(n, expectedLastToken, sourceFile) { var children = n.getChildren(sourceFile); if (children.length) { @@ -31033,46 +17314,46 @@ var ts; } function isCompletedNode(n, sourceFile) { switch (n.kind) { - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 187 /* EnumDeclaration */: - case 140 /* ObjectLiteral */: - case 158 /* Block */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: - case 183 /* FunctionBlock */: - case 189 /* ModuleBlock */: - case 171 /* SwitchStatement */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: + case 142 /* ObjectLiteral */: + case 161 /* Block */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: + case 174 /* SwitchStatement */: return nodeEndsWith(n, 14 /* CloseBraceToken */, sourceFile); - case 148 /* ParenExpression */: + case 151 /* ParenExpression */: case 129 /* CallSignature */: - case 144 /* CallExpression */: + case 147 /* CallExpression */: case 130 /* ConstructSignature */: return nodeEndsWith(n, 16 /* CloseParenToken */, sourceFile); - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: case 125 /* Method */: - case 150 /* ArrowFunction */: + case 153 /* ArrowFunction */: return !n.body || isCompletedNode(n.body, sourceFile); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 162 /* IfStatement */: + case 165 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 161 /* ExpressionStatement */: + case 164 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile); - case 139 /* ArrayLiteral */: + case 141 /* ArrayLiteral */: return nodeEndsWith(n, 18 /* CloseBracketToken */, sourceFile); case 120 /* Missing */: return false; - case 172 /* CaseClause */: - case 173 /* DefaultClause */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: return false; - case 164 /* WhileStatement */: + case 167 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 163 /* DoStatement */: + case 166 /* DoStatement */: var hasWhileKeyword = ts.findChildOfKind(n, 98 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 16 /* CloseParenToken */, sourceFile); @@ -31085,93 +17366,1739 @@ var ts; })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -var TypeScript; -(function (TypeScript) { - var NullLogger = (function () { - function NullLogger() { - } - NullLogger.prototype.log = function (s) { - }; - return NullLogger; - })(); - TypeScript.NullLogger = NullLogger; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var proto = "__proto__"; - var BlockIntrinsics = (function () { - function BlockIntrinsics() { - this.prototype = undefined; - this.toString = undefined; - this.toLocaleString = undefined; - this.valueOf = undefined; - this.hasOwnProperty = undefined; - this.propertyIsEnumerable = undefined; - this.isPrototypeOf = undefined; - this["constructor"] = undefined; - this[proto] = null; - this[proto] = undefined; - } - return BlockIntrinsics; - })(); - function createIntrinsicsObject() { - return new BlockIntrinsics(); - } - TypeScript.createIntrinsicsObject = createIntrinsicsObject; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function stripStartAndEndQuotes(str) { - var firstCharCode = str && str.charCodeAt(0); - if (str && str.length >= 2 && firstCharCode === str.charCodeAt(str.length - 1) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { - return str.substring(1, str.length - 1); - } - return str; - } - TypeScript.stripStartAndEndQuotes = stripStartAndEndQuotes; - var switchToForwardSlashesRegEx = /\\/g; - function switchToForwardSlashes(path) { - return path.replace(switchToForwardSlashesRegEx, "/"); - } - TypeScript.switchToForwardSlashes = switchToForwardSlashes; - function isFileOfExtension(fname, ext) { - var invariantFname = fname.toLocaleUpperCase(); - var invariantExt = ext.toLocaleUpperCase(); - var extLength = invariantExt.length; - return invariantFname.length > extLength && invariantFname.substring(invariantFname.length - extLength, invariantFname.length) === invariantExt; - } - function isDTSFile(fname) { - return isFileOfExtension(fname, ".d.ts"); - } - TypeScript.isDTSFile = isDTSFile; - function getPathComponents(path) { - return path.split("/"); - } - TypeScript.getPathComponents = getPathComponents; - var normalizePathRegEx = /^\\\\[^\\]/; - function normalizePath(path) { - if (normalizePathRegEx.test(path)) { - path = "file:" + path; - } - var parts = getPathComponents(switchToForwardSlashes(path)); - var normalizedParts = []; - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - if (part === ".") { - continue; - } - if (normalizedParts.length > 0 && TypeScript.ArrayUtilities.last(normalizedParts) !== ".." && part === "..") { - normalizedParts.pop(); - continue; - } - normalizedParts.push(part); - } - return normalizedParts.join("/"); - } - TypeScript.normalizePath = normalizePath; -})(TypeScript || (TypeScript = {})); var ts; (function (ts) { + var formatting; + (function (formatting) { + var internedTabsIndentation; + var internedSpacesIndentation; + function getIndentationString(indentation, options) { + if (!options.ConvertTabsToSpaces) { + var tabs = Math.floor(indentation / options.TabSize); + var spaces = indentation - tabs * options.TabSize; + var tabString; + if (!internedTabsIndentation) { + internedTabsIndentation = []; + } + if (internedTabsIndentation[tabs] === undefined) { + internedTabsIndentation[tabs] = tabString = repeat('\t', tabs); + } + else { + tabString = internedTabsIndentation[tabs]; + } + return spaces ? tabString + repeat(" ", spaces) : tabString; + } + else { + var spacesString; + var quotient = Math.floor(indentation / options.IndentSize); + var remainder = indentation % options.IndentSize; + if (!internedSpacesIndentation) { + internedSpacesIndentation = []; + } + if (internedSpacesIndentation[quotient] === undefined) { + spacesString = repeat(" ", options.IndentSize * quotient); + internedSpacesIndentation[quotient] = spacesString; + } + else { + spacesString = internedSpacesIndentation[quotient]; + } + return remainder ? spacesString + repeat(" ", remainder) : spacesString; + } + function repeat(value, count) { + var s = ""; + for (var i = 0; i < count; ++i) { + s += value; + } + return s; + } + } + formatting.getIndentationString = getIndentationString; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var scanner = ts.createScanner(2 /* Latest */, false); + function getFormattingScanner(sourceFile, startPos, endPos) { + scanner.setText(sourceFile.text); + scanner.setTextPos(startPos); + var wasNewLine = true; + var leadingTrivia; + var trailingTrivia; + var savedPos; + var lastScanAction; + var lastTokenInfo; + return { + advance: advance, + readTokenInfo: readTokenInfo, + isOnToken: isOnToken, + lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, + close: function () { + lastTokenInfo = undefined; + scanner.setText(undefined); + } + }; + function advance() { + lastTokenInfo = undefined; + var isStarted = scanner.getStartPos() !== startPos; + if (isStarted) { + if (trailingTrivia) { + ts.Debug.assert(trailingTrivia.length !== 0); + wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === 4 /* NewLineTrivia */; + } + else { + wasNewLine = false; + } + } + leadingTrivia = undefined; + trailingTrivia = undefined; + if (!isStarted) { + scanner.scan(); + } + var t; + var pos = scanner.getStartPos(); + while (pos < endPos) { + var t = scanner.getToken(); + if (!ts.isTrivia(t)) { + break; + } + scanner.scan(); + var item = { + pos: pos, + end: scanner.getStartPos(), + kind: t + }; + pos = scanner.getStartPos(); + if (!leadingTrivia) { + leadingTrivia = []; + } + leadingTrivia.push(item); + } + savedPos = scanner.getStartPos(); + } + function shouldRescanGreaterThanToken(container) { + if (container.kind !== 156 /* BinaryExpression */) { + return false; + } + switch (container.operator) { + case 26 /* GreaterThanEqualsToken */: + case 58 /* GreaterThanGreaterThanEqualsToken */: + case 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + case 40 /* GreaterThanGreaterThanToken */: + return true; + } + return false; + } + function shouldRescanSlashToken(container) { + return container.kind === 8 /* RegularExpressionLiteral */; + } + function shouldRescanTemplateToken(container) { + return container.kind === 159 /* TemplateSpan */; + } + function startsWithSlashToken(t) { + return t === 35 /* SlashToken */ || t === 55 /* SlashEqualsToken */; + } + function readTokenInfo(n) { + if (!isOnToken()) { + return { + leadingTrivia: leadingTrivia, + trailingTrivia: undefined, + token: undefined + }; + } + var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 /* RescanGreaterThanToken */ : shouldRescanSlashToken(n) ? 2 /* RescanSlashToken */ : shouldRescanTemplateToken(n) ? 3 /* RescanTemplateToken */ : 0 /* Scan */; + if (lastTokenInfo && expectedScanAction === lastScanAction) { + return lastTokenInfo; + } + if (scanner.getStartPos() !== savedPos) { + ts.Debug.assert(lastTokenInfo !== undefined); + scanner.setTextPos(savedPos); + scanner.scan(); + } + var currentToken = scanner.getToken(); + if (expectedScanAction === 1 /* RescanGreaterThanToken */ && currentToken === 24 /* GreaterThanToken */) { + currentToken = scanner.reScanGreaterToken(); + ts.Debug.assert(n.operator === currentToken); + lastScanAction = 1 /* RescanGreaterThanToken */; + } + else if (expectedScanAction === 2 /* RescanSlashToken */ && startsWithSlashToken(currentToken)) { + currentToken = scanner.reScanSlashToken(); + ts.Debug.assert(n.kind === currentToken); + lastScanAction = 2 /* RescanSlashToken */; + } + else if (expectedScanAction === 3 /* RescanTemplateToken */ && currentToken === 14 /* CloseBraceToken */) { + currentToken = scanner.reScanTemplateToken(); + lastScanAction = 3 /* RescanTemplateToken */; + } + else { + lastScanAction = 0 /* Scan */; + } + var token = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + while (scanner.getStartPos() < endPos) { + currentToken = scanner.scan(); + if (!ts.isTrivia(currentToken)) { + break; + } + var trivia = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + if (!trailingTrivia) { + trailingTrivia = []; + } + trailingTrivia.push(trivia); + if (currentToken === 4 /* NewLineTrivia */) { + scanner.scan(); + break; + } + } + return lastTokenInfo = { + leadingTrivia: leadingTrivia, + trailingTrivia: trailingTrivia, + token: token + }; + } + function isOnToken() { + var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); + var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current); + } + } + formatting.getFormattingScanner = getFormattingScanner; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var FormattingContext = (function () { + function FormattingContext(sourceFile, formattingRequestKind) { + this.sourceFile = sourceFile; + this.formattingRequestKind = formattingRequestKind; + } + FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) { + ts.Debug.assert(currentRange !== undefined, "currentTokenSpan is null"); + ts.Debug.assert(currentTokenParent !== undefined, "currentTokenParent is null"); + ts.Debug.assert(nextRange !== undefined, "nextTokenSpan is null"); + ts.Debug.assert(nextTokenParent !== undefined, "nextTokenParent is null"); + ts.Debug.assert(commonParent !== undefined, "commonParent is null"); + this.currentTokenSpan = currentRange; + this.currentTokenParent = currentTokenParent; + this.nextTokenSpan = nextRange; + this.nextTokenParent = nextTokenParent; + this.contextNode = commonParent; + this.contextNodeAllOnSameLine = undefined; + this.nextNodeAllOnSameLine = undefined; + this.tokensAreOnSameLine = undefined; + this.contextNodeBlockIsOnOneLine = undefined; + this.nextNodeBlockIsOnOneLine = undefined; + }; + FormattingContext.prototype.ContextNodeAllOnSameLine = function () { + if (this.contextNodeAllOnSameLine === undefined) { + this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode); + } + return this.contextNodeAllOnSameLine; + }; + FormattingContext.prototype.NextNodeAllOnSameLine = function () { + if (this.nextNodeAllOnSameLine === undefined) { + this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeAllOnSameLine; + }; + FormattingContext.prototype.TokensAreOnSameLine = function () { + if (this.tokensAreOnSameLine === undefined) { + var startLine = this.sourceFile.getLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; + this.tokensAreOnSameLine = (startLine == endLine); + } + return this.tokensAreOnSameLine; + }; + FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () { + if (this.contextNodeBlockIsOnOneLine === undefined) { + this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode); + } + return this.contextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () { + if (this.nextNodeBlockIsOnOneLine === undefined) { + this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NodeIsOnOneLine = function (node) { + var startLine = this.sourceFile.getLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterFromPosition(node.getEnd()).line; + return startLine == endLine; + }; + FormattingContext.prototype.BlockIsOnOneLine = function (node) { + var openBrace = ts.findChildOfKind(node, 13 /* OpenBraceToken */, this.sourceFile); + var closeBrace = ts.findChildOfKind(node, 14 /* CloseBraceToken */, this.sourceFile); + if (openBrace && closeBrace) { + var startLine = this.sourceFile.getLineAndCharacterFromPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; + return startLine === endLine; + } + return false; + }; + return FormattingContext; + })(); + formatting.FormattingContext = FormattingContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rule = (function () { + function Rule(Descriptor, Operation, Flag) { + if (Flag === void 0) { Flag = 0 /* None */; } + this.Descriptor = Descriptor; + this.Operation = Operation; + this.Flag = Flag; + } + Rule.prototype.toString = function () { + return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; + }; + return Rule; + })(); + formatting.Rule = Rule; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleDescriptor = (function () { + function RuleDescriptor(LeftTokenRange, RightTokenRange) { + this.LeftTokenRange = LeftTokenRange; + this.RightTokenRange = RightTokenRange; + } + RuleDescriptor.prototype.toString = function () { + return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; + }; + RuleDescriptor.create1 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create2 = function (left, right) { + return RuleDescriptor.create4(left, formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create3 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), right); + }; + RuleDescriptor.create4 = function (left, right) { + return new RuleDescriptor(left, right); + }; + return RuleDescriptor; + })(); + formatting.RuleDescriptor = RuleDescriptor; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperation = (function () { + function RuleOperation() { + this.Context = null; + this.Action = null; + } + RuleOperation.prototype.toString = function () { + return "[context=" + this.Context + "," + "action=" + this.Action + "]"; + }; + RuleOperation.create1 = function (action) { + return RuleOperation.create2(formatting.RuleOperationContext.Any, action); + }; + RuleOperation.create2 = function (context, action) { + var result = new RuleOperation(); + result.Context = context; + result.Action = action; + return result; + }; + return RuleOperation; + })(); + formatting.RuleOperation = RuleOperation; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperationContext = (function () { + function RuleOperationContext() { + var funcs = []; + for (var _i = 0; _i < arguments.length; _i++) { + funcs[_i - 0] = arguments[_i]; + } + this.customContextChecks = funcs; + } + RuleOperationContext.prototype.IsAny = function () { + return this == RuleOperationContext.Any; + }; + RuleOperationContext.prototype.InContext = function (context) { + if (this.IsAny()) { + return true; + } + for (var i = 0, len = this.customContextChecks.length; i < len; i++) { + if (!this.customContextChecks[i](context)) { + return false; + } + } + return true; + }; + RuleOperationContext.Any = new RuleOperationContext(); + return RuleOperationContext; + })(); + formatting.RuleOperationContext = RuleOperationContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rules = (function () { + function Rules() { + this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1 /* Ignore */)); + this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeQMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 49 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(50 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterQMark = new formatting.Rule(formatting.RuleDescriptor.create3(49 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(14 /* CloseBraceToken */, 74 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(14 /* CloseBraceToken */, 98 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([16 /* CloseParenToken */, 18 /* CloseBracketToken */, 22 /* CommaToken */, 21 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(18 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; + this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([63 /* Identifier */, 3 /* MultiLineCommentTrivia */]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([16 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 73 /* DoKeyword */, 94 /* TryKeyword */, 79 /* FinallyKeyword */, 74 /* ElseKeyword */]); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(13 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 14 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(13 /* OpenBraceToken */, 14 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); + this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(13 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 14 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 37 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 38 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(37 /* PlusPlusToken */, 32 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(32 /* PlusToken */, 32 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(32 /* PlusToken */, 37 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(38 /* MinusMinusToken */, 33 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(33 /* MinusToken */, 33 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(33 /* MinusToken */, 38 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([96 /* VarKeyword */, 92 /* ThrowKeyword */, 86 /* NewKeyword */, 72 /* DeleteKeyword */, 88 /* ReturnKeyword */, 95 /* TypeOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext), 8 /* Delete */)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(81 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(97 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* ReturnKeyword */, 21 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([16 /* CloseParenToken */, 73 /* DoKeyword */, 74 /* ElseKeyword */, 65 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([94 /* TryKeyword */, 79 /* FinallyKeyword */]), 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([113 /* GetKeyword */, 117 /* SetKeyword */]), 63 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(111 /* ConstructorKeyword */, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([114 /* ModuleKeyword */, 115 /* RequireKeyword */]), 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([67 /* ClassKeyword */, 112 /* DeclareKeyword */, 75 /* EnumKeyword */, 76 /* ExportKeyword */, 77 /* ExtendsKeyword */, 113 /* GetKeyword */, 100 /* ImplementsKeyword */, 83 /* ImportKeyword */, 101 /* InterfaceKeyword */, 114 /* ModuleKeyword */, 104 /* PrivateKeyword */, 106 /* PublicKeyword */, 117 /* SetKeyword */, 107 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([77 /* ExtendsKeyword */, 100 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(7 /* StringLiteral */, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(31 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(20 /* DotDotDotToken */, 63 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(49 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([16 /* CloseParenToken */, 22 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 23 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseParenToken */, 23 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* LessThanToken */, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([15 /* OpenParenToken */, 17 /* OpenBracketToken */, 24 /* GreaterThanToken */, 22 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(13 /* OpenBraceToken */, 14 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); + this.HighPriorityCommonRules = [ + this.IgnoreBeforeComment, + this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, + this.SpaceAfterColon, + this.NoSpaceBeforeQMark, + this.SpaceAfterQMark, + this.NoSpaceBeforeDot, + this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, + this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, + this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, + this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, + this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, + this.SpaceBeforeCloseBrace, + this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, + this.SpaceBetweenCloseBraceAndElse, + this.SpaceBetweenCloseBraceAndWhile, + this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, + this.NewLineAfterOpenBraceInBlockContext, + this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, + this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, + this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, + this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, + this.SpaceBeforeOpenBraceInFunction, + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, + this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, + this.SpaceAfterTryFinally + ]; + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); + this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); + this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 13 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenParenToken */, 16 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(81 /* FunctionKeyword */, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(81 /* FunctionKeyword */, 15 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); + } + Rules.prototype.getRuleName = function (rule) { + var o = this; + for (var name in o) { + if (o[name] === rule) { + return name; + } + } + throw new Error("Unknown rule"); + }; + Rules.IsForContext = function (context) { + return context.contextNode.kind === 168 /* ForStatement */; + }; + Rules.IsNotForContext = function (context) { + return !Rules.IsForContext(context); + }; + Rules.IsBinaryOpContext = function (context) { + switch (context.contextNode.kind) { + case 156 /* BinaryExpression */: + case 157 /* ConditionalExpression */: + return true; + case 193 /* ImportDeclaration */: + case 184 /* VariableDeclaration */: + case 123 /* Parameter */: + case 195 /* EnumMember */: + case 124 /* Property */: + return context.currentTokenSpan.kind === 51 /* EqualsToken */ || context.nextTokenSpan.kind === 51 /* EqualsToken */; + case 169 /* ForInStatement */: + return context.currentTokenSpan.kind === 84 /* InKeyword */ || context.nextTokenSpan.kind === 84 /* InKeyword */; + } + return false; + }; + Rules.IsNotBinaryOpContext = function (context) { + return !Rules.IsBinaryOpContext(context); + }; + Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { + return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); + }; + Rules.IsBeforeMultilineBlockContext = function (context) { + return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); + }; + Rules.IsMultilineBlockContext = function (context) { + return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsSingleLineBlockContext = function (context) { + return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.contextNode); + }; + Rules.IsBeforeBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.nextTokenParent); + }; + Rules.NodeIsBlockContext = function (node) { + if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) { + return true; + } + switch (node.kind) { + case 161 /* Block */: + case 174 /* SwitchStatement */: + case 142 /* ObjectLiteral */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: + return true; + } + return false; + }; + Rules.IsFunctionDeclContext = function (context) { + switch (context.contextNode.kind) { + case 185 /* FunctionDeclaration */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 129 /* CallSignature */: + case 152 /* FunctionExpression */: + case 126 /* Constructor */: + case 153 /* ArrowFunction */: + case 188 /* InterfaceDeclaration */: + return true; + } + return false; + }; + Rules.IsTypeScriptDeclWithBlockContext = function (context) { + return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); + }; + Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { + switch (node.kind) { + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: + case 136 /* TypeLiteral */: + case 191 /* ModuleDeclaration */: + return true; + } + return false; + }; + Rules.IsAfterCodeBlockContext = function (context) { + switch (context.currentTokenParent.kind) { + case 187 /* ClassDeclaration */: + case 191 /* ModuleDeclaration */: + case 190 /* EnumDeclaration */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 186 /* FunctionBlock */: + case 192 /* ModuleBlock */: + case 174 /* SwitchStatement */: + return true; + } + return false; + }; + Rules.IsControlDeclContext = function (context) { + switch (context.contextNode.kind) { + case 165 /* IfStatement */: + case 174 /* SwitchStatement */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 167 /* WhileStatement */: + case 179 /* TryStatement */: + case 166 /* DoStatement */: + case 173 /* WithStatement */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + return true; + default: + return false; + } + }; + Rules.IsObjectContext = function (context) { + return context.contextNode.kind === 142 /* ObjectLiteral */; + }; + Rules.IsFunctionCallContext = function (context) { + return context.contextNode.kind === 147 /* CallExpression */; + }; + Rules.IsNewContext = function (context) { + return context.contextNode.kind === 148 /* NewExpression */; + }; + Rules.IsFunctionCallOrNewContext = function (context) { + return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); + }; + Rules.IsSameLineTokenContext = function (context) { + return context.TokensAreOnSameLine(); + }; + Rules.IsNotFormatOnEnter = function (context) { + return context.formattingRequestKind != 2 /* FormatOnEnter */; + }; + Rules.IsModuleDeclContext = function (context) { + return context.contextNode.kind === 191 /* ModuleDeclaration */; + }; + Rules.IsObjectTypeContext = function (context) { + return context.contextNode.kind === 136 /* TypeLiteral */; + }; + Rules.IsTypeArgumentOrParameter = function (token, parent) { + if (token.kind !== 23 /* LessThanToken */ && token.kind !== 24 /* GreaterThanToken */) { + return false; + } + switch (parent.kind) { + case 132 /* TypeReference */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: + case 125 /* Method */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: + return true; + default: + return false; + } + }; + Rules.IsTypeArgumentOrParameterContext = function (context) { + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + }; + Rules.IsVoidOpContext = function (context) { + return context.currentTokenSpan.kind === 97 /* VoidKeyword */ && context.currentTokenParent.kind === 154 /* PrefixOperator */; + }; + return Rules; + })(); + formatting.Rules = Rules; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesMap = (function () { + function RulesMap() { + this.map = []; + this.mapRowLength = 0; + } + RulesMap.create = function (rules) { + var result = new RulesMap(); + result.Initialize(rules); + return result; + }; + RulesMap.prototype.Initialize = function (rules) { + this.mapRowLength = 119 /* LastToken */ + 1; + this.map = new Array(this.mapRowLength * this.mapRowLength); + var rulesBucketConstructionStateList = new Array(this.map.length); + this.FillRules(rules, rulesBucketConstructionStateList); + return this.map; + }; + RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) { + var _this = this; + rules.forEach(function (rule) { + _this.FillRule(rule, rulesBucketConstructionStateList); + }); + }; + RulesMap.prototype.GetRuleBucketIndex = function (row, column) { + var rulesBucketIndex = (row * this.mapRowLength) + column; + return rulesBucketIndex; + }; + RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { + var _this = this; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { + rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { + var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); + var rulesBucket = _this.map[rulesBucketIndex]; + if (rulesBucket == undefined) { + rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket(); + } + rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex); + }); + }); + }; + RulesMap.prototype.GetRule = function (context) { + var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); + var bucket = this.map[bucketIndex]; + if (bucket != null) { + for (var i = 0, len = bucket.Rules().length; i < len; i++) { + var rule = bucket.Rules()[i]; + if (rule.Operation.Context.InContext(context)) + return rule; + } + } + return null; + }; + return RulesMap; + })(); + formatting.RulesMap = RulesMap; + var MaskBitSize = 5; + var Mask = 0x1f; + (function (RulesPosition) { + RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; + RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny"; + RulesPosition[RulesPosition["ContextRulesSpecific"] = MaskBitSize * 2] = "ContextRulesSpecific"; + RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny"; + RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific"; + RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny"; + })(formatting.RulesPosition || (formatting.RulesPosition = {})); + var RulesPosition = formatting.RulesPosition; + var RulesBucketConstructionState = (function () { + function RulesBucketConstructionState() { + this.rulesInsertionIndexBitmap = 0; + } + RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) { + var index = 0; + var pos = 0; + var indexBitmap = this.rulesInsertionIndexBitmap; + while (pos <= maskPosition) { + index += (indexBitmap & Mask); + indexBitmap >>= MaskBitSize; + pos += MaskBitSize; + } + return index; + }; + RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) { + var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask; + value++; + ts.Debug.assert((value & Mask) == value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."); + var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition); + temp |= value << maskPosition; + this.rulesInsertionIndexBitmap = temp; + }; + return RulesBucketConstructionState; + })(); + formatting.RulesBucketConstructionState = RulesBucketConstructionState; + var RulesBucket = (function () { + function RulesBucket() { + this.rules = []; + } + RulesBucket.prototype.Rules = function () { + return this.rules; + }; + RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { + var position; + if (rule.Operation.Action == 1 /* Ignore */) { + position = specificTokens ? 0 /* IgnoreRulesSpecific */ : RulesPosition.IgnoreRulesAny; + } + else if (!rule.Operation.Context.IsAny()) { + position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; + } + else { + position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; + } + var state = constructionState[rulesBucketIndex]; + if (state === undefined) { + state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState(); + } + var index = state.GetInsertionIndex(position); + this.rules.splice(index, 0, rule); + state.IncreaseInsertionIndex(position); + }; + return RulesBucket; + })(); + formatting.RulesBucket = RulesBucket; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Shared; + (function (Shared) { + var TokenRangeAccess = (function () { + function TokenRangeAccess(from, to, except) { + this.tokens = []; + for (var token = from; token <= to; token++) { + if (except.indexOf(token) < 0) { + this.tokens.push(token); + } + } + } + TokenRangeAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenRangeAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenRangeAccess; + })(); + Shared.TokenRangeAccess = TokenRangeAccess; + var TokenValuesAccess = (function () { + function TokenValuesAccess(tks) { + this.tokens = tks && tks.length ? tks : []; + } + TokenValuesAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenValuesAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenValuesAccess; + })(); + Shared.TokenValuesAccess = TokenValuesAccess; + var TokenSingleValueAccess = (function () { + function TokenSingleValueAccess(token) { + this.token = token; + } + TokenSingleValueAccess.prototype.GetTokens = function () { + return [this.token]; + }; + TokenSingleValueAccess.prototype.Contains = function (tokenValue) { + return tokenValue == this.token; + }; + return TokenSingleValueAccess; + })(); + Shared.TokenSingleValueAccess = TokenSingleValueAccess; + var TokenAllAccess = (function () { + function TokenAllAccess() { + } + TokenAllAccess.prototype.GetTokens = function () { + var result = []; + for (var token = 1 /* FirstToken */; token <= 119 /* LastToken */; token++) { + result.push(token); + } + return result; + }; + TokenAllAccess.prototype.Contains = function (tokenValue) { + return true; + }; + TokenAllAccess.prototype.toString = function () { + return "[allTokens]"; + }; + return TokenAllAccess; + })(); + Shared.TokenAllAccess = TokenAllAccess; + var TokenRange = (function () { + function TokenRange(tokenAccess) { + this.tokenAccess = tokenAccess; + } + TokenRange.FromToken = function (token) { + return new TokenRange(new TokenSingleValueAccess(token)); + }; + TokenRange.FromTokens = function (tokens) { + return new TokenRange(new TokenValuesAccess(tokens)); + }; + TokenRange.FromRange = function (f, to, except) { + if (except === void 0) { except = []; } + return new TokenRange(new TokenRangeAccess(f, to, except)); + }; + TokenRange.AllTokens = function () { + return new TokenRange(new TokenAllAccess()); + }; + TokenRange.prototype.GetTokens = function () { + return this.tokenAccess.GetTokens(); + }; + TokenRange.prototype.Contains = function (token) { + return this.tokenAccess.Contains(token); + }; + TokenRange.prototype.toString = function () { + return this.tokenAccess.toString(); + }; + TokenRange.Any = TokenRange.AllTokens(); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); + TokenRange.Keywords = TokenRange.FromRange(64 /* FirstKeyword */, 119 /* LastKeyword */); + TokenRange.Operators = TokenRange.FromRange(21 /* FirstOperator */, 62 /* LastOperator */); + TokenRange.BinaryOperators = TokenRange.FromRange(23 /* FirstBinaryOperator */, 62 /* LastBinaryOperator */); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([84 /* InKeyword */, 85 /* InstanceOfKeyword */]); + TokenRange.ReservedKeywords = TokenRange.FromRange(100 /* FirstFutureReservedWord */, 108 /* LastFutureReservedWord */); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([37 /* PlusPlusToken */, 38 /* MinusMinusToken */, 46 /* TildeToken */, 45 /* ExclamationToken */]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([6 /* NumericLiteral */, 63 /* Identifier */, 15 /* OpenParenToken */, 17 /* OpenBracketToken */, 13 /* OpenBraceToken */, 91 /* ThisKeyword */, 86 /* NewKeyword */]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([63 /* Identifier */, 15 /* OpenParenToken */, 91 /* ThisKeyword */, 86 /* NewKeyword */]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([63 /* Identifier */, 16 /* CloseParenToken */, 18 /* CloseBracketToken */, 86 /* NewKeyword */]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([63 /* Identifier */, 15 /* OpenParenToken */, 91 /* ThisKeyword */, 86 /* NewKeyword */]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([63 /* Identifier */, 16 /* CloseParenToken */, 18 /* CloseBracketToken */, 86 /* NewKeyword */]); + TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); + TokenRange.TypeNames = TokenRange.FromTokens([63 /* Identifier */, 116 /* NumberKeyword */, 118 /* StringKeyword */, 110 /* BooleanKeyword */, 97 /* VoidKeyword */, 109 /* AnyKeyword */]); + return TokenRange; + })(); + Shared.TokenRange = TokenRange; + })(Shared = formatting.Shared || (formatting.Shared = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var TokenSpan = (function (_super) { + __extends(TokenSpan, _super); + function TokenSpan(kind, start, length) { + _super.call(this, start, length); + this.kind = kind; + } + return TokenSpan; + })(ts.TextSpan); + formatting.TokenSpan = TokenSpan; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesProvider = (function () { + function RulesProvider(logger) { + this.logger = logger; + this.globalRules = new formatting.Rules(); + } + RulesProvider.prototype.getRuleName = function (rule) { + return this.globalRules.getRuleName(rule); + }; + RulesProvider.prototype.getRuleByName = function (name) { + return this.globalRules[name]; + }; + RulesProvider.prototype.getRulesMap = function () { + return this.rulesMap; + }; + RulesProvider.prototype.ensureUpToDate = function (options) { + if (this.options == null || !ts.compareDataObjects(this.options, options)) { + var activeRules = this.createActiveRules(options); + var rulesMap = formatting.RulesMap.create(activeRules); + this.activeRules = activeRules; + this.rulesMap = rulesMap; + this.options = ts.clone(options); + } + }; + RulesProvider.prototype.createActiveRules = function (options) { + var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.InsertSpaceAfterCommaDelimiter) { + rules.push(this.globalRules.SpaceAfterComma); + } + else { + rules.push(this.globalRules.NoSpaceAfterComma); + } + if (options.InsertSpaceAfterFunctionKeywordForAnonymousFunctions) { + rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword); + } + else { + rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword); + } + if (options.InsertSpaceAfterKeywordsInControlFlowStatements) { + rules.push(this.globalRules.SpaceAfterKeywordInControl); + } + else { + rules.push(this.globalRules.NoSpaceAfterKeywordInControl); + } + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) { + rules.push(this.globalRules.SpaceAfterOpenParen); + rules.push(this.globalRules.SpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenParen); + rules.push(this.globalRules.NoSpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + if (options.InsertSpaceAfterSemicolonInForStatements) { + rules.push(this.globalRules.SpaceAfterSemicolonInFor); + } + else { + rules.push(this.globalRules.NoSpaceAfterSemicolonInFor); + } + if (options.InsertSpaceBeforeAndAfterBinaryOperators) { + rules.push(this.globalRules.SpaceBeforeBinaryOperator); + rules.push(this.globalRules.SpaceAfterBinaryOperator); + } + else { + rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); + rules.push(this.globalRules.NoSpaceAfterBinaryOperator); + } + if (options.PlaceOpenBraceOnNewLineForControlBlocks) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); + } + if (options.PlaceOpenBraceOnNewLineForFunctions) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction); + rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock); + } + rules = rules.concat(this.globalRules.LowPriorityCommonRules); + return rules; + }; + return RulesProvider; + })(); + formatting.RulesProvider = RulesProvider; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + function formatOnEnter(position, sourceFile, rulesProvider, options) { + var line = sourceFile.getLineAndCharacterFromPosition(position).line; + ts.Debug.assert(line >= 2); + var span = { + pos: ts.getStartPositionOfLine(line - 1, sourceFile), + end: ts.getEndLinePosition(line, sourceFile) + 1 + }; + return formatSpan(span, sourceFile, options, rulesProvider, 2 /* FormatOnEnter */); + } + formatting.formatOnEnter = formatOnEnter; + function formatOnSemicolon(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 21 /* SemicolonToken */, sourceFile, options, rulesProvider, 3 /* FormatOnSemicolon */); + } + formatting.formatOnSemicolon = formatOnSemicolon; + function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 14 /* CloseBraceToken */, sourceFile, options, rulesProvider, 4 /* FormatOnClosingCurlyBrace */); + } + formatting.formatOnClosingCurly = formatOnClosingCurly; + function formatDocument(sourceFile, rulesProvider, options) { + var span = { + pos: 0, + end: sourceFile.text.length + }; + return formatSpan(span, sourceFile, options, rulesProvider, 0 /* FormatDocument */); + } + formatting.formatDocument = formatDocument; + function formatSelection(start, end, sourceFile, rulesProvider, options) { + var span = { + pos: ts.getStartLinePositionForPosition(start, sourceFile), + end: end + }; + return formatSpan(span, sourceFile, options, rulesProvider, 1 /* FormatSelection */); + } + formatting.formatSelection = formatSelection; + function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) { + var parent = findOutermostParent(position, expectedLastToken, sourceFile); + if (!parent) { + return []; + } + var span = { + pos: ts.getStartLinePositionForPosition(parent.getStart(sourceFile), sourceFile), + end: parent.end + }; + return formatSpan(span, sourceFile, options, rulesProvider, requestKind); + } + function findOutermostParent(position, expectedTokenKind, sourceFile) { + var precedingToken = ts.findPrecedingToken(position, sourceFile); + if (!precedingToken || precedingToken.kind !== expectedTokenKind) { + return undefined; + } + var current = precedingToken; + while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { + current = current.parent; + } + return current; + } + function isListElement(parent, node) { + switch (parent.kind) { + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + return ts.rangeContainsRange(parent.members, node); + case 191 /* ModuleDeclaration */: + var body = parent.body; + return body && body.kind === 161 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 196 /* SourceFile */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 192 /* ModuleBlock */: + return ts.rangeContainsRange(parent.statements, node); + } + return false; + } + function findEnclosingNode(range, sourceFile) { + return find(sourceFile); + function find(n) { + var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); + if (candidate) { + var result = find(candidate); + if (result) { + return result; + } + } + return n; + } + } + function prepareRangeContainsErrorFunction(errors, originalRange) { + if (!errors.length) { + return rangeHasNoErrors; + } + var sorted = errors.filter(function (d) { return d.isParseError && ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }).sort(function (e1, e2) { return e1.start - e2.start; }); + if (!sorted.length) { + return rangeHasNoErrors; + } + var index = 0; + return function (r) { + while (true) { + if (index >= sorted.length) { + return false; + } + var error = sorted[index]; + if (r.end <= error.start) { + return false; + } + if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) { + return true; + } + index++; + } + }; + function rangeHasNoErrors(r) { + return false; + } + } + function getScanStartPosition(enclosingNode, originalRange, sourceFile) { + var start = enclosingNode.getStart(sourceFile); + if (start === originalRange.pos && enclosingNode.end === originalRange.end) { + return start; + } + var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile); + return precedingToken ? precedingToken.end : enclosingNode.pos; + } + function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { + var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.syntacticErrors, originalRange); + var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); + var enclosingNode = findEnclosingNode(originalRange, sourceFile); + var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); + var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + var previousRangeHasError; + var previousRange; + var previousParent; + var previousRangeStartLine; + var edits = []; + formattingScanner.advance(); + if (formattingScanner.isOnToken()) { + var startLine = sourceFile.getLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; + var delta = formatting.SmartIndenter.shouldIndentChildNode(enclosingNode.kind, 0 /* Unknown */) ? options.IndentSize : 0; + processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); + } + formattingScanner.close(); + return edits; + function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { + if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos)) { + if (inheritedIndentation !== -1 /* Unknown */) { + return inheritedIndentation; + } + } + else { + var startLine = sourceFile.getLineAndCharacterFromPosition(startPos).line; + var startLinePosition = ts.getStartLinePositionForPosition(startPos, sourceFile); + var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); + if (startLine !== parentStartLine || startPos === column) { + return column; + } + } + return -1 /* Unknown */; + } + function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { + var indentation = inheritedIndentation; + if (indentation === -1 /* Unknown */) { + if (isSomeBlock(node.kind)) { + if (isSomeBlock(parent.kind) || parent.kind === 196 /* SourceFile */ || parent.kind === 175 /* CaseClause */ || parent.kind === 176 /* DefaultClause */) { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); + } + else { + indentation = parentDynamicIndentation.getIndentation(); + } + } + else { + if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); + } + } + } + var delta = formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0 /* Unknown */) ? options.IndentSize : 0; + if (effectiveParentStartLine === startLine) { + indentation = parentDynamicIndentation.getIndentation(); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); + } + return { + indentation: indentation, + delta: delta + }; + } + function getDynamicIndentation(node, nodeStartLine, indentation, delta) { + return { + getIndentationForComment: function (kind) { + switch (kind) { + case 14 /* CloseBraceToken */: + case 18 /* CloseBracketToken */: + return indentation + delta; + } + return indentation; + }, + getIndentationForToken: function (line, kind) { + switch (kind) { + case 13 /* OpenBraceToken */: + case 14 /* CloseBraceToken */: + case 17 /* OpenBracketToken */: + case 18 /* CloseBracketToken */: + case 74 /* ElseKeyword */: + case 98 /* WhileKeyword */: + return indentation; + default: + return nodeStartLine !== line ? indentation + delta : indentation; + } + }, + getIndentation: function () { return indentation; }, + getDelta: function () { return delta; }, + recomputeIndentation: function (lineAdded) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { + if (lineAdded) { + indentation += options.IndentSize; + } + else { + indentation -= options.IndentSize; + } + if (formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0 /* Unknown */)) { + delta = options.IndentSize; + } + else { + delta = 0; + } + } + } + }; + } + function processNode(node, contextNode, nodeStartLine, indentation, delta) { + if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { + return; + } + var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta); + var childContextNode = contextNode; + ts.forEachChild(node, function (child) { + processChildNode(child, -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, false); + }, function (nodes) { + processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); + }); + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > node.end) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + } + function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, isListItem) { + var childStartPos = child.getStart(sourceFile); + var childStart = sourceFile.getLineAndCharacterFromPosition(childStartPos); + var childIndentationAmount = -1 /* Unknown */; + if (isListItem) { + childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); + if (childIndentationAmount !== -1 /* Unknown */) { + inheritedIndentation = childIndentationAmount; + } + } + if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) { + return inheritedIndentation; + } + if (child.kind === 120 /* Missing */) { + return inheritedIndentation; + } + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > childStartPos) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + } + if (!formattingScanner.isOnToken()) { + return inheritedIndentation; + } + if (ts.isToken(child)) { + var tokenInfo = formattingScanner.readTokenInfo(node); + ts.Debug.assert(tokenInfo.token.end === child.end); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + return inheritedIndentation; + } + var childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine); + processNode(child, childContextNode, childStart.line, childIndentation.indentation, childIndentation.delta); + childContextNode = node; + return inheritedIndentation; + } + function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { + var listStartToken = getOpenTokenForList(parent, nodes); + var listEndToken = getCloseTokenForOpenToken(listStartToken); + var listDynamicIndentation = parentDynamicIndentation; + var startLine = parentStartLine; + if (listStartToken !== 0 /* Unknown */) { + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.end > nodes.pos) { + break; + } + else if (tokenInfo.token.kind === listStartToken) { + startLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line; + var indentation = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, startLine); + listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + else { + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + } + } + } + var inheritedIndentation = -1 /* Unknown */; + for (var i = 0, len = nodes.length; i < len; ++i) { + inheritedIndentation = processChildNode(nodes[i], inheritedIndentation, node, listDynamicIndentation, startLine, true); + } + if (listEndToken !== 0 /* Unknown */) { + if (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.kind === listEndToken) { + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + } + } + } + function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation) { + ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token)); + var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); + var indentToken = false; + if (currentTokenInfo.leadingTrivia) { + processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation); + } + var lineAdded; + var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token); + var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos); + if (isTokenInRange) { + var prevStartLine = previousRangeStartLine; + lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation); + if (lineAdded !== undefined) { + indentToken = lineAdded; + } + else { + indentToken = lastTriviaWasNewLine && tokenStart.line !== prevStartLine; + } + } + if (currentTokenInfo.trailingTrivia) { + processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation); + } + if (indentToken) { + var indentNextTokenOrTrivia = true; + if (currentTokenInfo.leadingTrivia) { + for (var i = 0, len = currentTokenInfo.leadingTrivia.length; i < len; ++i) { + var triviaItem = currentTokenInfo.leadingTrivia[i]; + if (!ts.rangeContainsRange(originalRange, triviaItem)) { + continue; + } + var triviaStartLine = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos).line; + switch (triviaItem.kind) { + case 3 /* MultiLineCommentTrivia */: + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); + indentNextTokenOrTrivia = false; + break; + case 2 /* SingleLineCommentTrivia */: + if (indentNextTokenOrTrivia) { + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + insertIndentation(triviaItem.pos, commentIndentation, false); + indentNextTokenOrTrivia = false; + } + break; + case 4 /* NewLineTrivia */: + indentNextTokenOrTrivia = true; + break; + } + } + } + if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { + var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); + } + } + formattingScanner.advance(); + childContextNode = parent; + } + } + function processTrivia(trivia, parent, contextNode, dynamicIndentation) { + for (var i = 0, len = trivia.length; i < len; ++i) { + var triviaItem = trivia[i]; + if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { + var triviaItemStart = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos); + processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); + } + } + } + function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) { + var rangeHasError = rangeContainsError(range); + var lineAdded; + if (!rangeHasError && !previousRangeHasError) { + if (!previousRange) { + var originalStart = sourceFile.getLineAndCharacterFromPosition(originalRange.pos); + trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); + } + else { + lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + } + } + previousRange = range; + previousParent = parent; + previousRangeStartLine = rangeStart.line; + previousRangeHasError = rangeHasError; + return lineAdded; + } + function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) { + formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode); + var rule = rulesProvider.getRulesMap().GetRule(formattingContext); + var trimTrailingWhitespaces; + var lineAdded; + if (rule) { + applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine); + if (rule.Operation.Action & (2 /* Space */ | 8 /* Delete */) && currentStartLine !== previousStartLine) { + if (currentParent.getStart(sourceFile) === currentItem.pos) { + lineAdded = false; + } + } + else if (rule.Operation.Action & 4 /* NewLine */ && currentStartLine === previousStartLine) { + if (currentParent.getStart(sourceFile) === currentItem.pos) { + lineAdded = true; + } + } + if (lineAdded !== undefined) { + dynamicIndentation.recomputeIndentation(lineAdded); + } + trimTrailingWhitespaces = (rule.Operation.Action & (4 /* NewLine */ | 2 /* Space */)) && rule.Flag !== 1 /* CanDeleteNewLines */; + } + else { + trimTrailingWhitespaces = true; + } + if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) { + trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem); + } + return lineAdded; + } + function insertIndentation(pos, indentation, lineAdded) { + var indentationString = formatting.getIndentationString(indentation, options); + if (lineAdded) { + recordReplace(pos, 0, indentationString); + } + else { + var tokenStart = sourceFile.getLineAndCharacterFromPosition(pos); + if (indentation !== tokenStart.character - 1) { + var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + recordReplace(startLinePosition, tokenStart.character - 1, indentationString); + } + } + } + function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { + var startLine = sourceFile.getLineAndCharacterFromPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterFromPosition(commentRange.end).line; + if (startLine === endLine) { + if (!firstLineIsIndented) { + insertIndentation(commentRange.pos, indentation, false); + } + return; + } + else { + var parts = []; + var startPos = commentRange.pos; + for (var line = startLine; line < endLine; ++line) { + var endOfLine = ts.getEndLinePosition(line, sourceFile); + parts.push({ pos: startPos, end: endOfLine }); + startPos = ts.getStartPositionOfLine(line + 1, sourceFile); + } + parts.push({ pos: startPos, end: commentRange.end }); + } + var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePos, parts[0].pos, sourceFile, options); + if (indentation === nonWhitespaceColumnInFirstPart) { + return; + } + var startIndex = 0; + if (firstLineIsIndented) { + startIndex = 1; + startLine++; + } + var delta = indentation - nonWhitespaceColumnInFirstPart; + for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { + var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceColumn(parts[i].pos, parts[i].end, sourceFile, options); + var newIndentation = nonWhitespaceColumn + delta; + if (newIndentation > 0) { + var indentationString = formatting.getIndentationString(newIndentation, options); + recordReplace(startLinePos, nonWhitespaceColumn, indentationString); + } + else { + recordDelete(startLinePos, nonWhitespaceColumn); + } + } + } + function trimTrailingWhitespacesForLines(line1, line2, range) { + for (var line = line1; line < line2; ++line) { + var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); + var lineEndPosition = ts.getEndLinePosition(line, sourceFile); + if (range && ts.isComment(range.kind) && range.pos <= lineEndPosition && range.end > lineEndPosition) { + continue; + } + var pos = lineEndPosition; + while (pos >= lineStartPosition && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== lineEndPosition) { + ts.Debug.assert(pos === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))); + recordDelete(pos + 1, lineEndPosition - pos); + } + } + } + function newTextChange(start, len, newText) { + return { span: new ts.TextSpan(start, len), newText: newText }; + } + function recordDelete(start, len) { + if (len) { + edits.push(newTextChange(start, len, "")); + } + } + function recordReplace(start, len, newText) { + if (len || newText) { + edits.push(newTextChange(start, len, newText)); + } + } + function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) { + var between; + switch (rule.Operation.Action) { + case 1 /* Ignore */: + return; + case 8 /* Delete */: + if (previousRange.end !== currentRange.pos) { + recordDelete(previousRange.end, currentRange.pos - previousRange.end); + } + break; + case 4 /* NewLine */: + if (rule.Flag !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) { + return; + } + var lineDelta = currentStartLine - previousStartLine; + if (lineDelta !== 1) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.NewLineCharacter); + } + break; + case 2 /* Space */: + if (rule.Flag !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) { + return; + } + var posDelta = currentRange.pos - previousRange.end; + if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== 32 /* space */) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, " "); + } + break; + } + } + } + function isSomeBlock(kind) { + switch (kind) { + case 161 /* Block */: + case 186 /* FunctionBlock */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 192 /* ModuleBlock */: + return true; + } + return false; + } + function getOpenTokenForList(node, list) { + switch (node.kind) { + case 126 /* Constructor */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 125 /* Method */: + case 153 /* ArrowFunction */: + if (node.typeParameters === list) { + return 23 /* LessThanToken */; + } + else if (node.parameters === list) { + return 15 /* OpenParenToken */; + } + break; + case 147 /* CallExpression */: + case 148 /* NewExpression */: + if (node.typeArguments === list) { + return 23 /* LessThanToken */; + } + else if (node.arguments === list) { + return 15 /* OpenParenToken */; + } + break; + case 132 /* TypeReference */: + if (node.typeArguments === list) { + return 23 /* LessThanToken */; + } + } + return 0 /* Unknown */; + } + function getCloseTokenForOpenToken(kind) { + switch (kind) { + case 15 /* OpenParenToken */: + return 16 /* CloseParenToken */; + case 23 /* LessThanToken */: + return 24 /* GreaterThanToken */; + } + return 0 /* Unknown */; + } + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var ScriptSnapshot; + (function (ScriptSnapshot) { + var StringScriptSnapshot = (function () { + function StringScriptSnapshot(text) { + this.text = text; + this._lineStartPositions = undefined; + } + StringScriptSnapshot.prototype.getText = function (start, end) { + return this.text.substring(start, end); + }; + StringScriptSnapshot.prototype.getLength = function () { + return this.text.length; + }; + StringScriptSnapshot.prototype.getLineStartPositions = function () { + if (!this._lineStartPositions) { + this._lineStartPositions = ts.computeLineStarts(this.text); + } + return this._lineStartPositions; + }; + StringScriptSnapshot.prototype.getChangeRange = function (oldSnapshot) { + throw new Error("not yet implemented"); + }; + return StringScriptSnapshot; + })(); + function fromString(text) { + return new StringScriptSnapshot(text); + } + ScriptSnapshot.fromString = fromString; + })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})); var scanner = ts.createScanner(2 /* Latest */, true); var emptyArray = []; function createNode(kind, pos, end, flags, parent) { @@ -31217,13 +19144,13 @@ var ts; while (pos < end) { var token = scanner.scan(); var textPos = scanner.getTextPos(); - var node = nodes.push(createNode(token, pos, textPos, 512 /* Synthetic */, this)); + nodes.push(createNode(token, pos, textPos, 512 /* Synthetic */, this)); pos = textPos; } return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(195 /* SyntaxList */, nodes.pos, nodes.end, 512 /* Synthetic */, this); + var list = createNode(198 /* SyntaxList */, nodes.pos, nodes.end, 512 /* Synthetic */, this); list._children = []; var pos = nodes.pos; for (var i = 0, len = nodes.length; i < len; i++) { @@ -31349,13 +19276,13 @@ var ts; } }); } - if (declaration.kind === 188 /* ModuleDeclaration */ && declaration.body.kind === 188 /* ModuleDeclaration */) { + if (declaration.kind === 191 /* ModuleDeclaration */ && declaration.body.kind === 191 /* ModuleDeclaration */) { return; } - while (declaration.kind === 188 /* ModuleDeclaration */ && declaration.parent.kind === 188 /* ModuleDeclaration */) { + while (declaration.kind === 191 /* ModuleDeclaration */ && declaration.parent.kind === 191 /* ModuleDeclaration */) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 181 /* VariableDeclaration */ ? declaration.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 184 /* VariableDeclaration */ ? declaration.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -31390,14 +19317,20 @@ var ts; return pos; } function isName(pos, end, sourceFile, name) { - return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)); + return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos, end, sourceFile) { return isName(pos, end, sourceFile, paramTag); } + function pushDocCommentLineText(docComments, text, blankLineCount) { + while (blankLineCount--) + docComments.push(textPart("")); + docComments.push(textPart(text)); + } function getCleanedJsDocComment(pos, end, sourceFile) { var spacesToRemoveAfterAsterisk; var docComments = []; + var blankLineCount = 0; var isInParamTag = false; while (pos < end) { var docCommentTextOfLine = ""; @@ -31431,7 +19364,11 @@ var ts; } pos = consumeLineBreaks(pos, end, sourceFile); if (docCommentTextOfLine) { - docComments.push(textPart(docCommentTextOfLine)); + pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); + blankLineCount = 0; + } + else if (!isInParamTag && docComments.length) { + blankLineCount++; } } return docComments; @@ -31441,6 +19378,8 @@ var ts; var paramDocComments = []; while (pos < end) { if (isParamTag(pos, end, sourceFile)) { + var blankLineCount = 0; + var recordedParamTag = false; pos = consumeWhiteSpaces(pos + paramTag.length); if (pos >= end) { break; @@ -31483,8 +19422,13 @@ var ts; var ch = sourceFile.text.charCodeAt(pos); if (ts.isLineBreak(ch)) { if (paramHelpString) { - paramDocComments.push(textPart(paramHelpString)); + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); paramHelpString = ""; + blankLineCount = 0; + recordedParamTag = true; + } + else if (recordedParamTag) { + blankLineCount++; } setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos); continue; @@ -31496,7 +19440,7 @@ var ts; pos++; } if (paramHelpString) { - paramDocComments.push(textPart(paramHelpString)); + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); } paramHelpStringMargin = undefined; } @@ -31589,13 +19533,12 @@ var ts; }; SignatureObject.prototype.getDocumentationComment = function () { if (this.documentationComment === undefined) { - this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], this.declaration.name ? this.declaration.name.text : "", false) : []; + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; } return this.documentationComment; }; return SignatureObject; })(); - var incrementalParse = TypeScript.IncrementalParser.parse; var SourceFileObject = (function (_super) { __extends(SourceFileObject, _super); function SourceFileObject() { @@ -31607,6 +19550,9 @@ var ts; SourceFileObject.prototype.getPositionFromLineAndCharacter = function (line, character) { return -1; }; + SourceFileObject.prototype.getLineStarts = function () { + return undefined; + }; SourceFileObject.prototype.getScriptSnapshot = function () { return this.scriptSnapshot; }; @@ -31616,7 +19562,7 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: case 125 /* Method */: var functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.kind !== 120 /* Missing */) { @@ -31632,30 +19578,30 @@ var ts; ts.forEachChild(node, visit); } break; - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 187 /* EnumDeclaration */: - case 188 /* ModuleDeclaration */: - case 190 /* ImportDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 190 /* EnumDeclaration */: + case 191 /* ModuleDeclaration */: + case 193 /* ImportDeclaration */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 134 /* TypeLiteral */: + case 136 /* TypeLiteral */: if (node.name) { namedDeclarations.push(node); } case 126 /* Constructor */: - case 159 /* VariableStatement */: - case 189 /* ModuleBlock */: - case 183 /* FunctionBlock */: + case 162 /* VariableStatement */: + case 192 /* ModuleBlock */: + case 186 /* FunctionBlock */: ts.forEachChild(node, visit); break; case 123 /* Parameter */: if (!(node.flags & 112 /* AccessibilityModifier */)) { break; } - case 181 /* VariableDeclaration */: - case 192 /* EnumMember */: + case 184 /* VariableDeclaration */: + case 195 /* EnumMember */: case 124 /* Property */: namedDeclarations.push(node); break; @@ -31665,21 +19611,18 @@ var ts; } return this.namedDeclarations; }; - SourceFileObject.prototype.isDeclareFile = function () { - return TypeScript.isDTSFile(this.filename); - }; SourceFileObject.prototype.update = function (scriptSnapshot, version, isOpen, textChangeRange) { if (textChangeRange && ts.Debug.shouldAssert(1 /* Normal */)) { var oldText = this.scriptSnapshot; var newText = scriptSnapshot; - TypeScript.Debug.assert((oldText.getLength() - textChangeRange.span().length() + textChangeRange.newLength()) === newText.getLength()); + ts.Debug.assert((oldText.getLength() - textChangeRange.span().length() + textChangeRange.newLength()) === newText.getLength()); if (ts.Debug.shouldAssert(3 /* VeryAggressive */)) { var oldTextPrefix = oldText.getText(0, textChangeRange.span().start()); var newTextPrefix = newText.getText(0, textChangeRange.span().start()); - TypeScript.Debug.assert(oldTextPrefix === newTextPrefix); + ts.Debug.assert(oldTextPrefix === newTextPrefix); var oldTextSuffix = oldText.getText(textChangeRange.span().end(), oldText.getLength()); var newTextSuffix = newText.getText(textChangeRange.newSpan().end(), newText.getLength()); - TypeScript.Debug.assert(oldTextSuffix === newTextSuffix); + ts.Debug.assert(oldTextSuffix === newTextSuffix); } } return SourceFileObject.createSourceFileObject(this.filename, scriptSnapshot, this.languageVersion, version, isOpen); @@ -31901,14 +19844,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 149 /* FunctionExpression */) { + if (declaration.kind === 152 /* FunctionExpression */) { return true; } - if (declaration.kind !== 181 /* VariableDeclaration */ && declaration.kind !== 182 /* FunctionDeclaration */) { + if (declaration.kind !== 184 /* VariableDeclaration */ && declaration.kind !== 185 /* FunctionDeclaration */) { return false; } - for (var parent = declaration.parent; parent.kind !== 183 /* FunctionBlock */; parent = parent.parent) { - if (parent.kind === 193 /* SourceFile */ || parent.kind === 189 /* ModuleBlock */) { + for (var parent = declaration.parent; parent.kind !== 186 /* FunctionBlock */; parent = parent.parent) { + if (parent.kind === 196 /* SourceFile */ || parent.kind === 192 /* ModuleBlock */) { return false; } } @@ -32027,7 +19970,7 @@ var ts; var filenames = host.getScriptFileNames(); for (var i = 0, n = filenames.length; i < n; i++) { var filename = filenames[i]; - this.filenameToEntry[TypeScript.switchToForwardSlashes(filename)] = { + this.filenameToEntry[ts.normalizeSlashes(filename)] = { filename: filename, version: host.getScriptVersion(filename), isOpen: host.getScriptIsOpen(filename) @@ -32039,7 +19982,7 @@ var ts; return this._compilationSettings; }; HostCache.prototype.getEntry = function (filename) { - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); return ts.lookUp(this.filenameToEntry, filename); }; HostCache.prototype.contains = function (filename) { @@ -32077,7 +20020,7 @@ var ts; HostCache.prototype.getChangeRange = function (filename, lastKnownVersion, oldScriptSnapshot) { var currentVersion = this.getVersion(filename); if (lastKnownVersion === currentVersion) { - return TypeScript.TextChangeRange.unchanged; + return ts.TextChangeRange.unchanged; } var scriptSnapshot = this.getScriptSnapshot(filename); return scriptSnapshot.getChangeRange(oldScriptSnapshot); @@ -32090,23 +20033,17 @@ var ts; this.currentFilename = ""; this.currentFileVersion = null; this.currentSourceFile = null; - this.currentFileSyntaxTree = null; this.hostCache = new HostCache(host); } SyntaxTreeCache.prototype.initialize = function (filename) { - ts.Debug.assert(!!this.currentFileSyntaxTree === !!this.currentSourceFile); var start = new Date().getTime(); this.hostCache = new HostCache(this.host); this.host.log("SyntaxTreeCache.Initialize: new HostCache: " + (new Date().getTime() - start)); var version = this.hostCache.getVersion(filename); - var syntaxTree = null; var sourceFile; - if (this.currentFileSyntaxTree === null || this.currentFilename !== filename) { + if (this.currentFilename !== filename) { var scriptSnapshot = this.hostCache.getScriptSnapshot(filename); var start = new Date().getTime(); - syntaxTree = this.createSyntaxTree(filename, scriptSnapshot); - this.host.log("SyntaxTreeCache.Initialize: createSyntaxTree: " + (new Date().getTime() - start)); - var start = new Date().getTime(); sourceFile = createSourceFileFromScriptSnapshot(filename, scriptSnapshot, getDefaultCompilerOptions(), version, true); this.host.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start)); var start = new Date().getTime(); @@ -32115,9 +20052,6 @@ var ts; } else if (this.currentFileVersion !== version) { var scriptSnapshot = this.hostCache.getScriptSnapshot(filename); - var start = new Date().getTime(); - syntaxTree = this.updateSyntaxTree(filename, scriptSnapshot, this.currentSourceFile.getScriptSnapshot(), this.currentFileSyntaxTree, this.currentFileVersion); - this.host.log("SyntaxTreeCache.Initialize: updateSyntaxTree: " + (new Date().getTime() - start)); var editRange = this.hostCache.getChangeRange(filename, this.currentFileVersion, this.currentSourceFile.getScriptSnapshot()); var start = new Date().getTime(); sourceFile = !editRange ? createSourceFileFromScriptSnapshot(filename, scriptSnapshot, getDefaultCompilerOptions(), version, true) : this.currentSourceFile.update(scriptSnapshot, version, true, editRange); @@ -32126,11 +20060,9 @@ var ts; fixupParentReferences(sourceFile); this.host.log("SyntaxTreeCache.Initialize: fixupParentRefs : " + (new Date().getTime() - start)); } - if (syntaxTree !== null) { - ts.Debug.assert(sourceFile !== undefined); + if (sourceFile) { this.currentFileVersion = version; this.currentFilename = filename; - this.currentFileSyntaxTree = syntaxTree; this.currentSourceFile = sourceFile; } function fixupParentReferences(sourceFile) { @@ -32145,61 +20077,13 @@ var ts; ts.forEachChild(sourceFile, walk); } }; - SyntaxTreeCache.prototype.getCurrentFileSyntaxTree = function (filename) { - this.initialize(filename); - return this.currentFileSyntaxTree; - }; SyntaxTreeCache.prototype.getCurrentSourceFile = function (filename) { this.initialize(filename); return this.currentSourceFile; }; SyntaxTreeCache.prototype.getCurrentScriptSnapshot = function (filename) { - this.getCurrentFileSyntaxTree(filename); return this.getCurrentSourceFile(filename).getScriptSnapshot(); }; - SyntaxTreeCache.prototype.createSyntaxTree = function (filename, scriptSnapshot) { - var text = TypeScript.SimpleText.fromScriptSnapshot(scriptSnapshot); - var syntaxTree = TypeScript.Parser.parse(filename, text, getDefaultCompilerOptions().target, TypeScript.isDTSFile(filename)); - return syntaxTree; - }; - SyntaxTreeCache.prototype.updateSyntaxTree = function (filename, scriptSnapshot, previousScriptSnapshot, previousSyntaxTree, previousFileVersion) { - var editRange = this.hostCache.getChangeRange(filename, previousFileVersion, previousScriptSnapshot); - if (editRange === null) { - return this.createSyntaxTree(filename, scriptSnapshot); - } - var nextSyntaxTree = TypeScript.IncrementalParser.parse(previousSyntaxTree, editRange, TypeScript.SimpleText.fromScriptSnapshot(scriptSnapshot)); - this.ensureInvariants(filename, editRange, nextSyntaxTree, previousScriptSnapshot, scriptSnapshot); - return nextSyntaxTree; - }; - SyntaxTreeCache.prototype.ensureInvariants = function (filename, editRange, incrementalTree, oldScriptSnapshot, newScriptSnapshot) { - var expectedNewLength = oldScriptSnapshot.getLength() - editRange.span().length() + editRange.newLength(); - var actualNewLength = newScriptSnapshot.getLength(); - function provideMoreDebugInfo() { - var debugInformation = ["expected length:", expectedNewLength, "and actual length:", actualNewLength, "are not equal\r\n"]; - var oldSpan = editRange.span(); - function prettyPrintString(s) { - return '"' + s.replace(/\r/g, '\\r').replace(/\n/g, '\\n') + '"'; - } - debugInformation.push('Edit range (old text) (start: ' + oldSpan.start() + ', end: ' + oldSpan.end() + ') \r\n'); - debugInformation.push('Old text edit range contents: ' + prettyPrintString(oldScriptSnapshot.getText(oldSpan.start(), oldSpan.end()))); - var newSpan = editRange.newSpan(); - debugInformation.push('Edit range (new text) (start: ' + newSpan.start() + ', end: ' + newSpan.end() + ') \r\n'); - debugInformation.push('New text edit range contents: ' + prettyPrintString(newScriptSnapshot.getText(newSpan.start(), newSpan.end()))); - return debugInformation.join(' '); - } - ts.Debug.assert(expectedNewLength === actualNewLength, "Expected length is different from actual!", provideMoreDebugInfo); - if (ts.Debug.shouldAssert(3 /* VeryAggressive */)) { - var oldPrefixText = oldScriptSnapshot.getText(0, editRange.span().start()); - var newPrefixText = newScriptSnapshot.getText(0, editRange.span().start()); - ts.Debug.assert(oldPrefixText === newPrefixText, 'Expected equal prefix texts!'); - var oldSuffixText = oldScriptSnapshot.getText(editRange.span().end(), oldScriptSnapshot.getLength()); - var newSuffixText = newScriptSnapshot.getText(editRange.newSpan().end(), newScriptSnapshot.getLength()); - ts.Debug.assert(oldSuffixText === newSuffixText, 'Expected equal suffix texts!'); - var incrementalTreeText = TypeScript.fullText(incrementalTree.sourceUnit()); - var actualSnapshotText = newScriptSnapshot.getText(0, newScriptSnapshot.getLength()); - ts.Debug.assert(incrementalTreeText === actualSnapshotText, 'Expected full texts to be equal'); - } - }; return SyntaxTreeCache; })(); function createSourceFileFromScriptSnapshot(filename, scriptSnapshot, settings, version, isOpen) { @@ -32281,6 +20165,64 @@ var ts; }; } ts.createDocumentRegistry = createDocumentRegistry; + function preProcessFile(sourceText, readImportFiles) { + if (readImportFiles === void 0) { readImportFiles = true; } + var referencedFiles = []; + var importedFiles = []; + var isNoDefaultLib = false; + function processTripleSlashDirectives() { + var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); + ts.forEach(commentRanges, function (commentRange) { + var comment = sourceText.substring(commentRange.pos, commentRange.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange); + if (referencePathMatchResult) { + isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var fileReference = referencePathMatchResult.fileReference; + if (fileReference) { + referencedFiles.push(fileReference); + } + } + }); + } + function processImport() { + scanner.setText(sourceText); + var token = scanner.scan(); + while (token !== 1 /* EndOfFileToken */) { + if (token === 83 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 63 /* Identifier */) { + token = scanner.scan(); + if (token === 51 /* EqualsToken */) { + token = scanner.scan(); + if (token === 115 /* RequireKeyword */) { + token = scanner.scan(); + if (token === 15 /* OpenParenToken */) { + token = scanner.scan(); + if (token === 7 /* StringLiteral */) { + var importPath = scanner.getTokenValue(); + var pos = scanner.getTokenPos(); + importedFiles.push({ + filename: importPath, + pos: pos, + end: pos + importPath.length + }); + } + } + } + } + } + } + token = scanner.scan(); + } + scanner.setText(undefined); + } + if (readImportFiles) { + processImport(); + } + processTripleSlashDirectives(); + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + } + ts.preProcessFile = preProcessFile; function getNodeModifiers(node) { var flags = node.flags; var result = []; @@ -32301,7 +20243,7 @@ var ts; ts.getNodeModifiers = getNodeModifiers; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 174 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 177 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -32309,13 +20251,13 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 63 /* Identifier */ && (node.parent.kind === 168 /* BreakStatement */ || node.parent.kind === 167 /* ContinueStatement */) && node.parent.label === node; + return node.kind === 63 /* Identifier */ && (node.parent.kind === 171 /* BreakStatement */ || node.parent.kind === 170 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 63 /* Identifier */ && node.parent.kind === 174 /* LabeledStatement */ && node.parent.label === node; + return node.kind === 63 /* Identifier */ && node.parent.kind === 177 /* LabeledStatement */ && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 174 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 177 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -32329,48 +20271,48 @@ var ts; return node.parent.kind === 121 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 142 /* PropertyAccess */ && node.parent.right === node; + return node && node.parent && node.parent.kind === 145 /* PropertyAccess */ && node.parent.right === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 144 /* CallExpression */ && node.parent.func === node; + return node && node.parent && node.parent.kind === 147 /* CallExpression */ && node.parent.func === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 145 /* NewExpression */ && node.parent.func === node; + return node && node.parent && node.parent.kind === 148 /* NewExpression */ && node.parent.func === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 188 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 191 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 63 /* Identifier */ && ts.isAnyFunction(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 63 /* Identifier */ || node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) && node.parent.kind === 141 /* PropertyAssignment */ && node.parent.name === node; + return (node.kind === 63 /* Identifier */ || node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) && (node.parent.kind === 143 /* PropertyAssignment */ || node.parent.kind === 144 /* ShorthandPropertyAssignment */) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) { switch (node.parent.kind) { case 124 /* Property */: - case 141 /* PropertyAssignment */: - case 192 /* EnumMember */: + case 143 /* PropertyAssignment */: + case 195 /* EnumMember */: case 125 /* Method */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: return node.parent.name === node; - case 143 /* IndexedAccess */: + case 146 /* IndexedAccess */: return node.parent.index === node; } } return false; } function isNameOfExternalModuleImportOrDeclaration(node) { - return node.kind === 7 /* StringLiteral */ && (isNameOfModuleDeclaration(node) || (node.parent.kind === 190 /* ImportDeclaration */ && node.parent.externalModuleName === node)); + return node.kind === 7 /* StringLiteral */ && (isNameOfModuleDeclaration(node) || (node.parent.kind === 193 /* ImportDeclaration */ && node.parent.externalModuleName === node)); } function isInsideComment(sourceFile, token, position) { return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); @@ -32403,7 +20345,7 @@ var ts; } function createLanguageService(host, documentRegistry) { var syntaxTreeCache = new SyntaxTreeCache(host); - var formattingRulesProvider; + var ruleProvider; var hostCache; var program; var typeInfoResolver; @@ -32423,6 +20365,13 @@ var ts; function getFullTypeCheckChecker() { return fullTypeCheckChecker_doNotAccessDirectly || (fullTypeCheckChecker_doNotAccessDirectly = program.getTypeChecker(true)); } + function getRuleProvider(options) { + if (!ruleProvider) { + ruleProvider = new ts.formatting.RulesProvider(host); + } + ruleProvider.ensureUpToDate(options); + return ruleProvider; + } function createCompilerHost() { return { getSourceFile: function (filename, languageVersion) { @@ -32524,12 +20473,12 @@ var ts; } function getSyntacticDiagnostics(filename) { synchronizeHostData(); - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); return program.getDiagnostics(getSourceFile(filename).getSourceFile()); } function getSemanticDiagnostics(filename) { synchronizeHostData(); - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var compilerOptions = program.getCompilerOptions(); var checker = getFullTypeCheckChecker(); var targetSourceFile = getSourceFile(filename); @@ -32562,25 +20511,25 @@ var ts; isValid = ts.isIdentifierPart(displayName.charCodeAt(i), target); } if (isValid) { - return displayName; + return ts.unescapeIdentifier(displayName); } } return undefined; } - function createCompletionEntry(symbol, typeChecker) { + function createCompletionEntry(symbol, typeChecker, location) { var displayName = getValidCompletionEntryDisplayName(symbol, program.getCompilerOptions().target); if (!displayName) { return undefined; } return { name: displayName, - kind: getSymbolKind(symbol, typeChecker), + kind: getSymbolKind(symbol, typeChecker, location), kindModifiers: getSymbolModifiers(symbol) }; } function getCompletionsAtPosition(filename, position, isMemberCompletion) { synchronizeHostData(); - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var syntacticStart = new Date().getTime(); var sourceFile = getSourceFile(filename); var start = new Date().getTime(); @@ -32607,7 +20556,7 @@ var ts; } var node; var isRightOfDot; - if (previousToken && previousToken.kind === 19 /* DotToken */ && (previousToken.parent.kind === 142 /* PropertyAccess */ || previousToken.parent.kind === 121 /* QualifiedName */)) { + if (previousToken && previousToken.kind === 19 /* DotToken */ && (previousToken.parent.kind === 145 /* PropertyAccess */ || previousToken.parent.kind === 121 /* QualifiedName */)) { node = previousToken.parent.left; isRightOfDot = true; } @@ -32623,11 +20572,12 @@ var ts; typeChecker: typeInfoResolver }; host.log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); + var location = ts.getTouchingPropertyName(sourceFile, position); var semanticStart = new Date().getTime(); if (isRightOfDot) { var symbols = []; isMemberCompletion = true; - if (node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */ || node.kind === 142 /* PropertyAccess */) { + if (node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */ || node.kind === 145 /* PropertyAccess */) { var symbol = typeInfoResolver.getSymbolInfo(node); if (symbol && symbol.flags & 33554432 /* Import */) { symbol = typeInfoResolver.getAliasedSymbol(symbol); @@ -32682,18 +20632,21 @@ var ts; function getCompletionEntriesFromSymbols(symbols, session) { var start = new Date().getTime(); ts.forEach(symbols, function (symbol) { - var entry = createCompletionEntry(symbol, session.typeChecker); - if (entry && !ts.lookUp(session.symbols, entry.name)) { - session.entries.push(entry); - session.symbols[entry.name] = symbol; + var entry = createCompletionEntry(symbol, session.typeChecker, location); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!ts.lookUp(session.symbols, id)) { + session.entries.push(entry); + session.symbols[id] = symbol; + } } }); - host.log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - semanticStart)); + host.log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); } function isCompletionListBlocker(previousToken) { var start = new Date().getTime(); var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); - host.log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - semanticStart)); + host.log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { @@ -32733,7 +20686,7 @@ var ts; switch (previousToken.kind) { case 13 /* OpenBraceToken */: case 22 /* CommaToken */: - if (parent && parent.kind === 140 /* ObjectLiteral */) { + if (parent && parent.kind === 142 /* ObjectLiteral */) { return parent; } break; @@ -32743,9 +20696,9 @@ var ts; } function isFunction(kind) { switch (kind) { - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: - case 182 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: + case 185 /* FunctionDeclaration */: case 125 /* Method */: case 126 /* Constructor */: case 127 /* GetAccessor */: @@ -32762,13 +20715,13 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 22 /* CommaToken */: - return containingNodeKind === 181 /* VariableDeclaration */ || containingNodeKind === 159 /* VariableStatement */ || containingNodeKind === 187 /* EnumDeclaration */ || isFunction(containingNodeKind); + return containingNodeKind === 184 /* VariableDeclaration */ || containingNodeKind === 162 /* VariableStatement */ || containingNodeKind === 190 /* EnumDeclaration */ || isFunction(containingNodeKind); case 15 /* OpenParenToken */: - return containingNodeKind === 178 /* CatchBlock */ || isFunction(containingNodeKind); + return containingNodeKind === 181 /* CatchBlock */ || isFunction(containingNodeKind); case 13 /* OpenBraceToken */: - return containingNodeKind === 187 /* EnumDeclaration */ || containingNodeKind === 185 /* InterfaceDeclaration */; + return containingNodeKind === 190 /* EnumDeclaration */ || containingNodeKind === 188 /* InterfaceDeclaration */; case 21 /* SemicolonToken */: - return containingNodeKind === 124 /* Property */ && previousToken.parent.parent.kind === 185 /* InterfaceDeclaration */; + return containingNodeKind === 124 /* Property */ && previousToken.parent.parent.kind === 188 /* InterfaceDeclaration */; case 106 /* PublicKeyword */: case 104 /* PrivateKeyword */: case 107 /* StaticKeyword */: @@ -32782,6 +20735,7 @@ var ts; case 96 /* VarKeyword */: case 113 /* GetKeyword */: case 117 /* SetKeyword */: + case 83 /* ImportKeyword */: return true; } switch (previousToken.getText()) { @@ -32809,7 +20763,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 141 /* PropertyAssignment */) { + if (m.kind !== 143 /* PropertyAssignment */ && m.kind !== 144 /* ShorthandPropertyAssignment */) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -32827,18 +20781,17 @@ var ts; } } function getCompletionEntryDetails(filename, position, entryName) { - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var sourceFile = getSourceFile(filename); var session = activeCompletionSession; if (!session || session.filename !== filename || session.position !== position) { return undefined; } - var symbol = ts.lookUp(activeCompletionSession.symbols, entryName); + var symbol = ts.lookUp(activeCompletionSession.symbols, ts.escapeIdentifier(entryName)); if (symbol) { - var type = session.typeChecker.getTypeOfSymbol(symbol); - ts.Debug.assert(type !== undefined, "Could not find type for symbol"); - var completionEntry = createCompletionEntry(symbol, session.typeChecker); var location = ts.getTouchingPropertyName(sourceFile, position); + var completionEntry = createCompletionEntry(symbol, session.typeChecker, location); + ts.Debug.assert(session.typeChecker.getNarrowedTypeOfSymbol(symbol, location) !== undefined, "Could not find type for symbol"); var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getSourceFile(filename), location, session.typeChecker, location, 7 /* All */); return { name: entryName, @@ -32865,21 +20818,21 @@ var ts; return node; } switch (node.kind) { - case 193 /* SourceFile */: + case 196 /* SourceFile */: case 125 /* Method */: - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 184 /* ClassDeclaration */: - case 185 /* InterfaceDeclaration */: - case 187 /* EnumDeclaration */: - case 188 /* ModuleDeclaration */: + case 187 /* ClassDeclaration */: + case 188 /* InterfaceDeclaration */: + case 190 /* EnumDeclaration */: + case 191 /* ModuleDeclaration */: return node; } } } - function getSymbolKind(symbol, typeResolver) { + function getSymbolKind(symbol, typeResolver, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) return ScriptElementKind.classElement; @@ -32891,7 +20844,7 @@ var ts; return ScriptElementKind.interfaceElement; if (flags & 1048576 /* TypeParameter */) return ScriptElementKind.typeParameterElement; - var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver); + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location); if (result === ScriptElementKind.unknown) { if (flags & 1048576 /* TypeParameter */) return ScriptElementKind.typeParameterElement; @@ -32902,7 +20855,7 @@ var ts; } return result; } - function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver) { + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location) { if (typeResolver.isUndefinedSymbol(symbol)) { return ScriptElementKind.variableElement; } @@ -32930,17 +20883,21 @@ var ts; return ScriptElementKind.constructorImplementationElement; if (flags & 4 /* Property */) { if (flags & 1073741824 /* UnionProperty */) { - return ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { + var unionPropertyKind = ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { var rootSymbolFlags = rootSymbol.getFlags(); - if (rootSymbolFlags & 4 /* Property */) { + if (rootSymbolFlags & (98308 /* PropertyOrAccessor */ | 3 /* Variable */)) { return ScriptElementKind.memberVariableElement; } - if (rootSymbolFlags & 32768 /* GetAccessor */) - return ScriptElementKind.memberVariableElement; - if (rootSymbolFlags & 65536 /* SetAccessor */) - return ScriptElementKind.memberVariableElement; - ts.Debug.assert((rootSymbolFlags & 8192 /* Method */) !== undefined); - }) || ScriptElementKind.memberFunctionElement; + ts.Debug.assert(!!(rootSymbolFlags & 8192 /* Method */)); + }); + if (!unionPropertyKind) { + var typeOfUnionProperty = typeInfoResolver.getNarrowedTypeOfSymbol(symbol, location); + if (typeOfUnionProperty.getCallSignatures().length) { + return ScriptElementKind.memberFunctionElement; + } + return ScriptElementKind.memberVariableElement; + } + return unionPropertyKind; } return ScriptElementKind.memberVariableElement; } @@ -32964,13 +20921,13 @@ var ts; } function getNodeKind(node) { switch (node.kind) { - case 188 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 184 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 185 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 186 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 187 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 181 /* VariableDeclaration */: return node.flags & 4096 /* Const */ ? ScriptElementKind.constantElement : ScriptElementKind.variableElement; - case 182 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 191 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 187 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 188 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 189 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 190 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 184 /* VariableDeclaration */: return node.flags & 4096 /* Const */ ? ScriptElementKind.constantElement : ScriptElementKind.variableElement; + case 185 /* FunctionDeclaration */: return ScriptElementKind.functionElement; case 127 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; case 128 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; case 125 /* Method */: return ScriptElementKind.memberFunctionElement; @@ -32980,7 +20937,7 @@ var ts; case 129 /* CallSignature */: return ScriptElementKind.callSignatureElement; case 126 /* Constructor */: return ScriptElementKind.constructorImplementationElement; case 122 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 192 /* EnumMember */: return ScriptElementKind.variableElement; + case 195 /* EnumMember */: return ScriptElementKind.variableElement; case 123 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; } return ScriptElementKind.unknown; @@ -32993,22 +20950,22 @@ var ts; var displayParts = []; var documentation; var symbolFlags = symbol.flags; - var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver); + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver, location); var hasAddedSymbolInfo; if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 /* Class */ || symbolFlags & 33554432 /* Import */) { if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { symbolKind = ScriptElementKind.memberVariableElement; } - var type = typeResolver.getTypeOfSymbol(symbol); + var type = typeResolver.getNarrowedTypeOfSymbol(symbol, location); if (type) { - if (location.parent && location.parent.kind === 142 /* PropertyAccess */) { + if (location.parent && location.parent.kind === 145 /* PropertyAccess */) { var right = location.parent.right; if (right === location || (right && right.kind === 120 /* Missing */)) { location = location.parent; } } var callExpression; - if (location.kind === 144 /* CallExpression */ || location.kind === 145 /* NewExpression */) { + if (location.kind === 147 /* CallExpression */ || location.kind === 148 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -33020,7 +20977,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 145 /* NewExpression */ || callExpression.func.kind === 89 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 148 /* NewExpression */ || callExpression.func.kind === 89 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -33154,7 +21111,7 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 192 /* EnumMember */) { + if (declaration.kind === 195 /* EnumMember */) { var constantValue = typeResolver.getEnumMemberValue(declaration); if (constantValue !== undefined) { displayParts.push(spacePart()); @@ -33169,13 +21126,13 @@ var ts; displayParts.push(keywordPart(83 /* ImportKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); - displayParts.push(spacePart()); - displayParts.push(punctuationPart(51 /* EqualsToken */)); - displayParts.push(spacePart()); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 190 /* ImportDeclaration */) { + if (declaration.kind === 193 /* ImportDeclaration */) { var importDeclaration = declaration; if (importDeclaration.externalModuleName) { + displayParts.push(spacePart()); + displayParts.push(punctuationPart(51 /* EqualsToken */)); + displayParts.push(spacePart()); displayParts.push(keywordPart(115 /* RequireKeyword */)); displayParts.push(punctuationPart(15 /* OpenParenToken */)); displayParts.push(displayPart(ts.getTextOfNode(importDeclaration.externalModuleName), 8 /* stringLiteral */)); @@ -33183,7 +21140,12 @@ var ts; } else { var internalAliasSymbol = typeResolver.getSymbolInfo(importDeclaration.entityName); - addFullSymbolName(internalAliasSymbol, enclosingDeclaration); + if (internalAliasSymbol) { + displayParts.push(spacePart()); + displayParts.push(punctuationPart(51 /* EqualsToken */)); + displayParts.push(spacePart()); + addFullSymbolName(internalAliasSymbol, enclosingDeclaration); + } } return true; } @@ -33213,7 +21175,7 @@ var ts; } } else { - symbolKind = getSymbolKind(symbol, typeResolver); + symbolKind = getSymbolKind(symbol, typeResolver, location); } } if (!documentation) { @@ -33261,7 +21223,7 @@ var ts; } function getQuickInfoAtPosition(fileName, position) { synchronizeHostData(); - fileName = TypeScript.switchToForwardSlashes(fileName); + fileName = ts.normalizeSlashes(fileName); var sourceFile = getSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); if (!node) { @@ -33271,7 +21233,7 @@ var ts; if (!symbol) { switch (node.kind) { case 63 /* Identifier */: - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: case 121 /* QualifiedName */: case 91 /* ThisKeyword */: case 89 /* SuperKeyword */: @@ -33280,7 +21242,7 @@ var ts; return { kind: ScriptElementKind.unknown, kindModifiers: ScriptElementKindModifier.none, - textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), + textSpan: new ts.TextSpan(node.getStart(), node.getWidth()), displayParts: typeToDisplayParts(typeInfoResolver, type, getContainerNode(node)), documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined }; @@ -33292,7 +21254,7 @@ var ts; return { kind: displayPartsDocumentationsAndKind.symbolKind, kindModifiers: getSymbolModifiers(symbol), - textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), + textSpan: new ts.TextSpan(node.getStart(), node.getWidth()), displayParts: displayPartsDocumentationsAndKind.displayParts, documentation: displayPartsDocumentationsAndKind.documentation }; @@ -33301,7 +21263,7 @@ var ts; function getDefinitionInfo(node, symbolKind, symbolName, containerName) { return { fileName: node.getSourceFile().filename, - textSpan: TypeScript.TextSpan.fromBounds(node.getStart(), node.getEnd()), + textSpan: ts.TextSpan.fromBounds(node.getStart(), node.getEnd()), kind: symbolKind, name: symbolName, containerKind: undefined, @@ -33312,7 +21274,7 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 126 /* Constructor */) || (!selectConstructors && (d.kind === 182 /* FunctionDeclaration */ || d.kind === 125 /* Method */))) { + if ((selectConstructors && d.kind === 126 /* Constructor */) || (!selectConstructors && (d.kind === 185 /* FunctionDeclaration */ || d.kind === 125 /* Method */))) { declarations.push(d); if (d.body) definition = d; @@ -33332,7 +21294,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 111 /* ConstructorKeyword */) { if (symbol.flags & 32 /* Class */) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 184 /* ClassDeclaration */); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 187 /* ClassDeclaration */); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -33345,7 +21307,7 @@ var ts; return false; } synchronizeHostData(); - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var sourceFile = getSourceFile(filename); var node = ts.getTouchingPropertyName(sourceFile, position); if (!node) { @@ -33363,7 +21325,7 @@ var ts; if (program.getSourceFile(targetFilename)) { return [{ fileName: targetFilename, - textSpan: TypeScript.TextSpan.fromBounds(0, 0), + textSpan: ts.TextSpan.fromBounds(0, 0), kind: ScriptElementKind.scriptElement, name: comment.filename, containerName: undefined, @@ -33377,6 +21339,17 @@ var ts; return undefined; } var result = []; + if (node.parent.kind === 144 /* ShorthandPropertyAssignment */) { + var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); + var shorthandDeclarations = shorthandSymbol.getDeclarations(); + var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver); + var shorthandSymbolName = typeInfoResolver.symbolToString(shorthandSymbol); + var shorthandContainerName = typeInfoResolver.symbolToString(symbol.parent, node); + ts.forEach(shorthandDeclarations, function (declaration) { + result.push(getDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName)); + }); + return result; + } var declarations = symbol.getDeclarations(); var symbolName = typeInfoResolver.symbolToString(symbol); var symbolKind = getSymbolKind(symbol, typeInfoResolver); @@ -33391,7 +21364,7 @@ var ts; } function getOccurrencesAtPosition(filename, position) { synchronizeHostData(); - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var sourceFile = getSourceFile(filename); var node = ts.getTouchingWord(sourceFile, position); if (!node) { @@ -33403,52 +21376,52 @@ var ts; switch (node.kind) { case 82 /* IfKeyword */: case 74 /* ElseKeyword */: - if (hasKind(node.parent, 162 /* IfStatement */)) { + if (hasKind(node.parent, 165 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; case 88 /* ReturnKeyword */: - if (hasKind(node.parent, 169 /* ReturnStatement */)) { + if (hasKind(node.parent, 172 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; case 92 /* ThrowKeyword */: - if (hasKind(node.parent, 175 /* ThrowStatement */)) { + if (hasKind(node.parent, 178 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; case 94 /* TryKeyword */: case 66 /* CatchKeyword */: case 79 /* FinallyKeyword */: - if (hasKind(parent(parent(node)), 176 /* TryStatement */)) { + if (hasKind(parent(parent(node)), 179 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 90 /* SwitchKeyword */: - if (hasKind(node.parent, 171 /* SwitchStatement */)) { + if (hasKind(node.parent, 174 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 65 /* CaseKeyword */: case 71 /* DefaultKeyword */: - if (hasKind(parent(parent(node)), 171 /* SwitchStatement */)) { + if (hasKind(parent(parent(node)), 174 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent); } break; case 64 /* BreakKeyword */: case 69 /* ContinueKeyword */: - if (hasKind(node.parent, 168 /* BreakStatement */) || hasKind(node.parent, 167 /* ContinueStatement */)) { + if (hasKind(node.parent, 171 /* BreakStatement */) || hasKind(node.parent, 170 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 80 /* ForKeyword */: - if (hasKind(node.parent, 165 /* ForStatement */) || hasKind(node.parent, 166 /* ForInStatement */)) { + if (hasKind(node.parent, 168 /* ForStatement */) || hasKind(node.parent, 169 /* ForInStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 98 /* WhileKeyword */: case 73 /* DoKeyword */: - if (hasKind(node.parent, 164 /* WhileStatement */) || hasKind(node.parent, 163 /* DoStatement */)) { + if (hasKind(node.parent, 167 /* WhileStatement */) || hasKind(node.parent, 166 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -33466,7 +21439,7 @@ var ts; return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 162 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 165 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -33477,7 +21450,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 162 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 165 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -33497,7 +21470,7 @@ var ts; if (shouldHighlightNextKeyword) { result.push({ fileName: filename, - textSpan: TypeScript.TextSpan.fromBounds(elseKeyword.getStart(), ifKeyword.end), + textSpan: ts.TextSpan.fromBounds(elseKeyword.getStart(), ifKeyword.end), isWriteAccess: false }); i++; @@ -33510,7 +21483,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 183 /* FunctionBlock */))) { + if (!(func && hasKind(func.body, 186 /* FunctionBlock */))) { return undefined; } var keywords = []; @@ -33531,7 +21504,7 @@ var ts; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { pushKeywordIf(keywords, throwStatement.getFirstToken(), 92 /* ThrowKeyword */); }); - if (owner.kind === 183 /* FunctionBlock */) { + if (owner.kind === 186 /* FunctionBlock */) { ts.forEachReturnStatement(owner, function (returnStatement) { pushKeywordIf(keywords, returnStatement.getFirstToken(), 88 /* ReturnKeyword */); }); @@ -33543,10 +21516,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 175 /* ThrowStatement */) { + if (node.kind === 178 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 176 /* TryStatement */) { + else if (node.kind === 179 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchBlock) { aggregate(tryStatement.catchBlock); @@ -33568,10 +21541,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (parent.kind === 183 /* FunctionBlock */ || parent.kind === 193 /* SourceFile */) { + if (parent.kind === 186 /* FunctionBlock */ || parent.kind === 196 /* SourceFile */) { return parent; } - if (parent.kind === 176 /* TryStatement */) { + if (parent.kind === 179 /* TryStatement */) { var tryStatement = parent; if (tryStatement.tryBlock === child && tryStatement.catchBlock) { return child; @@ -33595,7 +21568,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 80 /* ForKeyword */, 98 /* WhileKeyword */, 73 /* DoKeyword */)) { - if (loopNode.kind === 163 /* DoStatement */) { + if (loopNode.kind === 166 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 98 /* WhileKeyword */)) { @@ -33615,7 +21588,6 @@ var ts; function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; pushKeywordIf(keywords, switchStatement.getFirstToken(), 90 /* SwitchKeyword */); - var breakSearchType = 3 /* All */; ts.forEach(switchStatement.clauses, function (clause) { pushKeywordIf(keywords, clause.getFirstToken(), 65 /* CaseKeyword */, 71 /* DefaultKeyword */); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); @@ -33631,12 +21603,12 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 163 /* DoStatement */: - case 164 /* WhileStatement */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 166 /* DoStatement */: + case 167 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -33647,7 +21619,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 168 /* BreakStatement */ || node.kind === 167 /* ContinueStatement */) { + if (node.kind === 171 /* BreakStatement */ || node.kind === 170 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isAnyFunction(node)) { @@ -33663,14 +21635,14 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node = statement.parent; node; node = node.parent) { switch (node.kind) { - case 171 /* SwitchStatement */: - if (statement.kind === 167 /* ContinueStatement */) { + case 174 /* SwitchStatement */: + if (statement.kind === 170 /* ContinueStatement */) { continue; } - case 165 /* ForStatement */: - case 166 /* ForInStatement */: - case 164 /* WhileStatement */: - case 163 /* DoStatement */: + case 168 /* ForStatement */: + case 169 /* ForInStatement */: + case 167 /* WhileStatement */: + case 166 /* DoStatement */: if (!statement.label || isLabeledBy(node, statement.label.text)) { return node; } @@ -33732,7 +21704,7 @@ var ts; } function findReferences(fileName, position, findInStrings, findInComments) { synchronizeHostData(); - fileName = TypeScript.switchToForwardSlashes(fileName); + fileName = ts.normalizeSlashes(fileName); var sourceFile = getSourceFile(fileName); var node = ts.getTouchingPropertyName(sourceFile, position); if (!node) { @@ -33787,7 +21759,7 @@ var ts; } return result; function getNormalizedSymbolName(symbolName, declarations) { - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 149 /* FunctionExpression */ ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 152 /* FunctionExpression */ ? d : undefined; }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -33805,7 +21777,7 @@ var ts; if (symbol.getFlags() && (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 184 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 187 /* ClassDeclaration */); } } if (symbol.parent) { @@ -33819,7 +21791,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 193 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 196 /* SourceFile */ && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -33897,7 +21869,7 @@ var ts; if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { result.push({ fileName: sourceFile.filename, - textSpan: new TypeScript.TextSpan(position, searchText.length), + textSpan: new ts.TextSpan(position, searchText.length), isWriteAccess: false }); } @@ -33907,8 +21879,15 @@ var ts; return; } var referenceSymbol = typeInfoResolver.getSymbolInfo(referenceLocation); - if (referenceSymbol && isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation)) { - result.push(getReferenceEntryFromNode(referenceLocation)); + if (referenceSymbol) { + var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; + var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); + if (isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation)) { + result.push(getReferenceEntryFromNode(referenceLocation)); + } + else if (!(referenceSymbol.flags & 268435456 /* Transient */) && searchSymbols.indexOf(shorthandValueSymbol) >= 0) { + result.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name)); + } } }); } @@ -33978,18 +21957,18 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 193 /* SourceFile */: + case 196 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: break; default: return undefined; } var result = []; - if (searchSpaceNode.kind === 193 /* SourceFile */) { + if (searchSpaceNode.kind === 196 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); @@ -34010,19 +21989,19 @@ var ts; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 149 /* FunctionExpression */: - case 182 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 193 /* SourceFile */: - if (container.kind === 193 /* SourceFile */ && !ts.isExternalModule(container)) { + case 196 /* SourceFile */: + if (container.kind === 196 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -34036,6 +22015,10 @@ var ts; ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol)); }); + var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); + } } ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { if (rootSymbol !== symbol) { @@ -34050,11 +22033,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 184 /* ClassDeclaration */) { + if (declaration.kind === 187 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(declaration.baseType); ts.forEach(declaration.implementedTypes, getPropertySymbolFromTypeReference); } - else if (declaration.kind === 185 /* InterfaceDeclaration */) { + else if (declaration.kind === 188 /* InterfaceDeclaration */) { ts.forEach(declaration.baseTypes, getPropertySymbolFromTypeReference); } }); @@ -34150,7 +22133,7 @@ var ts; } return { fileName: node.getSourceFile().filename, - textSpan: TypeScript.TextSpan.fromBounds(start, end), + textSpan: ts.TextSpan.fromBounds(start, end), isWriteAccess: isWriteAccess(node) }; } @@ -34160,10 +22143,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 152 /* PostfixOperator */ || parent.kind === 151 /* PrefixOperator */) { + if (parent.kind === 155 /* PostfixOperator */ || parent.kind === 154 /* PrefixOperator */) { return true; } - else if (parent.kind === 153 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 156 /* BinaryExpression */ && parent.left === node) { var operator = parent.operator; return 51 /* FirstAssignment */ <= operator && operator <= 62 /* LastAssignment */; } @@ -34191,7 +22174,7 @@ var ts; kindModifiers: getNodeModifiers(declaration), matchKind: MatchKind[matchKind], fileName: filename, - textSpan: TypeScript.TextSpan.fromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: ts.TextSpan.fromBounds(declaration.getStart(), declaration.getEnd()), containerName: container.name ? container.name.text : "", containerKind: container.name ? getNodeKind(container) : "" }); @@ -34235,11 +22218,10 @@ var ts; } function getEmitOutput(filename) { synchronizeHostData(); - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var compilerOptions = program.getCompilerOptions(); var targetSourceFile = program.getSourceFile(filename); var shouldEmitToOwnFile = ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions); - var emitDeclaration = compilerOptions.declaration; var emitOutput = { outputFiles: [], emitOutputStatus: undefined @@ -34252,7 +22234,6 @@ var ts; }); } writer = getEmitOutputWriter; - var syntacticDiagnostics = []; var containSyntacticErrors = false; if (shouldEmitToOwnFile) { containSyntacticErrors = containErrors(program.getDiagnostics(targetSourceFile)); @@ -34278,28 +22259,29 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 123 /* Parameter */: - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 124 /* Property */: - case 141 /* PropertyAssignment */: - case 192 /* EnumMember */: + case 143 /* PropertyAssignment */: + case 144 /* ShorthandPropertyAssignment */: + case 195 /* EnumMember */: case 125 /* Method */: case 126 /* Constructor */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: - case 182 /* FunctionDeclaration */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: - case 178 /* CatchBlock */: + case 185 /* FunctionDeclaration */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: + case 181 /* CatchBlock */: return 1 /* Value */; case 122 /* TypeParameter */: - case 185 /* InterfaceDeclaration */: - case 186 /* TypeAliasDeclaration */: - case 134 /* TypeLiteral */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: + case 136 /* TypeLiteral */: return 2 /* Type */; - case 184 /* ClassDeclaration */: - case 187 /* EnumDeclaration */: + case 187 /* ClassDeclaration */: + case 190 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: if (node.name.kind === 7 /* StringLiteral */) { return 4 /* Namespace */ | 1 /* Value */; } @@ -34310,7 +22292,7 @@ var ts; return 4 /* Namespace */; } break; - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } ts.Debug.fail("Unknown declaration type"); @@ -34335,17 +22317,17 @@ var ts; while (node.parent.kind === 121 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 190 /* ImportDeclaration */ && node.parent.entityName === node; + return node.parent.kind === 193 /* ImportDeclaration */ && node.parent.entityName === node; } function getMeaningFromRightHandSideOfImport(node) { ts.Debug.assert(node.kind === 63 /* Identifier */); - if (node.parent.kind === 121 /* QualifiedName */ && node.parent.right === node && node.parent.parent.kind === 190 /* ImportDeclaration */) { + if (node.parent.kind === 121 /* QualifiedName */ && node.parent.right === node && node.parent.parent.kind === 193 /* ImportDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 191 /* ExportAssignment */) { + if (node.parent.kind === 194 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -34366,7 +22348,7 @@ var ts; } function getSignatureHelpItems(fileName, position) { synchronizeHostData(); - fileName = TypeScript.switchToForwardSlashes(fileName); + fileName = ts.normalizeSlashes(fileName); var sourceFile = getSourceFile(fileName); return ts.SignatureHelp.getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken); } @@ -34388,7 +22370,7 @@ var ts; } var start = signatureInfoString.length; signatureInfoString += displayPartsToString(parameter.displayParts); - var end = signatureInfoString.length - 1; + var end = signatureInfoString.length; parameters.push({ name: parameter.name, isVariable: i === n - 1 && signature.isVariadic, @@ -34418,12 +22400,8 @@ var ts; activeFormal: 0 }; } - function getSyntaxTree(filename) { - filename = TypeScript.switchToForwardSlashes(filename); - return syntaxTreeCache.getCurrentFileSyntaxTree(filename); - } function getCurrentSourceFile(filename) { - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(filename); return currentSourceFile; } @@ -34434,7 +22412,7 @@ var ts; return; } switch (node.kind) { - case 142 /* PropertyAccess */: + case 145 /* PropertyAccess */: case 121 /* QualifiedName */: case 7 /* StringLiteral */: case 78 /* FalseKeyword */: @@ -34453,7 +22431,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 188 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 191 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -34464,19 +22442,19 @@ var ts; break; } } - return TypeScript.TextSpan.fromBounds(nodeForStartPos.getStart(), node.getEnd()); + return ts.TextSpan.fromBounds(nodeForStartPos.getStart(), node.getEnd()); } function getBreakpointStatementAtPosition(filename, position) { filename = ts.normalizeSlashes(filename); return ts.BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(filename), position); } function getNavigationBarItems(filename) { - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); return ts.NavigationBar.getNavigationBarItems(getCurrentSourceFile(filename)); } function getSemanticClassifications(fileName, span) { synchronizeHostData(); - fileName = TypeScript.switchToForwardSlashes(fileName); + fileName = ts.normalizeSlashes(fileName); var sourceFile = getSourceFile(fileName); var result = []; processNode(sourceFile); @@ -34505,7 +22483,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 188 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) == 1 /* Instantiated */; + return declaration.kind === 191 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) == 1 /* Instantiated */; }); } } @@ -34517,7 +22495,7 @@ var ts; var type = classifySymbol(symbol, getMeaningFromLocation(node)); if (type) { result.push({ - textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), + textSpan: new ts.TextSpan(node.getStart(), node.getWidth()), classificationType: type }); } @@ -34528,7 +22506,7 @@ var ts; } } function getSyntacticClassifications(fileName, span) { - fileName = TypeScript.switchToForwardSlashes(fileName); + fileName = ts.normalizeSlashes(fileName); var sourceFile = getCurrentSourceFile(fileName); var result = []; processElement(sourceFile); @@ -34537,7 +22515,7 @@ var ts; var width = comment.end - comment.pos; if (span.intersectsWith(comment.pos, width)) { result.push({ - textSpan: new TypeScript.TextSpan(comment.pos, width), + textSpan: new ts.TextSpan(comment.pos, width), classificationType: ClassificationTypeNames.comment }); } @@ -34548,7 +22526,7 @@ var ts; var type = classifyTokenType(token); if (type) { result.push({ - textSpan: new TypeScript.TextSpan(token.getStart(), token.getWidth()), + textSpan: new ts.TextSpan(token.getStart(), token.getWidth()), classificationType: type }); } @@ -34565,8 +22543,8 @@ var ts; return ClassificationTypeNames.punctuation; } } - if (ts.isPunctuation(token)) { - if (token.parent.kind === 153 /* BinaryExpression */ || token.parent.kind === 181 /* VariableDeclaration */ || token.parent.kind === 151 /* PrefixOperator */ || token.parent.kind === 152 /* PostfixOperator */ || token.parent.kind === 154 /* ConditionalExpression */) { + if (ts.isPunctuation(token.kind)) { + if (token.parent.kind === 156 /* BinaryExpression */ || token.parent.kind === 184 /* VariableDeclaration */ || token.parent.kind === 154 /* PrefixOperator */ || token.parent.kind === 155 /* PostfixOperator */ || token.parent.kind === 157 /* ConditionalExpression */) { return ClassificationTypeNames.operator; } else { @@ -34587,7 +22565,7 @@ var ts; } else if (tokenKind === 63 /* Identifier */) { switch (token.parent.kind) { - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: if (token.parent.name === token) { return ClassificationTypeNames.className; } @@ -34597,17 +22575,17 @@ var ts; return ClassificationTypeNames.typeParameterName; } return; - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -34633,7 +22611,7 @@ var ts; } } function getOutliningSpans(filename) { - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var sourceFile = getCurrentSourceFile(filename); return ts.OutliningElementsCollector.collectElements(sourceFile); } @@ -34647,10 +22625,11 @@ var ts; var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); for (var i = 0, n = childNodes.length; i < n; i++) { + 33; var current = childNodes[i]; if (current.kind === matchKind) { - var range1 = new TypeScript.TextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); - var range2 = new TypeScript.TextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); + var range1 = new ts.TextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); + var range2 = new ts.TextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); if (range1.start() < range2.start()) { result.push(range1, range2); } @@ -34678,55 +22657,42 @@ var ts; } } function getIndentationAtPosition(filename, position, editorOptions) { - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var start = new Date().getTime(); var sourceFile = getCurrentSourceFile(filename); host.log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); var start = new Date().getTime(); - var options = new TypeScript.FormattingOptions(!editorOptions.ConvertTabsToSpaces, editorOptions.TabSize, editorOptions.IndentSize, editorOptions.NewLineCharacter); - var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, options); + var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); host.log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); return result; } - function getFormattingManager(filename, options) { - if (formattingRulesProvider == null) { - formattingRulesProvider = new TypeScript.Services.Formatting.RulesProvider(host); - } - formattingRulesProvider.ensureUpToDate(options); - var syntaxTree = getSyntaxTree(filename); - var scriptSnapshot = syntaxTreeCache.getCurrentScriptSnapshot(filename); - var scriptText = TypeScript.SimpleText.fromScriptSnapshot(scriptSnapshot); - var textSnapshot = new TypeScript.Services.Formatting.TextSnapshot(scriptText); - var manager = new TypeScript.Services.Formatting.FormattingManager(syntaxTree, textSnapshot, formattingRulesProvider, options); - return manager; - } function getFormattingEditsForRange(fileName, start, end, options) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var manager = getFormattingManager(fileName, options); - return manager.formatSelection(start, end); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(options), options); } function getFormattingEditsForDocument(fileName, options) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var manager = getFormattingManager(fileName, options); - return manager.formatDocument(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.formatting.formatDocument(sourceFile, getRuleProvider(options), options); } function getFormattingEditsAfterKeystroke(fileName, position, key, options) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var manager = getFormattingManager(fileName, options); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); if (key === "}") { - return manager.formatOnClosingCurlyBrace(position); + return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(options), options); } else if (key === ";") { - return manager.formatOnSemicolon(position); + return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(options), options); } else if (key === "\n") { - return manager.formatOnEnter(position); + return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(options), options); } return []; } function getTodoComments(filename, descriptors) { synchronizeHostData(); - filename = TypeScript.switchToForwardSlashes(filename); + filename = ts.normalizeSlashes(filename); var sourceFile = getSourceFile(filename); cancellationToken.throwIfCancellationRequested(); var fileContents = sourceFile.text; @@ -34796,7 +22762,7 @@ var ts; } function getRenameInfo(fileName, position) { synchronizeHostData(); - fileName = TypeScript.switchToForwardSlashes(fileName); + fileName = ts.normalizeSlashes(fileName); var sourceFile = getSourceFile(fileName); var node = ts.getTouchingWord(sourceFile, position); if (node && node.kind === 63 /* Identifier */) { @@ -34804,7 +22770,7 @@ var ts; if (symbol && symbol.getDeclarations() && symbol.getDeclarations().length > 0) { var kind = getSymbolKind(symbol, typeInfoResolver); if (kind) { - return getRenameInfo(symbol.name, typeInfoResolver.getFullyQualifiedName(symbol), kind, getSymbolModifiers(symbol), new TypeScript.TextSpan(node.getStart(), node.getWidth())); + return getRenameInfo(symbol.name, typeInfoResolver.getFullyQualifiedName(symbol), kind, getSymbolModifiers(symbol), new ts.TextSpan(node.getStart(), node.getWidth())); } } } @@ -34901,7 +22867,6 @@ var ts; } function getClassificationsForLine(text, lexState) { var offset = 0; - var lastTokenOrCommentEnd = 0; var token = 0 /* Unknown */; var lastNonTriviaToken = 0 /* Unknown */; switch (lexState) { @@ -35078,7 +23043,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 193 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + var proto = kind === 196 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -35115,7 +23080,7 @@ var ts; } return spanInNode(tokenAtLocation); function textSpan(startNode, endNode) { - return TypeScript.TextSpan.fromBounds(startNode.getStart(), (endNode || startNode).getEnd()); + return ts.TextSpan.fromBounds(startNode.getStart(), (endNode || startNode).getEnd()); } function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) { @@ -35132,90 +23097,91 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 163 /* DoStatement */) { + if (node.parent.kind === 166 /* DoStatement */) { return spanInPreviousNode(node); } - if (node.parent.kind === 165 /* ForStatement */) { + if (node.parent.kind === 168 /* ForStatement */) { return textSpan(node); } - if (node.parent.kind === 153 /* BinaryExpression */ && node.parent.operator === 22 /* CommaToken */) { + if (node.parent.kind === 156 /* BinaryExpression */ && node.parent.operator === 22 /* CommaToken */) { return textSpan(node); } - if (node.parent.kind == 150 /* ArrowFunction */ && node.parent.body == node) { + if (node.parent.kind == 153 /* ArrowFunction */ && node.parent.body == node) { return textSpan(node); } } switch (node.kind) { - case 159 /* VariableStatement */: + case 162 /* VariableStatement */: return spanInVariableDeclaration(node.declarations[0]); - case 181 /* VariableDeclaration */: + case 184 /* VariableDeclaration */: case 124 /* Property */: return spanInVariableDeclaration(node); case 123 /* Parameter */: return spanInParameterDeclaration(node); - case 182 /* FunctionDeclaration */: + case 185 /* FunctionDeclaration */: case 125 /* Method */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: case 126 /* Constructor */: - case 149 /* FunctionExpression */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 153 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 183 /* FunctionBlock */: + case 186 /* FunctionBlock */: return spanInFunctionBlock(node); - case 158 /* Block */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: - case 189 /* ModuleBlock */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: + case 192 /* ModuleBlock */: return spanInBlock(node); - case 161 /* ExpressionStatement */: + case 164 /* ExpressionStatement */: return textSpan(node.expression); - case 169 /* ReturnStatement */: + case 172 /* ReturnStatement */: return textSpan(node.getChildAt(0), node.expression); - case 164 /* WhileStatement */: + case 167 /* WhileStatement */: return textSpan(node, ts.findNextToken(node.expression, node)); - case 163 /* DoStatement */: + case 166 /* DoStatement */: return spanInNode(node.statement); - case 180 /* DebuggerStatement */: + case 183 /* DebuggerStatement */: return textSpan(node.getChildAt(0)); - case 162 /* IfStatement */: + case 165 /* IfStatement */: return textSpan(node, ts.findNextToken(node.expression, node)); - case 174 /* LabeledStatement */: + case 177 /* LabeledStatement */: return spanInNode(node.statement); - case 168 /* BreakStatement */: - case 167 /* ContinueStatement */: + case 171 /* BreakStatement */: + case 170 /* ContinueStatement */: return textSpan(node.getChildAt(0), node.label); - case 165 /* ForStatement */: + case 168 /* ForStatement */: return spanInForStatement(node); - case 166 /* ForInStatement */: + case 169 /* ForInStatement */: return textSpan(node, ts.findNextToken(node.expression, node)); - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: return textSpan(node, ts.findNextToken(node.expression, node)); - case 172 /* CaseClause */: - case 173 /* DefaultClause */: + case 175 /* CaseClause */: + case 176 /* DefaultClause */: return spanInNode(node.statements[0]); - case 176 /* TryStatement */: + case 179 /* TryStatement */: return spanInBlock(node.tryBlock); - case 175 /* ThrowStatement */: + case 178 /* ThrowStatement */: return textSpan(node, node.expression); - case 191 /* ExportAssignment */: + case 194 /* ExportAssignment */: return textSpan(node, node.exportName); - case 190 /* ImportDeclaration */: + case 193 /* ImportDeclaration */: return textSpan(node, node.entityName || node.externalModuleName); - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 184 /* ClassDeclaration */: - case 187 /* EnumDeclaration */: - case 192 /* EnumMember */: - case 144 /* CallExpression */: - case 145 /* NewExpression */: + case 187 /* ClassDeclaration */: + case 190 /* EnumDeclaration */: + case 195 /* EnumMember */: + case 147 /* CallExpression */: + case 148 /* NewExpression */: return textSpan(node); - case 170 /* WithStatement */: + case 173 /* WithStatement */: return spanInNode(node.statement); - case 185 /* InterfaceDeclaration */: + case 188 /* InterfaceDeclaration */: + case 189 /* TypeAliasDeclaration */: return undefined; case 21 /* SemicolonToken */: case 1 /* EndOfFileToken */: @@ -35242,10 +23208,10 @@ var ts; case 79 /* FinallyKeyword */: return spanInNextNode(node); default: - if (node.parent.kind === 141 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 143 /* PropertyAssignment */ && node.parent.name === node) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 147 /* TypeAssertion */ && node.parent.type === node) { + if (node.parent.kind === 150 /* TypeAssertion */ && node.parent.type === node) { return spanInNode(node.parent.operand); } if (ts.isAnyFunction(node.parent) && node.parent.type === node) { @@ -35255,11 +23221,11 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.kind === 166 /* ForInStatement */) { + if (variableDeclaration.parent.kind === 169 /* ForInStatement */) { return spanInNode(variableDeclaration.parent); } - var isParentVariableStatement = variableDeclaration.parent.kind === 159 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.kind === 165 /* ForStatement */ && ts.contains(variableDeclaration.parent.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.kind === 162 /* VariableStatement */; + var isDeclarationOfForStatement = variableDeclaration.parent.kind === 168 /* ForStatement */ && ts.contains(variableDeclaration.parent.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.declarations : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1 /* Export */)) { if (declarations && declarations[0] === variableDeclaration) { @@ -35299,7 +23265,7 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1 /* Export */) || (functionDeclaration.parent.kind === 184 /* ClassDeclaration */ && functionDeclaration.kind !== 126 /* Constructor */); + return !!(functionDeclaration.flags & 1 /* Export */) || (functionDeclaration.parent.kind === 187 /* ClassDeclaration */ && functionDeclaration.kind !== 126 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -35319,15 +23285,15 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 188 /* ModuleDeclaration */: + case 191 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } - case 164 /* WhileStatement */: - case 162 /* IfStatement */: - case 166 /* ForInStatement */: + case 167 /* WhileStatement */: + case 165 /* IfStatement */: + case 169 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 165 /* ForStatement */: + case 168 /* ForStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); @@ -35348,34 +23314,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 187 /* EnumDeclaration */: + case 190 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 184 /* ClassDeclaration */: + case 187 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 189 /* ModuleBlock */: + case 192 /* ModuleBlock */: if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 183 /* FunctionBlock */: - case 187 /* EnumDeclaration */: - case 184 /* ClassDeclaration */: + case 186 /* FunctionBlock */: + case 190 /* EnumDeclaration */: + case 187 /* ClassDeclaration */: return textSpan(node); - case 158 /* Block */: - case 177 /* TryBlock */: - case 178 /* CatchBlock */: - case 179 /* FinallyBlock */: + case 161 /* Block */: + case 180 /* TryBlock */: + case 181 /* CatchBlock */: + case 182 /* FinallyBlock */: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 171 /* SwitchStatement */: + case 174 /* SwitchStatement */: var switchStatement = node.parent; var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; if (lastClause) { @@ -35387,23 +23353,23 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 163 /* DoStatement */) { + if (node.parent.kind === 166 /* DoStatement */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 149 /* FunctionExpression */: - case 182 /* FunctionDeclaration */: - case 150 /* ArrowFunction */: + case 152 /* FunctionExpression */: + case 185 /* FunctionDeclaration */: + case 153 /* ArrowFunction */: case 125 /* Method */: case 127 /* GetAccessor */: case 128 /* SetAccessor */: case 126 /* Constructor */: - case 164 /* WhileStatement */: - case 163 /* DoStatement */: - case 165 /* ForStatement */: + case 167 /* WhileStatement */: + case 166 /* DoStatement */: + case 168 /* ForStatement */: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -35411,19 +23377,19 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isAnyFunction(node.parent) || node.parent.kind === 141 /* PropertyAssignment */) { + if (ts.isAnyFunction(node.parent) || node.parent.kind === 143 /* PropertyAssignment */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 147 /* TypeAssertion */) { + if (node.parent.kind === 150 /* TypeAssertion */) { return spanInNode(node.parent.operand); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 163 /* DoStatement */) { + if (node.parent.kind === 166 /* DoStatement */) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -35433,128 +23399,6 @@ var ts; BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation; })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {})); })(ts || (ts = {})); -var TypeScript; -(function (TypeScript) { - function isNoDefaultLibMatch(comment) { - var isNoDefaultLibRegex = /^(\/\/\/\s*/gim; - return isNoDefaultLibRegex.exec(comment); - } - TypeScript.tripleSlashReferenceRegExp = /^(\/\/\/\s*/; - function getFileReferenceFromReferencePath(fileName, text, position, comment, diagnostics) { - var lineMap = text.lineMap(); - var simpleReferenceRegEx = /^\/\/\/\s*= 7 && fullReference[6] === "true"; - return { - line: 0, - character: 0, - position: 0, - length: 0, - path: TypeScript.switchToForwardSlashes(adjustedPath), - isResident: isResident - }; - } - } - } - return null; - } - var reportDiagnostic = function () { - }; - function processImports(text, scanner, token, importedFiles) { - var lineChar = { line: -1, character: -1 }; - var lineMap = text.lineMap(); - var start = new Date().getTime(); - while (token.kind() !== 8 /* EndOfFileToken */) { - if (token.kind() === 51 /* ImportKeyword */) { - var importToken = token; - token = scanner.scan(false); - if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token)) { - token = scanner.scan(false); - if (token.kind() === 109 /* EqualsToken */) { - token = scanner.scan(false); - if (token.kind() === 67 /* ModuleKeyword */ || token.kind() === 68 /* RequireKeyword */) { - token = scanner.scan(false); - if (token.kind() === 74 /* OpenParenToken */) { - token = scanner.scan(false); - lineMap.fillLineAndCharacterFromPosition(TypeScript.start(importToken, text), lineChar); - if (token.kind() === 12 /* StringLiteral */) { - var ref = { - line: lineChar.line, - character: lineChar.character, - position: TypeScript.start(token, text), - length: TypeScript.width(token), - path: TypeScript.stripStartAndEndQuotes(TypeScript.switchToForwardSlashes(token.text())), - isResident: false - }; - importedFiles.push(ref); - } - } - } - } - } - } - token = scanner.scan(false); - } - var totalTime = new Date().getTime() - start; - } - function processTripleSlashDirectives(fileName, text, firstToken) { - var leadingTrivia = firstToken.leadingTrivia(text); - var position = 0; - var lineChar = { line: -1, character: -1 }; - var noDefaultLib = false; - var diagnostics = []; - var referencedFiles = []; - var lineMap = text.lineMap(); - for (var i = 0, n = leadingTrivia.count(); i < n; i++) { - var trivia = leadingTrivia.syntaxTriviaAt(i); - if (trivia.kind() === 5 /* SingleLineCommentTrivia */) { - var triviaText = trivia.fullText(); - var referencedCode = getFileReferenceFromReferencePath(fileName, text, position, triviaText, diagnostics); - if (referencedCode) { - lineMap.fillLineAndCharacterFromPosition(position, lineChar); - referencedCode.position = position; - referencedCode.length = trivia.fullWidth(); - referencedCode.line = lineChar.line; - referencedCode.character = lineChar.character; - referencedFiles.push(referencedCode); - } - var isNoDefaultLib = isNoDefaultLibMatch(triviaText); - if (isNoDefaultLib) { - noDefaultLib = isNoDefaultLib[3] === "true"; - } - } - position += trivia.fullWidth(); - } - return { noDefaultLib: noDefaultLib, diagnostics: diagnostics, referencedFiles: referencedFiles }; - } - function preProcessFile(fileName, sourceText, readImportFiles) { - if (readImportFiles === void 0) { readImportFiles = true; } - var text = TypeScript.SimpleText.fromScriptSnapshot(sourceText); - var scanner = TypeScript.Scanner.createScanner(2 /* Latest */, text, reportDiagnostic); - var firstToken = scanner.scan(false); - var importedFiles = []; - if (readImportFiles) { - processImports(text, scanner, firstToken, importedFiles); - } - var properties = processTripleSlashDirectives(fileName, text, firstToken); - return { referencedFiles: properties.referencedFiles, importedFiles: importedFiles, isLibFile: properties.noDefaultLib, diagnostics: properties.diagnostics }; - } - TypeScript.preProcessFile = preProcessFile; - function getReferencedFiles(fileName, sourceText) { - return preProcessFile(fileName, sourceText, false).referencedFiles; - } - TypeScript.getReferencedFiles = getReferencedFiles; -})(TypeScript || (TypeScript = {})); var debugObjectHost = this; var ts; (function (ts) { @@ -35661,7 +23505,7 @@ var ts; return null; } var decoded = JSON.parse(encoded); - return new TypeScript.TextChangeRange(new TypeScript.TextSpan(decoded.span.start, decoded.span.length), decoded.newLength); + return new ts.TextChangeRange(new ts.TextSpan(decoded.span.start, decoded.span.length), decoded.newLength); }; return ScriptSnapshotShimAdapter; })(); @@ -35801,26 +23645,17 @@ var ts; code: diagnostic.code }; }; - LanguageServiceShimObject.prototype.realizeDiagnosticWithFileName = function (diagnostic) { - return { - fileName: diagnostic.file.filename, - message: diagnostic.messageText, - start: diagnostic.start, - length: diagnostic.length, - category: ts.DiagnosticCategory[diagnostic.category].toLowerCase() - }; - }; LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { var _this = this; return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - var classifications = _this.languageService.getSyntacticClassifications(fileName, new TypeScript.TextSpan(start, length)); + var classifications = _this.languageService.getSyntacticClassifications(fileName, new ts.TextSpan(start, length)); return classifications; }); }; LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { var _this = this; return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { - var classifications = _this.languageService.getSemanticClassifications(fileName, new TypeScript.TextSpan(start, length)); + var classifications = _this.languageService.getSemanticClassifications(fileName, new ts.TextSpan(start, length)); return classifications; }); }; @@ -35842,7 +23677,7 @@ var ts; var _this = this; return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () { var errors = _this.languageService.getCompilerOptionsDiagnostics(); - return errors.map(function (d) { return _this.realizeDiagnosticWithFileName(d); }); + return errors.map(LanguageServiceShimObject.realizeDiagnostic); }); }; LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { @@ -36033,10 +23868,29 @@ var ts; CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { return forwardJSONCall(this.logger, actionDescription, action); }; - CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceText) { + CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { - var result = TypeScript.preProcessFile(fileName, sourceText); - return result; + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + var convertResult = { + referencedFiles: [], + importedFiles: [], + isLibFile: result.isLibFile + }; + ts.forEach(result.referencedFiles, function (refFile) { + convertResult.referencedFiles.push({ + path: ts.normalizePath(refFile.filename), + position: refFile.pos, + length: refFile.end - refFile.pos + }); + }); + ts.forEach(result.importedFiles, function (importedFile) { + convertResult.importedFiles.push({ + path: ts.normalizeSlashes(importedFile.filename), + position: importedFile.pos, + length: importedFile.end - importedFile.pos + }); + }); + return convertResult; }); }; CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { @@ -36094,7 +23948,7 @@ var ts; return; } } - throw TypeScript.Errors.invalidOperation(); + throw new Error("Invalid operation"); }; return TypeScriptServicesFactory; })(); From 8df64293f937fd2c57edbdd9832f1078e9baa079 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 11:47:35 -0800 Subject: [PATCH 02/35] Refactor using short-hand --- src/compiler/checker.ts | 96 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e642fcce94..8cf39b3129 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -75,43 +75,43 @@ module ts { var checker: TypeChecker = { getProgram: () => program, - getDiagnostics: getDiagnostics, - getGlobalDiagnostics: getGlobalDiagnostics, getNodeCount: () => sum(program.getSourceFiles(), "nodeCount"), getIdentifierCount: () => sum(program.getSourceFiles(), "identifierCount"), getSymbolCount: () => sum(program.getSourceFiles(), "symbolCount"), getTypeCount: () => typeCount, - checkProgram: checkProgram, - emitFiles: invokeEmitter, - getParentOfSymbol: getParentOfSymbol, - getNarrowedTypeOfSymbol: getNarrowedTypeOfSymbol, - getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, - getPropertiesOfType: getPropertiesOfType, - getPropertyOfType: getPropertyOfType, - getSignaturesOfType: getSignaturesOfType, - getIndexTypeOfType: getIndexTypeOfType, - getReturnTypeOfSignature: getReturnTypeOfSignature, - getSymbolsInScope: getSymbolsInScope, - getSymbolInfo: getSymbolInfo, - getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getTypeOfNode: getTypeOfNode, - typeToString: typeToString, - getSymbolDisplayBuilder: getSymbolDisplayBuilder, - symbolToString: symbolToString, - getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, - getRootSymbols: getRootSymbols, - getContextualType: getContextualType, - getFullyQualifiedName: getFullyQualifiedName, - getResolvedSignature: getResolvedSignature, - getEnumMemberValue: getEnumMemberValue, - isValidPropertyAccess: isValidPropertyAccess, - getSignatureFromDeclaration: getSignatureFromDeclaration, - isImplementationOfOverload: isImplementationOfOverload, - getAliasedSymbol: resolveImport, isUndefinedSymbol: symbol => symbol === undefinedSymbol, isArgumentsSymbol: symbol => symbol === argumentsSymbol, - hasEarlyErrors: hasEarlyErrors, - isEmitBlocked: isEmitBlocked + getDiagnostics, + getGlobalDiagnostics, + checkProgram, + invokeEmitter, + getParentOfSymbol, + getNarrowedTypeOfSymbol, + getDeclaredTypeOfSymbol, + getPropertiesOfType, + getPropertyOfType, + getSignaturesOfType, + getIndexTypeOfType, + getReturnTypeOfSignature, + getSymbolsInScope, + getSymbolInfo, + getShorthandAssignmentValueSymbol, + getTypeOfNode, + typeToString, + getSymbolDisplayBuilder, + symbolToString, + getAugmentedPropertiesOfType, + getRootSymbols, + getContextualType, + getFullyQualifiedName, + getResolvedSignature, + getEnumMemberValue, + isValidPropertyAccess, + getSignatureFromDeclaration, + isImplementationOfOverload, + getAliasedSymbol: resolveImport, + hasEarlyErrors, + isEmitBlocked, }; var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); @@ -953,7 +953,7 @@ module ts { if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) { return undefined; } - return { aliasesToMakeVisible: aliasesToMakeVisible }; + return { aliasesToMakeVisible }; function getIsDeclarationVisible(declaration: Declaration) { if (!isDeclarationVisible(declaration)) { @@ -9118,22 +9118,22 @@ module ts { function invokeEmitter(targetSourceFile?: SourceFile) { var resolver: EmitResolver = { getProgram: () => program, - getLocalNameOfContainer: getLocalNameOfContainer, - getExpressionNamePrefix: getExpressionNamePrefix, - getExportAssignmentName: getExportAssignmentName, - isReferencedImportDeclaration: isReferencedImportDeclaration, - getNodeCheckFlags: getNodeCheckFlags, - getEnumMemberValue: getEnumMemberValue, - isTopLevelValueImportWithEntityName: isTopLevelValueImportWithEntityName, - hasSemanticErrors: hasSemanticErrors, - isEmitBlocked: isEmitBlocked, - isDeclarationVisible: isDeclarationVisible, - isImplementationOfOverload: isImplementationOfOverload, - writeTypeAtLocation: writeTypeAtLocation, - writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, - isSymbolAccessible: isSymbolAccessible, - isImportDeclarationEntityNameReferenceDeclarationVisibile: isImportDeclarationEntityNameReferenceDeclarationVisibile, - getConstantValue: getConstantValue, + getLocalNameOfContainer, + getExpressionNamePrefix, + getExportAssignmentName, + isReferencedImportDeclaration, + getNodeCheckFlags, + getEnumMemberValue, + isTopLevelValueImportWithEntityName, + hasSemanticErrors, + isEmitBlocked, + isDeclarationVisible, + isImplementationOfOverload, + writeTypeAtLocation, + writeReturnTypeOfSignatureDeclaration, + isSymbolAccessible, + isImportDeclarationEntityNameReferenceDeclarationVisibile, + getConstantValue, }; checkProgram(); return emitFiles(resolver, targetSourceFile); From 36cc705fa2c926dd86b946bfd22f347eb7723133 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 11:54:50 -0800 Subject: [PATCH 03/35] Refactoring parser/scanner using short-hand --- src/compiler/parser.ts | 29 ++++++++++++++--------------- src/compiler/scanner.ts | 14 +++++++------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 924f6e8393..f59ecb8a6e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -774,13 +774,12 @@ module ts { if (matchResult) { var start = commentRange.pos; var end = commentRange.end; - var fileRef = { - pos: start, - end: end, - filename: matchResult[3] - }; return { - fileReference: fileRef, + fileReference: { + pos: start, + end: end, + filename: matchResult[3] + }, isNoDefaultLib: false }; } @@ -944,11 +943,11 @@ module ts { } return { - addLabel: addLabel, - pushCurrentLabelSet: pushCurrentLabelSet, - pushFunctionBoundary: pushFunctionBoundary, - pop: pop, - nodeIsNestedInLabel: nodeIsNestedInLabel, + addLabel, + pushCurrentLabelSet, + pushFunctionBoundary, + pop, + nodeIsNestedInLabel, }; })(); @@ -1674,8 +1673,8 @@ module ts { } return { - typeParameters: typeParameters, - parameters: parameters, + typeParameters, + parameters, type: type }; } @@ -4276,8 +4275,8 @@ module ts { } commentRanges = undefined; return { - referencedFiles: referencedFiles, - amdDependencies: amdDependencies + referencedFiles, + amdDependencies }; } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 0647d61f24..e08f481ba9 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1167,13 +1167,13 @@ module ts { hasPrecedingLineBreak: () => precedingLineBreak, isIdentifier: () => token === SyntaxKind.Identifier || token > SyntaxKind.LastReservedWord, isReservedWord: () => token >= SyntaxKind.FirstReservedWord && token <= SyntaxKind.LastReservedWord, - reScanGreaterToken: reScanGreaterToken, - reScanSlashToken: reScanSlashToken, - reScanTemplateToken: reScanTemplateToken, - scan: scan, - setText: setText, - setTextPos: setTextPos, - tryScan: tryScan, + reScanGreaterToken, + reScanSlashToken, + reScanTemplateToken, + scan, + setText, + setTextPos, + tryScan, }; } } From 26a5e4333ea11ad594db797219a6b3110f614525 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 12:04:18 -0800 Subject: [PATCH 04/35] Refactoring emitter using short-hand --- src/compiler/emitter.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index fe80e48dc6..8078060628 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -104,9 +104,9 @@ module ts { } }); return { - firstAccessor: firstAccessor, - getAccessor: getAccessor, - setAccessor: setAccessor + firstAccessor, + getAccessor, + setAccessor }; } @@ -2783,7 +2783,7 @@ module ts { Diagnostics.Exported_type_alias_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1; return { - diagnosticMessage: diagnosticMessage, + diagnosticMessage, errorNode: node, typeName: node.name }; @@ -2880,7 +2880,7 @@ module ts { } return { - diagnosticMessage: diagnosticMessage, + diagnosticMessage, errorNode: node, typeName: node.name }; @@ -2945,7 +2945,7 @@ module ts { } return { - diagnosticMessage: diagnosticMessage, + diagnosticMessage, errorNode: node, typeName: (node.parent).name }; @@ -3127,7 +3127,7 @@ module ts { Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { - diagnosticMessage: diagnosticMessage, + diagnosticMessage, errorNode: node.parameters[0], // TODO(jfreeman): Investigate why we are passing node.name instead of node.parameters[0].name typeName: node.name @@ -3149,7 +3149,7 @@ module ts { Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { - diagnosticMessage: diagnosticMessage, + diagnosticMessage, errorNode: node.name, typeName: undefined }; @@ -3279,7 +3279,7 @@ module ts { } return { - diagnosticMessage: diagnosticMessage, + diagnosticMessage, errorNode: node.name || node, }; } @@ -3364,7 +3364,7 @@ module ts { } return { - diagnosticMessage: diagnosticMessage, + diagnosticMessage, errorNode: node, typeName: node.name }; @@ -3549,21 +3549,21 @@ module ts { var hasEmitterError = forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error); // Check and update returnCode for syntactic and semantic - var returnCode: EmitReturnStatus; + var emitResultStatus: EmitReturnStatus; if (isEmitBlocked) { - returnCode = EmitReturnStatus.AllOutputGenerationSkipped; + emitResultStatus = EmitReturnStatus.AllOutputGenerationSkipped; } else if (hasEmitterError) { - returnCode = EmitReturnStatus.EmitErrorsEncountered; + emitResultStatus = EmitReturnStatus.EmitErrorsEncountered; } else if (hasSemanticErrors && compilerOptions.declaration) { - returnCode = EmitReturnStatus.DeclarationGenerationSkipped; + emitResultStatus = EmitReturnStatus.DeclarationGenerationSkipped; } else if (hasSemanticErrors && !compilerOptions.declaration) { - returnCode = EmitReturnStatus.JSGeneratedWithSemanticErrors; + emitResultStatus = EmitReturnStatus.JSGeneratedWithSemanticErrors; } else { - returnCode = EmitReturnStatus.Succeeded; + emitResultStatus = EmitReturnStatus.Succeeded; } return { - emitResultStatus: returnCode, + emitResultStatus, errors: diagnostics, sourceMaps: sourceMapDataList }; From d50ce1cb4783537cd0a18dbff99a97fc680a8ee4 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 12:05:40 -0800 Subject: [PATCH 05/35] Refactoring compiler utility-related files to use short-hand --- src/compiler/commandLineParser.ts | 6 +++--- src/compiler/core.ts | 18 +++++++++--------- src/compiler/sys.ts | 10 +++++----- src/compiler/types.ts | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 5e61e9e1cb..3fabf6c858 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -153,9 +153,9 @@ module ts { parseStrings(commandLine); return { - options: options, - filenames: filenames, - errors: errors + options, + filenames, + errors }; function parseStrings(args: string[]) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index e512688fee..2c61399668 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -258,9 +258,9 @@ module ts { } return { - file: file, - start: start, - length: length, + file, + start, + length, messageText: text, category: message.category, @@ -335,12 +335,12 @@ module ts { } return { - file: file, - start: start, - length: length, - code: code, - category: category, - messageText: messageText + file, + start, + length, + code, + category, + messageText }; } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index d685a30d95..e58d08589b 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -99,14 +99,14 @@ var sys: System = (function () { } return { - args: args, + args, newLine: "\r\n", useCaseSensitiveFileNames: false, write(s: string): void { WScript.StdOut.Write(s); }, - readFile: readFile, - writeFile: writeFile, + readFile, + writeFile, resolvePath(path: string): string { return fso.GetAbsolutePathName(path); }, @@ -191,8 +191,8 @@ var sys: System = (function () { // 1 is a standard descriptor for stdout _fs.writeSync(1, s); }, - readFile: readFile, - writeFile: writeFile, + readFile, + writeFile, watchFile: (fileName, callback) => { // watchFile polls a file every 250ms, picking up file notifications. _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 19e0b79f42..6c176bb955 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -713,7 +713,7 @@ module ts { getSymbolCount(): number; getTypeCount(): number; checkProgram(): void; - emitFiles(targetSourceFile?: SourceFile): EmitResult; + invokeEmitter(targetSourceFile?: SourceFile): EmitResult; getParentOfSymbol(symbol: Symbol): Symbol; getNarrowedTypeOfSymbol(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; From dcf51d85f43907b8dd03385b386646876faca6bb Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 12:06:05 -0800 Subject: [PATCH 06/35] Refactoring main-compiler (tsc) to use short-hand --- src/compiler/tsc.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index e5291c9d7f..58e2ac0db0 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -192,12 +192,12 @@ module ts { } return { - getSourceFile: getSourceFile, + getSourceFile, getDefaultLibFilename: () => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), "lib.d.ts"), - writeFile: writeFile, + writeFile, getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()), useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, - getCanonicalFileName: getCanonicalFileName, + getCanonicalFileName, getNewLine: () => sys.newLine }; } @@ -367,7 +367,7 @@ module ts { } else { var emitStart = new Date().getTime(); - var emitOutput = checker.emitFiles(); + var emitOutput = checker.invokeEmitter(); var emitErrors = emitOutput.errors; exitStatus = emitOutput.emitResultStatus; var reportStart = new Date().getTime(); @@ -394,7 +394,7 @@ module ts { reportTimeStatistic("Total time", reportStart - parseStart); } - return { program: program, exitStatus: exitStatus } + return { program, exitStatus }; } function printVersion() { From 999e4f1a0b18b70d2dc70b5f6f3f0ac612540f55 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 12:30:58 -0800 Subject: [PATCH 07/35] Refactoring test framework to use short-hand --- src/harness/fourslash.ts | 24 ++++++++++++------------ src/harness/harness.ts | 20 ++++++++++---------- src/harness/projectsRunner.ts | 22 +++++++++++----------- src/harness/rwcRunner.ts | 6 +++--- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 144cc9745d..a0d9499f48 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2250,7 +2250,7 @@ module FourSlash { if (errs.length > 0) { throw new Error('Error compiling ' + fileName + ': ' + errs.map(e => e.messageText).join('\r\n')); } - checker.emitFiles(); + checker.invokeEmitter(); result = result || ''; // Might have an empty fourslash file // Compile and execute the test @@ -2284,7 +2284,7 @@ module FourSlash { // List of all the subfiles we've parsed out var files: FourSlashFile[] = []; // Global options - var opts: { [s: string]: string; } = {}; + var globalOptions: { [s: string]: string; } = {}; // Marker positions // Split up the input file by line @@ -2292,7 +2292,7 @@ module FourSlash { // we have to string-based splitting instead and try to figure out the delimiting chars var lines = contents.split('\n'); - var markerMap: MarkerMap = {}; + var markerPositions: MarkerMap = {}; var markers: Marker[] = []; var ranges: Range[] = []; @@ -2333,7 +2333,7 @@ module FourSlash { } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(testOptMetadataNames.filename)) { // Found an @Filename directive, if this is not the first then create a new subfile if (currentFileContent) { - var file = parseFileContent(currentFileContent, currentFileName, markerMap, markers, ranges); + var file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges); file.fileOptions = currentFileOptions; // Store result file @@ -2353,10 +2353,10 @@ module FourSlash { } } else { // Check if the match is already existed in the global options - if (opts[match[1]] !== undefined) { + if (globalOptions[match[1]] !== undefined) { throw new Error("Global Option : '" + match[1] + "' is already existed"); } - opts[match[1]] = match[2]; + globalOptions[match[1]] = match[2]; } } } else if (line == '' || lineLength === 0) { @@ -2365,7 +2365,7 @@ module FourSlash { } else { // Empty line or code line, terminate current subfile if there is one if (currentFileContent) { - var file = parseFileContent(currentFileContent, currentFileName, markerMap, markers, ranges); + var file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges); file.fileOptions = currentFileOptions; // Store result file @@ -2380,11 +2380,11 @@ module FourSlash { } return { - markerPositions: markerMap, - markers: markers, - globalOptions: opts, - files: files, - ranges: ranges + markerPositions, + markers, + globalOptions, + files, + ranges }; } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index aee0ef3c53..8f49e5ff76 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -589,8 +589,8 @@ module Harness { } }, getDefaultLibFilename: () => defaultLibFileName, - writeFile: writeFile, - getCanonicalFileName: getCanonicalFileName, + writeFile, + getCanonicalFileName, useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, getNewLine: ()=> sys.newLine }; @@ -806,7 +806,7 @@ module Harness { // only emit if there weren't parse errors var emitResult: ts.EmitResult; if (!isEmitBlocked) { - emitResult = checker.emitFiles(); + emitResult = checker.invokeEmitter(); } var errors: HarnessDiagnostic[] = []; @@ -845,7 +845,7 @@ module Harness { declResult = compileResult; }, settingsCallback, options); - return { declInputFiles: declInputFiles, declOtherFiles: declOtherFiles, declResult: declResult }; + return { declInputFiles, declOtherFiles, declResult }; } function addDtsFile(file: { unitName: string; content: string }, dtsFiles: { unitName: string; content: string }[]) { @@ -1169,7 +1169,7 @@ module Harness { var settings = extractCompilerSettings(code); // List of all the subfiles we've parsed out - var files: TestUnitData[] = []; + var testUnitData: TestUnitData[] = []; var lines = Utils.splitContentByNewlines(code); @@ -1205,7 +1205,7 @@ module Harness { originalFilePath: fileName, references: refs }; - files.push(newTestFile); + testUnitData.push(newTestFile); // Reset local data currentFileContent = null; @@ -1230,7 +1230,7 @@ module Harness { } // normalize the fileName for the single file case - currentFileName = files.length > 0 ? currentFileName : Path.getFileName(fileName); + currentFileName = testUnitData.length > 0 ? currentFileName : Path.getFileName(fileName); // EOF, push whatever remains var newTestFile2 = { @@ -1240,9 +1240,9 @@ module Harness { originalFilePath: fileName, references: refs }; - files.push(newTestFile2); + testUnitData.push(newTestFile2); - return { settings: settings, testUnitData: files }; + return { settings, testUnitData }; } } @@ -1338,7 +1338,7 @@ module Harness { actual = actual.replace(/\r\n?/g, '\n'); } - return { expected: expected, actual: actual }; + return { expected, actual }; } function writeComparison(expected: string, actual: string, relativeFilename: string, actualFilename: string, descriptionForDescribe: string) { diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 797bc12a42..034f4e463c 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -131,7 +131,7 @@ class ProjectRunner extends RunnerBase { if (!errors.length) { var checker = program.getTypeChecker(/*fullTypeCheck*/ true); errors = checker.getDiagnostics(); - var emitResult = checker.emitFiles(); + var emitResult = checker.invokeEmitter(); errors = ts.concatenate(errors, emitResult.errors); sourceMapData = emitResult.sourceMaps; @@ -148,10 +148,10 @@ class ProjectRunner extends RunnerBase { } return { - moduleKind: moduleKind, - program: program, - errors: errors, - sourceMapData: sourceMapData + moduleKind, + program, + errors, + sourceMapData }; function createCompilerOptions(): ts.CompilerOptions { @@ -183,10 +183,10 @@ class ProjectRunner extends RunnerBase { function createCompilerHost(): ts.CompilerHost { return { - getSourceFile: getSourceFile, + getSourceFile, getDefaultLibFilename: () => "lib.d.ts", - writeFile: writeFile, - getCurrentDirectory: getCurrentDirectory, + writeFile, + getCurrentDirectory, getCanonicalFileName: Harness.Compiler.getCanonicalFileName, useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, getNewLine: () => sys.newLine @@ -201,12 +201,12 @@ class ProjectRunner extends RunnerBase { var projectCompilerResult = compileProjectFiles(moduleKind, () => testCase.inputFiles, getSourceFileText, writeFile); return { - moduleKind: moduleKind, + moduleKind, program: projectCompilerResult.program, sourceMapData: projectCompilerResult.sourceMapData, - outputFiles: outputFiles, + outputFiles, errors: projectCompilerResult.errors, - nonSubfolderDiskFiles: nonSubfolderDiskFiles, + nonSubfolderDiskFiles, }; function getSourceFileText(filename: string): string { diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index bfb139fa71..606672e406 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -117,14 +117,14 @@ module RWC { }); function getHarnessCompilerInputUnit(fileName: string) { - var resolvedPath = ts.normalizeSlashes(sys.resolvePath(fileName)); + var unitName = ts.normalizeSlashes(sys.resolvePath(fileName)); try { - var content = sys.readFile(resolvedPath); + var content = sys.readFile(unitName); } catch (e) { // Leave content undefined. } - return { unitName: resolvedPath, content: content }; + return { unitName, content }; } }); From 1d78406bf8a3cc48356e043423bc8d7d9b7ce2a3 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 14:08:42 -0800 Subject: [PATCH 08/35] Refactoring language service to use short-hand --- src/services/formatting.ts | 6 +-- src/services/navigationBar.ts | 12 ++--- src/services/services.ts | 98 +++++++++++++++++------------------ src/services/signatureHelp.ts | 42 +++++++-------- src/services/utilities.ts | 12 ++--- 5 files changed, 84 insertions(+), 86 deletions(-) diff --git a/src/services/formatting.ts b/src/services/formatting.ts index 91a3a362fd..dde140181c 100644 --- a/src/services/formatting.ts +++ b/src/services/formatting.ts @@ -361,8 +361,8 @@ module ts.formatting { delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); } return { - indentation: indentation, - delta: delta + indentation, + delta } } @@ -834,7 +834,7 @@ module ts.formatting { } function newTextChange(start: number, len: number, newText: string): TextChange { - return { span: new TextSpan(start, len), newText: newText } + return { span: new TextSpan(start, len), newText } } function recordDelete(start: number, len: number) { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index c0ec80c98e..fd4ae0d2f9 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -262,12 +262,12 @@ module ts.NavigationBar { } return { - text: text, - kind: kind, - kindModifiers: kindModifiers, - spans: spans, - childItems: childItems, - indent: indent, + text, + kind, + kindModifiers, + spans, + childItems, + indent, bolded: false, grayed: false }; diff --git a/src/services/services.ts b/src/services/services.ts index 12f4c49dd5..13f364c6e8 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1369,8 +1369,8 @@ module ts { writeSpace: text => writeKind(text, SymbolDisplayPartKind.space), writeStringLiteral: text => writeKind(text, SymbolDisplayPartKind.stringLiteral), writeParameter: text => writeKind(text, SymbolDisplayPartKind.parameterName), - writeSymbol: writeSymbol, - writeLine: writeLine, + writeSymbol, + writeLine, increaseIndent: () => { indent++; }, decreaseIndent: () => { indent--; }, clear: resetWriter, @@ -1760,7 +1760,7 @@ module ts { sourceFiles.sort((x, y) => y.refCount - x.refCount); return { bucket: name, - sourceFiles: sourceFiles + sourceFiles }; }); return JSON.stringify(bucketInfoArray, null, 2); @@ -1826,10 +1826,10 @@ module ts { } return { - acquireDocument: acquireDocument, - updateDocument: updateDocument, - releaseDocument: releaseDocument, - reportStats: reportStats + acquireDocument, + updateDocument, + releaseDocument, + reportStats }; } @@ -1892,7 +1892,7 @@ module ts { processImport(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + return { referencedFiles, importedFiles, isLibFile: isNoDefaultLib }; } /// Helpers @@ -2291,7 +2291,7 @@ module ts { // Get emitter-diagnostics requires calling TypeChecker.emitFiles so we have to define CompilerHost.writer which does nothing because emitFiles function has side effects defined by CompilerHost.writer var savedWriter = writer; writer = (filename: string, data: string, writeByteOrderMark: boolean) => { }; - allDiagnostics = allDiagnostics.concat(checker.emitFiles(targetSourceFile).errors); + allDiagnostics = allDiagnostics.concat(checker.invokeEmitter(targetSourceFile).errors); writer = savedWriter; } return allDiagnostics @@ -2496,7 +2496,7 @@ module ts { host.log("getCompletionsAtPosition: Semantic work: " + (new Date().getTime() - semanticStart)); return { - isMemberCompletion: isMemberCompletion, + isMemberCompletion, entries: activeCompletionSession.entries }; @@ -3156,7 +3156,7 @@ module ts { documentation = symbol.getDocumentationComment(); } - return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + return { displayParts, documentation, symbolKind }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { @@ -3257,7 +3257,7 @@ module ts { kind: symbolKind, name: symbolName, containerKind: undefined, - containerName: containerName + containerName }; } @@ -4639,7 +4639,7 @@ module ts { // Perform semantic and force a type check before emit to ensure that all symbols are updated // EmitFiles will report if there is an error from TypeChecker and Emitter // Depend whether we will have to emit into a single file or not either emit only selected file in the project, emit all files into a single file - var emitFilesResult = getFullTypeCheckChecker().emitFiles(targetSourceFile); + var emitFilesResult = getFullTypeCheckChecker().invokeEmitter(targetSourceFile); emitOutput.emitOutputStatus = emitFilesResult.emitResultStatus; // Reset writer back to undefined to make sure that we produce an error message if CompilerHost.writeFile method is called when we are not in getEmitOutput @@ -5420,46 +5420,46 @@ module ts { return { canRename: true, localizedErrorMessage: undefined, - displayName: displayName, - fullDisplayName: fullDisplayName, - kind: kind, - kindModifiers: kindModifiers, - triggerSpan: triggerSpan + displayName, + fullDisplayName, + kind, + kindModifiers, + triggerSpan }; } } return { - dispose: dispose, - cleanupSemanticCache: cleanupSemanticCache, - getSyntacticDiagnostics: getSyntacticDiagnostics, - getSemanticDiagnostics: getSemanticDiagnostics, - getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, - getSyntacticClassifications: getSyntacticClassifications, - getSemanticClassifications: getSemanticClassifications, - getCompletionsAtPosition: getCompletionsAtPosition, - getCompletionEntryDetails: getCompletionEntryDetails, - getSignatureHelpItems: getSignatureHelpItems, - getQuickInfoAtPosition: getQuickInfoAtPosition, - getDefinitionAtPosition: getDefinitionAtPosition, - getReferencesAtPosition: getReferencesAtPosition, - getOccurrencesAtPosition: getOccurrencesAtPosition, + dispose, + cleanupSemanticCache, + getSyntacticDiagnostics, + getSemanticDiagnostics, + getCompilerOptionsDiagnostics, + getSyntacticClassifications, + getSemanticClassifications, + getCompletionsAtPosition, + getCompletionEntryDetails, + getSignatureHelpItems, + getQuickInfoAtPosition, + getDefinitionAtPosition, + getReferencesAtPosition, + getOccurrencesAtPosition, getImplementorsAtPosition: (filename, position) => [], - getNameOrDottedNameSpan: getNameOrDottedNameSpan, - getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, - getNavigateToItems: getNavigateToItems, - getRenameInfo: getRenameInfo, - findRenameLocations: findRenameLocations, - getNavigationBarItems: getNavigationBarItems, - getOutliningSpans: getOutliningSpans, - getTodoComments: getTodoComments, - getBraceMatchingAtPosition: getBraceMatchingAtPosition, - getIndentationAtPosition: getIndentationAtPosition, - getFormattingEditsForRange: getFormattingEditsForRange, - getFormattingEditsForDocument: getFormattingEditsForDocument, - getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, - getEmitOutput: getEmitOutput, - getSignatureAtPosition: getSignatureAtPosition, + getNameOrDottedNameSpan, + getBreakpointStatementAtPosition, + getNavigateToItems, + getRenameInfo, + findRenameLocations, + getNavigationBarItems, + getOutliningSpans, + getTodoComments, + getBraceMatchingAtPosition, + getIndentationAtPosition, + getFormattingEditsForRange, + getFormattingEditsForDocument, + getFormattingEditsAfterKeystroke, + getEmitOutput, + getSignatureAtPosition, }; } @@ -5757,9 +5757,7 @@ module ts { } } - return { - getClassificationsForLine: getClassificationsForLine - }; + return { getClassificationsForLine }; } function initializeServices() { diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index a4580582ed..7d063ae069 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -221,7 +221,7 @@ module ts.SignatureHelp { var list = getChildListThatStartsWithOpenerToken(parent, node, sourceFile); Debug.assert(list !== undefined); return { - list: list, + list, listItemIndex: 0 }; } @@ -303,40 +303,40 @@ module ts.SignatureHelp { var callTargetDisplayParts = callTargetSymbol && symbolToDisplayParts(typeInfoResolver, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined); var items: SignatureHelpItem[] = map(candidates, candidateSignature => { var signatureHelpParameters: SignatureHelpParameter[]; - var prefixParts: SymbolDisplayPart[] = []; - var suffixParts: SymbolDisplayPart[] = []; + var prefixDisplayParts: SymbolDisplayPart[] = []; + var suffixDisplayParts: SymbolDisplayPart[] = []; if (callTargetDisplayParts) { - prefixParts.push.apply(prefixParts, callTargetDisplayParts); + prefixDisplayParts.push.apply(prefixDisplayParts, callTargetDisplayParts); } if (isTypeParameterHelp) { - prefixParts.push(punctuationPart(SyntaxKind.LessThanToken)); + prefixDisplayParts.push(punctuationPart(SyntaxKind.LessThanToken)); var typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; - suffixParts.push(punctuationPart(SyntaxKind.GreaterThanToken)); + suffixDisplayParts.push(punctuationPart(SyntaxKind.GreaterThanToken)); var parameterParts = mapToDisplayParts(writer => typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, argumentListOrTypeArgumentList)); - suffixParts.push.apply(suffixParts, parameterParts); + suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts); } else { var typeParameterParts = mapToDisplayParts(writer => typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, argumentListOrTypeArgumentList)); - prefixParts.push.apply(prefixParts, typeParameterParts); - prefixParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts); + prefixDisplayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); var parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? map(parameters, createSignatureHelpParameterForParameter) : emptyArray; - suffixParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + suffixDisplayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); } var returnTypeParts = mapToDisplayParts(writer => typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, argumentListOrTypeArgumentList)); - suffixParts.push.apply(suffixParts, returnTypeParts); + suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts); return { isVariadic: candidateSignature.hasRestParameter, - prefixDisplayParts: prefixParts, - suffixDisplayParts: suffixParts, + prefixDisplayParts, + suffixDisplayParts, separatorDisplayParts: [punctuationPart(SyntaxKind.CommaToken), spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() @@ -378,11 +378,11 @@ module ts.SignatureHelp { } return { - items: items, - applicableSpan: applicableSpan, - selectedItemIndex: selectedItemIndex, - argumentIndex: argumentIndex, - argumentCount: argumentCount + items, + applicableSpan, + selectedItemIndex, + argumentIndex, + argumentCount }; function createSignatureHelpParameterForParameter(parameter: Symbol): SignatureHelpParameter { @@ -394,8 +394,8 @@ module ts.SignatureHelp { return { name: parameter.name, documentation: parameter.getDocumentationComment(), - displayParts: displayParts, - isOptional: isOptional + displayParts, + isOptional }; } @@ -406,7 +406,7 @@ module ts.SignatureHelp { return { name: typeParameter.symbol.name, documentation: emptyArray, - displayParts: displayParts, + displayParts, isOptional: false }; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 8620f8d192..b0a216c7dc 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -66,22 +66,22 @@ module ts { } export function findListItemInfo(node: Node): ListItemInfo { - var syntaxList = findContainingList(node); + var list = findContainingList(node); // It is possible at this point for syntaxList to be undefined, either if // node.parent had no list child, or if none of its list children contained // the span of node. If this happens, return undefined. The caller should // handle this case. - if (!syntaxList) { + if (!list) { return undefined; } - var children = syntaxList.getChildren(); - var index = indexOf(children, node); + var children = list.getChildren(); + var listItemIndex = indexOf(children, node); return { - listItemIndex: index, - list: syntaxList + listItemIndex, + list }; } From b8bcc700faab2fbc30b939078f4938b503ae1bfd Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 16:15:04 -0800 Subject: [PATCH 09/35] Improve error messages --- src/compiler/parser.ts | 3 ++- .../incompleteObjectLiteral1.errors.txt | 9 +++----- ...tiesErrorFromNotUsingIdentifier.errors.txt | 23 ++++++++----------- ...rthandPropertiesErrorWithModule.errors.txt | 4 ++-- .../reference/parser512097.errors.txt | 9 +++----- ...serErrorRecovery_ObjectLiteral2.errors.txt | 9 +++----- 6 files changed, 23 insertions(+), 34 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 924f6e8393..9b2485a424 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2733,6 +2733,7 @@ module ts { function parsePropertyAssignment(): Declaration { var nodePos = scanner.getStartPos(); + var isTokenIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); var node: Declaration; @@ -2757,7 +2758,7 @@ module ts { } // Parse to check if it is short-hand property assignment or normal property assignment - if (token !== SyntaxKind.ColonToken && nameToken === SyntaxKind.Identifier) { + if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && isTokenIdentifier) { node = createNode(SyntaxKind.ShorthandPropertyAssignment, nodePos); node.name = propertyName; } diff --git a/tests/baselines/reference/incompleteObjectLiteral1.errors.txt b/tests/baselines/reference/incompleteObjectLiteral1.errors.txt index c37f308960..2e363de591 100644 --- a/tests/baselines/reference/incompleteObjectLiteral1.errors.txt +++ b/tests/baselines/reference/incompleteObjectLiteral1.errors.txt @@ -1,14 +1,11 @@ -tests/cases/compiler/incompleteObjectLiteral1.ts(1,14): error TS1005: ',' expected. +tests/cases/compiler/incompleteObjectLiteral1.ts(1,14): error TS1005: ':' expected. tests/cases/compiler/incompleteObjectLiteral1.ts(1,16): error TS1128: Declaration or statement expected. -tests/cases/compiler/incompleteObjectLiteral1.ts(1,12): error TS2304: Cannot find name 'aa'. -==== tests/cases/compiler/incompleteObjectLiteral1.ts (3 errors) ==== +==== tests/cases/compiler/incompleteObjectLiteral1.ts (2 errors) ==== var tt = { aa; } ~ -!!! error TS1005: ',' expected. +!!! error TS1005: ':' expected. ~ !!! error TS1128: Declaration or statement expected. - ~~ -!!! error TS2304: Cannot find name 'aa'. var x = tt; \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt index 3c5f4e97d8..33672c3d54 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt @@ -7,18 +7,17 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(9,8): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(10,10): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(12,1): error TS1005: ':' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,6): error TS1005: ',' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,6): error TS1005: ',' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(17,6): error TS1005: '=' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(18,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,6): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,6): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(17,6): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(20,17): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,5): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,7): error TS2304: Cannot find name 'b'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,5): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(17,5): error TS2300: Duplicate identifier 'a'. -==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts (18 errors) ==== +==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts (17 errors) ==== // errors var y = { "stringLiteral", @@ -55,22 +54,20 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr var x = { a.b, ~ -!!! error TS1005: ',' expected. +!!! error TS1005: ':' expected. ~ !!! error TS2300: Duplicate identifier 'a'. - ~ -!!! error TS2304: Cannot find name 'b'. a["ss"], ~ -!!! error TS1005: ',' expected. +!!! error TS1005: ':' expected. ~ !!! error TS2300: Duplicate identifier 'a'. a[1], ~ -!!! error TS1005: '=' expected. +!!! error TS1005: ':' expected. + ~ +!!! error TS2300: Duplicate identifier 'a'. }; - ~ -!!! error TS1128: Declaration or statement expected. var v = { class }; // error ~ diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.errors.txt index f5fd8ed53f..15bac99436 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorWithModule.ts(10,10): error TS1005: ',' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorWithModule.ts(10,10): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorWithModule.ts(14,3): error TS2339: Property 'y' does not exist on type 'typeof m'. @@ -14,7 +14,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr export var y = { m.x // error ~ -!!! error TS1005: ',' expected. +!!! error TS1005: ':' expected. }; } diff --git a/tests/baselines/reference/parser512097.errors.txt b/tests/baselines/reference/parser512097.errors.txt index 181060db95..3963d969c3 100644 --- a/tests/baselines/reference/parser512097.errors.txt +++ b/tests/baselines/reference/parser512097.errors.txt @@ -1,16 +1,13 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser512097.ts(1,14): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser512097.ts(1,14): error TS1005: ':' expected. tests/cases/conformance/parser/ecmascript5/RegressionTests/parser512097.ts(1,16): error TS1128: Declaration or statement expected. -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser512097.ts(1,12): error TS2304: Cannot find name 'aa'. -==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser512097.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser512097.ts (2 errors) ==== var tt = { aa; } // After this point, no useful parsing occurs in the entire file ~ -!!! error TS1005: ',' expected. +!!! error TS1005: ':' expected. ~ !!! error TS1128: Declaration or statement expected. - ~~ -!!! error TS2304: Cannot find name 'aa'. if (true) { } \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt index 1c526f0c9e..55667d42de 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt @@ -1,14 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts(2,1): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts(2,1): error TS1005: ':' expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts(2,7): error TS1005: ':' expected. -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts(1,11): error TS2304: Cannot find name 'a'. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts (2 errors) ==== var v = { a - ~ -!!! error TS2304: Cannot find name 'a'. return; ~~~~~~ -!!! error TS1005: ',' expected. +!!! error TS1005: ':' expected. ~ !!! error TS1005: ':' expected. \ No newline at end of file From 970aac6458fe1dfe30d41b34fa4690a05e29f483 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 16:32:18 -0800 Subject: [PATCH 10/35] Address code review --- src/compiler/emitter.ts | 2 +- src/compiler/tsc.ts | 2 +- src/compiler/types.ts | 2 +- src/harness/harness.ts | 2 +- src/harness/projectsRunner.ts | 2 +- src/services/services.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 8078060628..81f44c27cc 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3564,7 +3564,7 @@ module ts { return { emitResultStatus, - errors: diagnostics, + diagnostics, sourceMaps: sourceMapDataList }; } diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 58e2ac0db0..79972c7a89 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -368,7 +368,7 @@ module ts { else { var emitStart = new Date().getTime(); var emitOutput = checker.invokeEmitter(); - var emitErrors = emitOutput.errors; + var emitErrors = emitOutput.diagnostics; exitStatus = emitOutput.emitResultStatus; var reportStart = new Date().getTime(); errors = concatenate(errors, emitErrors); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6c176bb955..a5f838b121 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -700,7 +700,7 @@ module ts { export interface EmitResult { emitResultStatus: EmitReturnStatus; - errors: Diagnostic[]; + diagnostics: Diagnostic[]; sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 8f49e5ff76..5b6db22e1d 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -810,7 +810,7 @@ module Harness { } var errors: HarnessDiagnostic[] = []; - program.getDiagnostics().concat(checker.getDiagnostics()).concat(emitResult ? emitResult.errors : []).forEach(err => { + program.getDiagnostics().concat(checker.getDiagnostics()).concat(emitResult ? emitResult.diagnostics : []).forEach(err => { // TODO: new compiler formats errors after this point to add . and newlines so we'll just do it manually for now errors.push(getMinimalDiagnostic(err)); }); diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 034f4e463c..e402c7c680 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -132,7 +132,7 @@ class ProjectRunner extends RunnerBase { var checker = program.getTypeChecker(/*fullTypeCheck*/ true); errors = checker.getDiagnostics(); var emitResult = checker.invokeEmitter(); - errors = ts.concatenate(errors, emitResult.errors); + errors = ts.concatenate(errors, emitResult.diagnostics); sourceMapData = emitResult.sourceMaps; // Clean up source map data that will be used in baselining diff --git a/src/services/services.ts b/src/services/services.ts index 13f364c6e8..14533a95a4 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2291,7 +2291,7 @@ module ts { // Get emitter-diagnostics requires calling TypeChecker.emitFiles so we have to define CompilerHost.writer which does nothing because emitFiles function has side effects defined by CompilerHost.writer var savedWriter = writer; writer = (filename: string, data: string, writeByteOrderMark: boolean) => { }; - allDiagnostics = allDiagnostics.concat(checker.invokeEmitter(targetSourceFile).errors); + allDiagnostics = allDiagnostics.concat(checker.invokeEmitter(targetSourceFile).diagnostics); writer = savedWriter; } return allDiagnostics From c417df4306b29004a0356d46f69d8e40d3c83faf Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 17:54:39 -0800 Subject: [PATCH 11/35] Remove unused getImplementorAtPosition --- src/harness/fourslash.ts | 27 ------------------- src/services/services.ts | 2 -- src/services/shims.ts | 16 ----------- tests/cases/fourslash/getImplementors1.ts | 8 ------ .../fourslash/getImplementorsForFunction.ts | 6 ----- 5 files changed, 59 deletions(-) delete mode 100644 tests/cases/fourslash/getImplementors1.ts delete mode 100644 tests/cases/fourslash/getImplementorsForFunction.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index a0d9499f48..88fb3639d1 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -749,29 +749,6 @@ module FourSlash { } } - public verifyImplementorsCountIs(count: number, localFilesOnly: boolean = true) { - var implementors = this.getImplementorsAtCaret(); - var implementorsCount = 0; - - if (localFilesOnly) { - var localFiles = this.testData.files.map(file => file.fileName); - // Count only the references in local files. Filter the ones in lib and other files. - implementors.forEach((entry) => { - if (localFiles.some((filename) => filename === entry.fileName)) { - ++implementorsCount; - } - }); - } - else { - implementorsCount = implementors.length; - } - - if (implementorsCount !== count) { - var condition = localFilesOnly ? "excluding libs" : "including libs"; - this.raiseError("Expected implementors count (" + condition + ") to be " + count + ", but is actually " + implementors.length); - } - } - private getMemberListAtCaret() { return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition, true); } @@ -788,10 +765,6 @@ module FourSlash { return this.languageService.getReferencesAtPosition(this.activeFile.fileName, this.currentCaretPosition); } - private getImplementorsAtCaret() { - return this.languageService.getImplementorsAtPosition(this.activeFile.fileName, this.currentCaretPosition); - } - private assertionMessage(name: string, actualValue: any, expectedValue: any) { return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue; } diff --git a/src/services/services.ts b/src/services/services.ts index 14533a95a4..0b6945ef84 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -892,7 +892,6 @@ module ts { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getImplementorsAtPosition(fileName: string, position: number): ReferenceEntry[]; getNavigateToItems(searchValue: string): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -5444,7 +5443,6 @@ module ts { getDefinitionAtPosition, getReferencesAtPosition, getOccurrencesAtPosition, - getImplementorsAtPosition: (filename, position) => [], getNameOrDottedNameSpan, getBreakpointStatementAtPosition, getNavigateToItems, diff --git a/src/services/shims.ts b/src/services/shims.ts index 38c68c067f..a355ddafab 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -133,12 +133,6 @@ module ts { */ getOccurrencesAtPosition(fileName: string, position: number): string; - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[] - */ - getImplementorsAtPosition(fileName: string, position: number): string; - /** * Returns a JSON-encoded value of the type: * { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = []; @@ -696,16 +690,6 @@ module ts { }); } - /// GET IMPLEMENTORS - public getImplementorsAtPosition(fileName: string, position: number): string { - return this.forwardJSONCall( - "getImplementorsAtPosition('" + fileName + "', " + position + ")", - () => { - return this.languageService.getImplementorsAtPosition(fileName, position); - }); - } - - /// COMPLETION LISTS /** diff --git a/tests/cases/fourslash/getImplementors1.ts b/tests/cases/fourslash/getImplementors1.ts deleted file mode 100644 index c67e246002..0000000000 --- a/tests/cases/fourslash/getImplementors1.ts +++ /dev/null @@ -1,8 +0,0 @@ -/// - -////class C { -//// /**/p; -////} - -goTo.marker(); -verify.implementorsCountIs(0); \ No newline at end of file diff --git a/tests/cases/fourslash/getImplementorsForFunction.ts b/tests/cases/fourslash/getImplementorsForFunction.ts deleted file mode 100644 index d2df60dc14..0000000000 --- a/tests/cases/fourslash/getImplementorsForFunction.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -////function fo/**/o() { -////} - -goTo.marker(); -verify.implementorsCountIs(0); From eb9c48ee0dad666eadf15135271db621d15623ca Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 18 Nov 2014 19:07:36 -0800 Subject: [PATCH 12/35] Update LKG --- bin/tsc.js | 41 +++++++++--------- bin/typescriptServices.js | 88 +++++++++++++++++---------------------- 2 files changed, 59 insertions(+), 70 deletions(-) diff --git a/bin/tsc.js b/bin/tsc.js index f8d31c0153..df74c76f50 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -2806,13 +2806,12 @@ var ts; if (matchResult) { var start = commentRange.pos; var end = commentRange.end; - var fileRef = { - pos: start, - end: end, - filename: matchResult[3] - }; return { - fileReference: fileRef, + fileReference: { + pos: start, + end: end, + filename: matchResult[3] + }, isNoDefaultLib: false }; } @@ -9063,25 +9062,25 @@ var ts; diagnostics.sort(ts.compareDiagnostics); diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); var hasEmitterError = ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); - var returnCode; + var emitResultStatus; if (isEmitBlocked) { - returnCode = 1 /* AllOutputGenerationSkipped */; + emitResultStatus = 1 /* AllOutputGenerationSkipped */; } else if (hasEmitterError) { - returnCode = 4 /* EmitErrorsEncountered */; + emitResultStatus = 4 /* EmitErrorsEncountered */; } else if (hasSemanticErrors && compilerOptions.declaration) { - returnCode = 3 /* DeclarationGenerationSkipped */; + emitResultStatus = 3 /* DeclarationGenerationSkipped */; } else if (hasSemanticErrors && !compilerOptions.declaration) { - returnCode = 2 /* JSGeneratedWithSemanticErrors */; + emitResultStatus = 2 /* JSGeneratedWithSemanticErrors */; } else { - returnCode = 0 /* Succeeded */; + emitResultStatus = 0 /* Succeeded */; } return { - emitResultStatus: returnCode, - errors: diagnostics, + emitResultStatus: emitResultStatus, + diagnostics: diagnostics, sourceMaps: sourceMapDataList }; } @@ -9140,14 +9139,16 @@ var ts; var compilerOptions = program.getCompilerOptions(); var checker = { getProgram: function () { return program; }, - getDiagnostics: getDiagnostics, - getGlobalDiagnostics: getGlobalDiagnostics, getNodeCount: function () { return ts.sum(program.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(program.getSourceFiles(), "identifierCount"); }, getSymbolCount: function () { return ts.sum(program.getSourceFiles(), "symbolCount"); }, getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getDiagnostics: getDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, checkProgram: checkProgram, - emitFiles: invokeEmitter, + invokeEmitter: invokeEmitter, getParentOfSymbol: getParentOfSymbol, getNarrowedTypeOfSymbol: getNarrowedTypeOfSymbol, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, @@ -9173,8 +9174,6 @@ var ts; getSignatureFromDeclaration: getSignatureFromDeclaration, isImplementationOfOverload: isImplementationOfOverload, getAliasedSymbol: resolveImport, - isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, - isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, hasEarlyErrors: hasEarlyErrors, isEmitBlocked: isEmitBlocked }; @@ -16864,8 +16863,8 @@ var ts; } else { var emitStart = new Date().getTime(); - var emitOutput = checker.emitFiles(); - var emitErrors = emitOutput.errors; + var emitOutput = checker.invokeEmitter(); + var emitErrors = emitOutput.diagnostics; exitStatus = emitOutput.emitResultStatus; var reportStart = new Date().getTime(); errors = ts.concatenate(errors, emitErrors); diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index c95e38c7b9..ca2b7ec031 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -2611,13 +2611,12 @@ var ts; if (matchResult) { var start = commentRange.pos; var end = commentRange.end; - var fileRef = { - pos: start, - end: end, - filename: matchResult[3] - }; return { - fileReference: fileRef, + fileReference: { + pos: start, + end: end, + filename: matchResult[3] + }, isNoDefaultLib: false }; } @@ -8868,25 +8867,25 @@ var ts; diagnostics.sort(ts.compareDiagnostics); diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); var hasEmitterError = ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); - var returnCode; + var emitResultStatus; if (isEmitBlocked) { - returnCode = 1 /* AllOutputGenerationSkipped */; + emitResultStatus = 1 /* AllOutputGenerationSkipped */; } else if (hasEmitterError) { - returnCode = 4 /* EmitErrorsEncountered */; + emitResultStatus = 4 /* EmitErrorsEncountered */; } else if (hasSemanticErrors && compilerOptions.declaration) { - returnCode = 3 /* DeclarationGenerationSkipped */; + emitResultStatus = 3 /* DeclarationGenerationSkipped */; } else if (hasSemanticErrors && !compilerOptions.declaration) { - returnCode = 2 /* JSGeneratedWithSemanticErrors */; + emitResultStatus = 2 /* JSGeneratedWithSemanticErrors */; } else { - returnCode = 0 /* Succeeded */; + emitResultStatus = 0 /* Succeeded */; } return { - emitResultStatus: returnCode, - errors: diagnostics, + emitResultStatus: emitResultStatus, + diagnostics: diagnostics, sourceMaps: sourceMapDataList }; } @@ -8945,14 +8944,16 @@ var ts; var compilerOptions = program.getCompilerOptions(); var checker = { getProgram: function () { return program; }, - getDiagnostics: getDiagnostics, - getGlobalDiagnostics: getGlobalDiagnostics, getNodeCount: function () { return ts.sum(program.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(program.getSourceFiles(), "identifierCount"); }, getSymbolCount: function () { return ts.sum(program.getSourceFiles(), "symbolCount"); }, getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getDiagnostics: getDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, checkProgram: checkProgram, - emitFiles: invokeEmitter, + invokeEmitter: invokeEmitter, getParentOfSymbol: getParentOfSymbol, getNarrowedTypeOfSymbol: getNarrowedTypeOfSymbol, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, @@ -8978,8 +8979,6 @@ var ts; getSignatureFromDeclaration: getSignatureFromDeclaration, isImplementationOfOverload: isImplementationOfOverload, getAliasedSymbol: resolveImport, - isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, - isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, hasEarlyErrors: hasEarlyErrors, isEmitBlocked: isEmitBlocked }; @@ -16739,33 +16738,33 @@ var ts; var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeInfoResolver, callTargetSymbol, undefined, undefined); var items = ts.map(candidates, function (candidateSignature) { var signatureHelpParameters; - var prefixParts = []; - var suffixParts = []; + var prefixDisplayParts = []; + var suffixDisplayParts = []; if (callTargetDisplayParts) { - prefixParts.push.apply(prefixParts, callTargetDisplayParts); + prefixDisplayParts.push.apply(prefixDisplayParts, callTargetDisplayParts); } if (isTypeParameterHelp) { - prefixParts.push(ts.punctuationPart(23 /* LessThanToken */)); + prefixDisplayParts.push(ts.punctuationPart(23 /* LessThanToken */)); var typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; - suffixParts.push(ts.punctuationPart(24 /* GreaterThanToken */)); + suffixDisplayParts.push(ts.punctuationPart(24 /* GreaterThanToken */)); var parameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, argumentListOrTypeArgumentList); }); - suffixParts.push.apply(suffixParts, parameterParts); + suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts); } else { var typeParameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, argumentListOrTypeArgumentList); }); - prefixParts.push.apply(prefixParts, typeParameterParts); - prefixParts.push(ts.punctuationPart(15 /* OpenParenToken */)); + prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts); + prefixDisplayParts.push(ts.punctuationPart(15 /* OpenParenToken */)); var parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; - suffixParts.push(ts.punctuationPart(16 /* CloseParenToken */)); + suffixDisplayParts.push(ts.punctuationPart(16 /* CloseParenToken */)); } var returnTypeParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, argumentListOrTypeArgumentList); }); - suffixParts.push.apply(suffixParts, returnTypeParts); + suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts); return { isVariadic: candidateSignature.hasRestParameter, - prefixDisplayParts: prefixParts, - suffixDisplayParts: suffixParts, + prefixDisplayParts: prefixDisplayParts, + suffixDisplayParts: suffixDisplayParts, separatorDisplayParts: [ts.punctuationPart(22 /* CommaToken */), ts.spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() @@ -16865,15 +16864,15 @@ var ts; } ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; function findListItemInfo(node) { - var syntaxList = findContainingList(node); - if (!syntaxList) { + var list = findContainingList(node); + if (!list) { return undefined; } - var children = syntaxList.getChildren(); - var index = ts.indexOf(children, node); + var children = list.getChildren(); + var listItemIndex = ts.indexOf(children, node); return { - listItemIndex: index, - list: syntaxList + listItemIndex: listItemIndex, + list: list }; } ts.findListItemInfo = findListItemInfo; @@ -20503,7 +20502,7 @@ var ts; var savedWriter = writer; writer = function (filename, data, writeByteOrderMark) { }; - allDiagnostics = allDiagnostics.concat(checker.emitFiles(targetSourceFile).errors); + allDiagnostics = allDiagnostics.concat(checker.invokeEmitter(targetSourceFile).diagnostics); writer = savedWriter; } return allDiagnostics; @@ -22267,7 +22266,7 @@ var ts; writer = undefined; return emitOutput; } - var emitFilesResult = getFullTypeCheckChecker().emitFiles(targetSourceFile); + var emitFilesResult = getFullTypeCheckChecker().invokeEmitter(targetSourceFile); emitOutput.emitOutputStatus = emitFilesResult.emitResultStatus; writer = undefined; return emitOutput; @@ -22829,7 +22828,6 @@ var ts; getDefinitionAtPosition: getDefinitionAtPosition, getReferencesAtPosition: getReferencesAtPosition, getOccurrencesAtPosition: getOccurrencesAtPosition, - getImplementorsAtPosition: function (filename, position) { return []; }, getNameOrDottedNameSpan: getNameOrDottedNameSpan, getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, getNavigateToItems: getNavigateToItems, @@ -23049,9 +23047,7 @@ var ts; return 5 /* Identifier */; } } - return { - getClassificationsForLine: getClassificationsForLine - }; + return { getClassificationsForLine: getClassificationsForLine }; } ts.createClassifier = createClassifier; function initializeServices() { @@ -23774,12 +23770,6 @@ var ts; return _this.languageService.getOccurrencesAtPosition(fileName, position); }); }; - LanguageServiceShimObject.prototype.getImplementorsAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getImplementorsAtPosition('" + fileName + "', " + position + ")", function () { - return _this.languageService.getImplementorsAtPosition(fileName, position); - }); - }; LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position, isMemberCompletion) { var _this = this; return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ", " + isMemberCompletion + ")", function () { From 447361cba7c7e8dcfb1ee6cc39149a1ca8613892 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 18 Nov 2014 20:55:54 -0800 Subject: [PATCH 13/35] fix getContainingList to use rangeContainsStartEnd function --- src/services/smartIndenter.ts | 24 +++++++++++------ .../cases/fourslash/formattingNestedScopes.ts | 27 +++++++++++++++++++ .../fourslash/smartIndentInCallExpressions.ts | 12 +++++++++ 3 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 tests/cases/fourslash/formattingNestedScopes.ts create mode 100644 tests/cases/fourslash/smartIndentInCallExpressions.ts diff --git a/src/services/smartIndenter.ts b/src/services/smartIndenter.ts index 7a56ea07be..e593c6cfd6 100644 --- a/src/services/smartIndenter.ts +++ b/src/services/smartIndenter.ts @@ -222,7 +222,8 @@ module ts.formatting { if (node.parent) { switch (node.parent.kind) { case SyntaxKind.TypeReference: - if ((node.parent).typeArguments) { + if ((node.parent).typeArguments && + rangeContainsStartEnd((node.parent).typeArguments, node.getStart(sourceFile), node.getEnd())) { return (node.parent).typeArguments; } break; @@ -236,21 +237,28 @@ module ts.formatting { case SyntaxKind.Method: case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: - if ((node.parent).typeParameters && node.end < (node.parent).typeParameters.end) { + var start = node.getStart(sourceFile); + if ((node.parent).typeParameters && + rangeContainsStartEnd((node.parent).typeParameters, start, node.getEnd())) { return (node.parent).typeParameters; } - - return (node.parent).parameters; + if (rangeContainsStartEnd((node.parent).parameters, start, node.getEnd())) { + return (node.parent).parameters; + } + break; case SyntaxKind.NewExpression: case SyntaxKind.CallExpression: - if ((node.parent).typeArguments && node.end < (node.parent).typeArguments.end) { + var start = node.getStart(sourceFile); + if ((node.parent).typeArguments && + rangeContainsStartEnd((node.parent).typeArguments, start, node.getEnd())) { return (node.parent).typeArguments; } - - return (node.parent).arguments; + if (rangeContainsStartEnd((node.parent).arguments, start, node.getEnd())) { + return (node.parent).arguments; + } + break; } } - return undefined; } diff --git a/tests/cases/fourslash/formattingNestedScopes.ts b/tests/cases/fourslash/formattingNestedScopes.ts new file mode 100644 index 0000000000..269a67dcaa --- /dev/null +++ b/tests/cases/fourslash/formattingNestedScopes.ts @@ -0,0 +1,27 @@ +/// + +/////*1*/ module My.App { +/////*2*/export var appModule = angular.module("app", [ +/////*3*/ ]).config([() => { +/////*4*/ configureStates +/////*5*/($stateProvider); +/////*6*/}]).run(My.App.setup); +/////*7*/ } + + +format.document() + +goTo.marker("1"); +verify.currentLineContentIs("module My.App {"); +goTo.marker("2"); +verify.currentLineContentIs(" export var appModule = angular.module(\"app\", ["); +goTo.marker("3"); +verify.currentLineContentIs(" ]).config([() => {"); +goTo.marker("4"); +verify.currentLineContentIs(" configureStates"); +goTo.marker("5"); +verify.currentLineContentIs(" ($stateProvider);"); +goTo.marker("6"); +verify.currentLineContentIs(" }]).run(My.App.setup);"); +goTo.marker("7"); +verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/smartIndentInCallExpressions.ts b/tests/cases/fourslash/smartIndentInCallExpressions.ts new file mode 100644 index 0000000000..1e28932678 --- /dev/null +++ b/tests/cases/fourslash/smartIndentInCallExpressions.ts @@ -0,0 +1,12 @@ +/// + +////module My.App { +//// export var appModule = angular.module("app", [ +//// ]).config([() => { +//// configureStates/*1*/($stateProvider); +//// }]).run(My.App.setup); +////} + +goTo.marker("1") +edit.insert("\n"); +verify.indentationIs(12); // 4 (module block) + 4 (function block) + 4 (call expression) \ No newline at end of file From e3e95ffeea11e99596d5ac1f0ab21872e8836c55 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 19 Nov 2014 11:09:57 -0800 Subject: [PATCH 14/35] Address code review --- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- src/compiler/parser.ts | 2 +- .../reference/objectTypesWithOptionalProperties.errors.txt | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 53a20a99fd..2160c7e64e 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -124,7 +124,7 @@ module ts { Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." }, Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." }, - A_object_member_cannot_be_declared_optional: { code: 1160, category: DiagnosticCategory.Error, key: "A object member cannot be declared optional." }, + An_object_member_cannot_be_declared_optional: { code: 1160, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, 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." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 78c60f2276..8995670ac0 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -488,7 +488,7 @@ "code": 1161 }, - "A object member cannot be declared optional.": { + "An object member cannot be declared optional.": { "category": "Error", "code": 1160 }, diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9b2485a424..e8d5133b2e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2753,7 +2753,7 @@ module ts { // Disallow optional property assignment if (token === SyntaxKind.QuestionToken) { var questionStart = scanner.getTokenPos(); - grammarErrorAtPos(questionStart, scanner.getStartPos() - questionStart, Diagnostics.A_object_member_cannot_be_declared_optional); + grammarErrorAtPos(questionStart, scanner.getStartPos() - questionStart, Diagnostics.An_object_member_cannot_be_declared_optional); nextToken(); } diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt index e73e8adc93..14afcebd21 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(12,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(20,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1160: A object member cannot be declared optional. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1160: An object member cannot be declared optional. ==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (3 errors) ==== @@ -33,5 +33,5 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith var b = { x?: 1 // error -!!! error TS1160: A object member cannot be declared optional. +!!! error TS1160: An object member cannot be declared optional. } \ No newline at end of file From 0604a927c85ee5093a11a3e7cb86a58047fe4185 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 19 Nov 2014 12:03:25 -0800 Subject: [PATCH 15/35] Removed tests from fourslash_old that were duplicates. --- .../cases/fourslash_old/callSignatureHelp.ts | 10 -- .../classExtendsInterfaceSigHelp1.ts | 18 ---- ...ectLiteralThatIsParameterOfFunctionCall.ts | 10 -- .../fourslash_old/functionOverloadCount.ts | 15 --- .../genericFunctionSignatureHelp1.ts | 7 -- .../genericFunctionSignatureHelp2.ts | 7 -- .../genericFunctionSignatureHelp3.ts | 39 -------- .../genericFunctionSignatureHelp3MultiFile.ts | 46 --------- .../cases/fourslash_old/getOutliningSpans.ts | 97 ------------------- ...tionExpressionAboveInterfaceDeclaration.ts | 17 ---- .../fourslash_old/paramHelpOnCommaInString.ts | 11 --- .../parameterInfoOnParameterType.ts | 11 --- .../fourslash_old/restArgSignatureHelp.ts | 7 -- .../signatureHelpAnonymousFunction.ts | 17 ---- .../cases/fourslash_old/signatureHelpAtEOF.ts | 15 --- .../signatureHelpBeforeSemicolon1.ts | 15 --- .../signatureHelpCallExpression.ts | 16 --- .../signatureHelpConstructExpression.ts | 17 ---- .../signatureHelpConstructorInheritance.ts | 22 ----- .../signatureHelpConstructorOverload.ts | 16 --- .../signatureHelpForSuperCalls1.ts | 28 ------ .../signatureHelpFunctionOverload.ts | 18 ---- .../signatureHelpFunctionParameter.ts | 17 ---- .../signatureHelpImplicitConstructor.ts | 10 -- .../fourslash_old/signatureHelpInCallback.ts | 11 --- .../signatureHelpInCompleteGenericsCall.ts | 8 -- ...allOnFunctionDeclarationInMultipleFiles.ts | 14 --- ...ureHelpInIncompleteInvocationExpression.ts | 19 ---- .../signatureHelpInParenthetical.ts | 9 -- .../signatureHelpIncompleteCalls.ts | 31 ------ .../fourslash_old/signatureHelpNoArguments.ts | 12 --- .../signatureHelpObjectLiteral.ts | 17 ---- .../signatureHelpOnOverloadOnConst.ts | 26 ----- .../fourslash_old/signatureHelpOnOverloads.ts | 18 ---- ...ureHelpOnSuperWhenMembersAreNotResolved.ts | 14 --- .../signatureHelpSimpleConstructorCall.ts | 17 ---- .../signatureHelpSimpleFunctionCall.ts | 19 ---- .../signatureHelpSimpleSuperCall.ts | 20 ---- .../signatureHelpSuperConstructorOverload.ts | 28 ------ .../signatureHelpWhenEditingCallExpression.ts | 30 ------ .../fourslash_old/staticGenericOverloads1.ts | 22 ----- tests/cases/fourslash_old/todoComments1.ts | 3 - tests/cases/fourslash_old/todoComments10.ts | 6 -- tests/cases/fourslash_old/todoComments11.ts | 6 -- tests/cases/fourslash_old/todoComments12.ts | 6 -- tests/cases/fourslash_old/todoComments13.ts | 4 - tests/cases/fourslash_old/todoComments14.ts | 3 - tests/cases/fourslash_old/todoComments15.ts | 3 - tests/cases/fourslash_old/todoComments16.ts | 3 - tests/cases/fourslash_old/todoComments17.ts | 3 - tests/cases/fourslash_old/todoComments2.ts | 3 - tests/cases/fourslash_old/todoComments3.ts | 3 - tests/cases/fourslash_old/todoComments4.ts | 3 - tests/cases/fourslash_old/todoComments5.ts | 6 -- tests/cases/fourslash_old/todoComments6.ts | 6 -- tests/cases/fourslash_old/todoComments7.ts | 6 -- tests/cases/fourslash_old/todoComments8.ts | 6 -- tests/cases/fourslash_old/todoComments9.ts | 6 -- 58 files changed, 877 deletions(-) delete mode 100644 tests/cases/fourslash_old/callSignatureHelp.ts delete mode 100644 tests/cases/fourslash_old/classExtendsInterfaceSigHelp1.ts delete mode 100644 tests/cases/fourslash_old/completionListInObjectLiteralThatIsParameterOfFunctionCall.ts delete mode 100644 tests/cases/fourslash_old/functionOverloadCount.ts delete mode 100644 tests/cases/fourslash_old/genericFunctionSignatureHelp1.ts delete mode 100644 tests/cases/fourslash_old/genericFunctionSignatureHelp2.ts delete mode 100644 tests/cases/fourslash_old/genericFunctionSignatureHelp3.ts delete mode 100644 tests/cases/fourslash_old/genericFunctionSignatureHelp3MultiFile.ts delete mode 100644 tests/cases/fourslash_old/getOutliningSpans.ts delete mode 100644 tests/cases/fourslash_old/incrementalEditInvocationExpressionAboveInterfaceDeclaration.ts delete mode 100644 tests/cases/fourslash_old/paramHelpOnCommaInString.ts delete mode 100644 tests/cases/fourslash_old/parameterInfoOnParameterType.ts delete mode 100644 tests/cases/fourslash_old/restArgSignatureHelp.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpAnonymousFunction.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpAtEOF.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpBeforeSemicolon1.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpCallExpression.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpConstructExpression.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpConstructorInheritance.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpConstructorOverload.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpForSuperCalls1.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpFunctionOverload.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpFunctionParameter.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpImplicitConstructor.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpInCallback.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpInCompleteGenericsCall.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpInIncompleteInvocationExpression.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpInParenthetical.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpIncompleteCalls.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpNoArguments.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpObjectLiteral.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpOnOverloadOnConst.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpOnOverloads.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpOnSuperWhenMembersAreNotResolved.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpSimpleConstructorCall.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpSimpleFunctionCall.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpSimpleSuperCall.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpSuperConstructorOverload.ts delete mode 100644 tests/cases/fourslash_old/signatureHelpWhenEditingCallExpression.ts delete mode 100644 tests/cases/fourslash_old/staticGenericOverloads1.ts delete mode 100644 tests/cases/fourslash_old/todoComments1.ts delete mode 100644 tests/cases/fourslash_old/todoComments10.ts delete mode 100644 tests/cases/fourslash_old/todoComments11.ts delete mode 100644 tests/cases/fourslash_old/todoComments12.ts delete mode 100644 tests/cases/fourslash_old/todoComments13.ts delete mode 100644 tests/cases/fourslash_old/todoComments14.ts delete mode 100644 tests/cases/fourslash_old/todoComments15.ts delete mode 100644 tests/cases/fourslash_old/todoComments16.ts delete mode 100644 tests/cases/fourslash_old/todoComments17.ts delete mode 100644 tests/cases/fourslash_old/todoComments2.ts delete mode 100644 tests/cases/fourslash_old/todoComments3.ts delete mode 100644 tests/cases/fourslash_old/todoComments4.ts delete mode 100644 tests/cases/fourslash_old/todoComments5.ts delete mode 100644 tests/cases/fourslash_old/todoComments6.ts delete mode 100644 tests/cases/fourslash_old/todoComments7.ts delete mode 100644 tests/cases/fourslash_old/todoComments8.ts delete mode 100644 tests/cases/fourslash_old/todoComments9.ts diff --git a/tests/cases/fourslash_old/callSignatureHelp.ts b/tests/cases/fourslash_old/callSignatureHelp.ts deleted file mode 100644 index 4e813dd17c..0000000000 --- a/tests/cases/fourslash_old/callSignatureHelp.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -////interface C { -//// (): number; -////} -////var c: C; -////c(/**/ - -goTo.marker(); -verify.currentSignatureHelpIs('c(): number'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/classExtendsInterfaceSigHelp1.ts b/tests/cases/fourslash_old/classExtendsInterfaceSigHelp1.ts deleted file mode 100644 index ebdccef485..0000000000 --- a/tests/cases/fourslash_old/classExtendsInterfaceSigHelp1.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -////class C { -//// public foo(x: string); -//// public foo(x: number); -//// public foo(x: any) { return x; } -////} - -////interface I extends C { -//// other(x: any): any; -////} - -////var i: I; -////i.foo(/**/ - -goTo.marker(); -verify.signatureHelpCountIs(2); -verify.currentParameterSpanIs('x: string'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/completionListInObjectLiteralThatIsParameterOfFunctionCall.ts b/tests/cases/fourslash_old/completionListInObjectLiteralThatIsParameterOfFunctionCall.ts deleted file mode 100644 index bb04cd2ce6..0000000000 --- a/tests/cases/fourslash_old/completionListInObjectLiteralThatIsParameterOfFunctionCall.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -////class C { x: string; } -////class D { x: string; y: string; } -////function foo(t: T, t2: U) { return null; } -////var r3 = foo(new C(), { x: '', z/*1*/ - -goTo.marker('1') -verify.not.completionListContains('z'); -verify.not.completionListContains('x'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/functionOverloadCount.ts b/tests/cases/fourslash_old/functionOverloadCount.ts deleted file mode 100644 index 00856dcb24..0000000000 --- a/tests/cases/fourslash_old/functionOverloadCount.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -////class C1 { -//// public attr(): string; -//// public attr(i: number): string; -//// public attr(i: number, x: boolean): string; -//// public attr(i?: any, x?: any) { -//// return "hi"; -//// } -////} -////var i = new C1; -////i.attr(/*1*/ - -goTo.marker('1'); -verify.signatureHelpCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericFunctionSignatureHelp1.ts b/tests/cases/fourslash_old/genericFunctionSignatureHelp1.ts deleted file mode 100644 index fc1e45d7e6..0000000000 --- a/tests/cases/fourslash_old/genericFunctionSignatureHelp1.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -////function f(a: T): T { return null; } -////f(/**/ - -goTo.marker(); -verify.currentSignatureHelpIs('f(a: T): T'); diff --git a/tests/cases/fourslash_old/genericFunctionSignatureHelp2.ts b/tests/cases/fourslash_old/genericFunctionSignatureHelp2.ts deleted file mode 100644 index 7751167758..0000000000 --- a/tests/cases/fourslash_old/genericFunctionSignatureHelp2.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -////var f = (a: T) => a; -////f(/**/ - -goTo.marker(); -verify.currentSignatureHelpIs('f(a: T): T'); diff --git a/tests/cases/fourslash_old/genericFunctionSignatureHelp3.ts b/tests/cases/fourslash_old/genericFunctionSignatureHelp3.ts deleted file mode 100644 index 5f3adc6025..0000000000 --- a/tests/cases/fourslash_old/genericFunctionSignatureHelp3.ts +++ /dev/null @@ -1,39 +0,0 @@ -/// - -////function foo1(x: number, callback: (y1: T) => number) { } -////function foo2(x: number, callback: (y2: T) => number) { } -////function foo3(x: number, callback: (y3: T) => number) { } -////function foo4(x: number, callback: (y4: T) => number) { } -////function foo5(x: number, callback: (y5: T) => number) { } -////function foo6(x: number, callback: (y6: T) => number) { } -////function foo7(x: number, callback: (y7: T) => number) { } -//// IDE shows the results on the right of each line, fourslash says different -////foo1(/*1*/ // signature help shows y as T -////foo2(1,/*2*/ // signature help shows y as {} -////foo3(1, (/*3*/ // signature help shows y as T -////foo4(1,/*4*/ // signature help shows y as string -////foo5(1, (/*5*/ // signature help shows y as T -////foo6(1, (/*7*/ // signature help shows y as T - -goTo.marker('1'); -verify.currentSignatureHelpIs('foo1(x: number, callback: (y1: T) => number): void'); - -goTo.marker('2'); -verify.currentSignatureHelpIs('foo2(x: number, callback: (y2: {}) => number): void'); - -goTo.marker('3'); -verify.currentSignatureHelpIs('foo3(x: number, callback: (y3: T) => number): void'); - -goTo.marker('4'); -verify.currentSignatureHelpIs('foo4(x: number, callback: (y4: string) => number): void'); - -goTo.marker('5'); -verify.currentSignatureHelpIs('foo5(x: number, callback: (y5: T) => number): void'); - -goTo.marker('6'); -verify.currentSignatureHelpIs('foo6(x: number, callback: (y6: {}) => number): void'); -edit.insert('string>(null,null);'); // need to make this line parse so we can get reasonable LS answers to later tests - -goTo.marker('7'); -verify.currentSignatureHelpIs('foo7(x: number, callback: (y7: T) => number): void'); diff --git a/tests/cases/fourslash_old/genericFunctionSignatureHelp3MultiFile.ts b/tests/cases/fourslash_old/genericFunctionSignatureHelp3MultiFile.ts deleted file mode 100644 index dbb0a9fe83..0000000000 --- a/tests/cases/fourslash_old/genericFunctionSignatureHelp3MultiFile.ts +++ /dev/null @@ -1,46 +0,0 @@ -/// - -// @Filename: genericFunctionSignatureHelp_0.ts -////function foo1(x: number, callback: (y1: T) => number) { } -// @Filename: genericFunctionSignatureHelp_1.ts -////function foo2(x: number, callback: (y2: T) => number) { } -// @Filename: genericFunctionSignatureHelp_2.ts -////function foo3(x: number, callback: (y3: T) => number) { } -// @Filename: genericFunctionSignatureHelp_3.ts -////function foo4(x: number, callback: (y4: T) => number) { } -// @Filename: genericFunctionSignatureHelp_4.ts -////function foo5(x: number, callback: (y5: T) => number) { } -// @Filename: genericFunctionSignatureHelp_5.ts -////function foo6(x: number, callback: (y6: T) => number) { } -// @Filename: genericFunctionSignatureHelp_6.ts -////function foo7(x: number, callback: (y7: T) => number) { } -// @Filename: genericFunctionSignatureHelp_7.ts -////foo1(/*1*/ // signature help shows y as T -////foo2(1,/*2*/ // signature help shows y as {} -////foo3(1, (/*3*/ // signature help shows y as T -////foo4(1,/*4*/ // signature help shows y as string -////foo5(1, (/*5*/ // signature help shows y as T -////foo6(1, (/*7*/ // signature help shows y as T - -goTo.marker('1'); -verify.currentSignatureHelpIs('foo1(x: number, callback: (y1: T) => number): void'); - -goTo.marker('2'); -verify.currentSignatureHelpIs('foo2(x: number, callback: (y2: {}) => number): void'); - -goTo.marker('3'); -verify.currentSignatureHelpIs('foo3(x: number, callback: (y3: T) => number): void'); - -goTo.marker('4'); -verify.currentSignatureHelpIs('foo4(x: number, callback: (y4: string) => number): void'); - -goTo.marker('5'); -verify.currentSignatureHelpIs('foo5(x: number, callback: (y5: T) => number): void'); - -goTo.marker('6'); -verify.currentSignatureHelpIs('foo6(x: number, callback: (y6: {}) => number): void'); -edit.insert('string>(null,null);'); // need to make this line parse so we can get reasonable LS answers to later tests - -goTo.marker('7'); -verify.currentSignatureHelpIs('foo7(x: number, callback: (y7: T) => number): void'); diff --git a/tests/cases/fourslash_old/getOutliningSpans.ts b/tests/cases/fourslash_old/getOutliningSpans.ts deleted file mode 100644 index 56a4aa7120..0000000000 --- a/tests/cases/fourslash_old/getOutliningSpans.ts +++ /dev/null @@ -1,97 +0,0 @@ -/// - -////// interface -////interface IFoo[| { -//// getDist(): number; -////}|] -//// -////// class members -////class Foo[| { -//// constructor()[| { -//// }|] -//// -//// public foo(): number[| { -//// return 0; -//// }|] -//// -//// public get X()[| { -//// return 1; -//// }|] -//// -//// public set X(v: number)[| { -//// }|] -//// -//// public member = function f()[| { -//// -//// }|] -////}|] -//// -////// modules -////module m1[| { -//// module m2[| { }|] -//// module m3[| { -//// function foo()[| { -//// -//// }|] -//// -//// interface IFoo2[| { -//// -//// }|] -//// -//// class foo2 implements IFoo2[| { -//// -//// }|] -//// }|] -////}|] -//// -////// function declaration -////function foo(): number[| { -//// return 0; -////}|] -//// -////// function expressions -////(function f()[| { -//// -////}|]) -//// -////// trivia handeling -////class ClassFooWithTrivia[| /* some comments */ -//// /* more trivia */ { -//// -//// -//// /*some trailing trivia */ -////}|] /* even more */ -//// -//////outline with deep nesting -////module m1[|{ -//// module m2[| { -//// module m3[| { -//// module m4[| { -//// module m5[| { -//// module m6[| { -//// module m7[| { -//// module m8[| { -//// module m9[| { -//// module m10[| { -//// module m11 { -//// module m12 { -//// export interface IFoo { -//// } -//// } -//// } -//// }|] -//// }|] -//// }|] -//// }|] -//// }|] -//// }|] -//// }|] -//// }|] -//// }|] -////}|] -//// -//////outline after a deeply nested node -////class AfterNestedNodes[| { -////}|] - -verify.outliningSpansInCurrentFile(test.ranges()); diff --git a/tests/cases/fourslash_old/incrementalEditInvocationExpressionAboveInterfaceDeclaration.ts b/tests/cases/fourslash_old/incrementalEditInvocationExpressionAboveInterfaceDeclaration.ts deleted file mode 100644 index 8a06efbaa4..0000000000 --- a/tests/cases/fourslash_old/incrementalEditInvocationExpressionAboveInterfaceDeclaration.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -////declare function alert(message?: any): void; -/////*1*/ -////interface Foo { -//// setISO8601(dString): Date; -////} - -diagnostics.setEditValidation(IncrementalEditValidation.None); - -// Do resolve without typeCheck -goTo.marker('1'); -edit.insert("alert("); -verify.currentSignatureHelpIs("alert(message?: any): void"); - -// TypeCheck -verify.errorExistsAfterMarker('1'); diff --git a/tests/cases/fourslash_old/paramHelpOnCommaInString.ts b/tests/cases/fourslash_old/paramHelpOnCommaInString.ts deleted file mode 100644 index 0027178158..0000000000 --- a/tests/cases/fourslash_old/paramHelpOnCommaInString.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -////function blah(foo: string, bar: number) { -////} -////blah('hola/*1*/,/*2*/') - -// making sure the comma in a string literal doesn't trigger param help on the second function param -goTo.marker('1'); -verify.currentParameterHelpArgumentNameIs('foo'); -goTo.marker('2'); -verify.currentParameterHelpArgumentNameIs('foo'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/parameterInfoOnParameterType.ts b/tests/cases/fourslash_old/parameterInfoOnParameterType.ts deleted file mode 100644 index d28e675e24..0000000000 --- a/tests/cases/fourslash_old/parameterInfoOnParameterType.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -////function foo(a: string) { }; -////var b = "test"; -////foo("test"/*1*/); -////foo(b/*2*/); - -goTo.marker("1"); -verify.currentParameterHelpArgumentNameIs("a"); -goTo.marker("2"); -verify.currentParameterHelpArgumentNameIs("a"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/restArgSignatureHelp.ts b/tests/cases/fourslash_old/restArgSignatureHelp.ts deleted file mode 100644 index baa8702a5f..0000000000 --- a/tests/cases/fourslash_old/restArgSignatureHelp.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -////function f(...x: any[]) { } -////f(/**/); - -goTo.marker(); -verify.currentParameterHelpArgumentNameIs('x'); diff --git a/tests/cases/fourslash_old/signatureHelpAnonymousFunction.ts b/tests/cases/fourslash_old/signatureHelpAnonymousFunction.ts deleted file mode 100644 index cc723c713d..0000000000 --- a/tests/cases/fourslash_old/signatureHelpAnonymousFunction.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -////var anonymousFunctionTest = function(n: number, s: string): (a: number, b: string) => string { -//// return null; -////} -////anonymousFunctionTest(5, "")(/*anonymousFunction1*/1, /*anonymousFunction2*/""); - -goTo.marker('anonymousFunction1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureParamterCountIs(2); -verify.currentSignatureHelpIs('(a: number, b: string): string'); -verify.currentParameterHelpArgumentNameIs("a"); -verify.currentParameterSpanIs("a: number"); - -goTo.marker('anonymousFunction2'); -verify.currentParameterHelpArgumentNameIs("b"); -verify.currentParameterSpanIs("b: string"); diff --git a/tests/cases/fourslash_old/signatureHelpAtEOF.ts b/tests/cases/fourslash_old/signatureHelpAtEOF.ts deleted file mode 100644 index 64c4aaeeb2..0000000000 --- a/tests/cases/fourslash_old/signatureHelpAtEOF.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -////function Foo(arg1: string, arg2: string) { -////} -//// -////Foo(/**/ - -goTo.marker(); -verify.signatureHelpPresent(); -verify.signatureHelpCountIs(1); - -verify.currentSignatureHelpIs("Foo(arg1: string, arg2: string): void"); -verify.currentSignatureParamterCountIs(2); -verify.currentParameterHelpArgumentNameIs("arg1"); -verify.currentParameterSpanIs("arg1: string"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpBeforeSemicolon1.ts b/tests/cases/fourslash_old/signatureHelpBeforeSemicolon1.ts deleted file mode 100644 index 2b0b07056b..0000000000 --- a/tests/cases/fourslash_old/signatureHelpBeforeSemicolon1.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -////function Foo(arg1: string, arg2: string) { -////} -//// -////Foo(/**/; - -goTo.marker(); -verify.signatureHelpPresent(); -verify.signatureHelpCountIs(1); - -verify.currentSignatureHelpIs("Foo(arg1: string, arg2: string): void"); -verify.currentSignatureParamterCountIs(2); -verify.currentParameterHelpArgumentNameIs("arg1"); -verify.currentParameterSpanIs("arg1: string"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpCallExpression.ts b/tests/cases/fourslash_old/signatureHelpCallExpression.ts deleted file mode 100644 index 50d89aaae4..0000000000 --- a/tests/cases/fourslash_old/signatureHelpCallExpression.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// - -////function fnTest(str: string, num: number) { } -////fnTest(/*1*/'', /*2*/5); - -goTo.marker('1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureParamterCountIs(2); -verify.currentSignatureHelpIs('fnTest(str: string, num: number): void'); - -verify.currentParameterHelpArgumentNameIs('str'); -verify.currentParameterSpanIs("str: string"); - -goTo.marker('2'); -verify.currentParameterHelpArgumentNameIs('num'); -verify.currentParameterSpanIs("num: number"); diff --git a/tests/cases/fourslash_old/signatureHelpConstructExpression.ts b/tests/cases/fourslash_old/signatureHelpConstructExpression.ts deleted file mode 100644 index a88cb3fce6..0000000000 --- a/tests/cases/fourslash_old/signatureHelpConstructExpression.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -////class sampleCls { constructor(str: string, num: number) { } } -////var x = new sampleCls(/*1*/"", /*2*/5); - -goTo.marker('1'); -verify.signatureHelpCountIs(1); - -verify.currentSignatureParamterCountIs(2); -verify.currentSignatureHelpIs('sampleCls(str: string, num: number): sampleCls'); - -verify.currentParameterHelpArgumentNameIs('str'); -verify.currentParameterSpanIs("str: string"); - -goTo.marker('2'); -verify.currentParameterHelpArgumentNameIs('num'); -verify.currentParameterSpanIs("num: number"); diff --git a/tests/cases/fourslash_old/signatureHelpConstructorInheritance.ts b/tests/cases/fourslash_old/signatureHelpConstructorInheritance.ts deleted file mode 100644 index b066eab3fd..0000000000 --- a/tests/cases/fourslash_old/signatureHelpConstructorInheritance.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -////class base { -//// constructor(s: string); -//// constructor(n: number); -//// constructor(a: any) { } -////} -////class B1 extends base { } -////class B2 extends B1 { } -////class B3 extends B2 { -//// constructor() { -//// super(/*indirectSuperCall*/3); -//// } -////} - - -goTo.marker('indirectSuperCall'); -verify.signatureHelpCountIs(2); -verify.currentSignatureParamterCountIs(1); -verify.currentSignatureHelpIs('B2(n: number): B2'); -verify.currentParameterHelpArgumentNameIs("n"); -verify.currentParameterSpanIs("n: number"); diff --git a/tests/cases/fourslash_old/signatureHelpConstructorOverload.ts b/tests/cases/fourslash_old/signatureHelpConstructorOverload.ts deleted file mode 100644 index ce276e09d8..0000000000 --- a/tests/cases/fourslash_old/signatureHelpConstructorOverload.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// - -////class clsOverload { constructor(); constructor(test: string); constructor(test?: string) { } } -////var x = new clsOverload(/*1*/); -////var y = new clsOverload(/*2*/''); - -goTo.marker('1'); -verify.signatureHelpCountIs(2); -verify.currentSignatureParamterCountIs(0); -verify.currentSignatureHelpIs('clsOverload(): clsOverload'); - -goTo.marker('2'); -verify.currentSignatureParamterCountIs(1); -verify.currentSignatureHelpIs('clsOverload(test: string): clsOverload'); -verify.currentParameterHelpArgumentNameIs('test'); -verify.currentParameterSpanIs("test: string"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpForSuperCalls1.ts b/tests/cases/fourslash_old/signatureHelpForSuperCalls1.ts deleted file mode 100644 index 58e083ea2e..0000000000 --- a/tests/cases/fourslash_old/signatureHelpForSuperCalls1.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -////class A { } -////class B extends A { } -////class C extends B { -//// constructor() { -//// super(/*1*/ // sig help here? -//// } -////} -////class A2 { } -////class B2 extends A2 { -//// constructor(x:number) {} -//// } -////class C2 extends B2 { -//// constructor() { -//// super(/*2*/ // sig help here? -//// } -////} - -// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker('1'); -verify.signatureHelpPresent(); -verify.currentSignatureHelpIs('B(): B'); - -goTo.marker('2'); -verify.currentSignatureHelpIs('B2(x: number): B2'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpFunctionOverload.ts b/tests/cases/fourslash_old/signatureHelpFunctionOverload.ts deleted file mode 100644 index 2c1cdb5129..0000000000 --- a/tests/cases/fourslash_old/signatureHelpFunctionOverload.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -////function functionOverload(); -////function functionOverload(test: string); -////function functionOverload(test?: string) { } -////functionOverload(/*functionOverload1*/); -////functionOverload(""/*functionOverload2*/); - -goTo.marker('functionOverload1'); -verify.signatureHelpCountIs(2); -verify.currentSignatureParamterCountIs(0); -verify.currentSignatureHelpIs('functionOverload(): any'); - -goTo.marker('functionOverload2'); -verify.currentSignatureParamterCountIs(1); -verify.currentSignatureHelpIs('functionOverload(test: string): any'); -verify.currentParameterHelpArgumentNameIs("test"); -verify.currentParameterSpanIs("test: string"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpFunctionParameter.ts b/tests/cases/fourslash_old/signatureHelpFunctionParameter.ts deleted file mode 100644 index cb2264f2c4..0000000000 --- a/tests/cases/fourslash_old/signatureHelpFunctionParameter.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -////function parameterFunction(callback: (a: number, b: string) => void) { -//// callback(/*parameterFunction1*/5, /*parameterFunction2*/""); -////} - -goTo.marker('parameterFunction1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureParamterCountIs(2); -verify.currentSignatureHelpIs('callback(a: number, b: string): void'); -verify.currentParameterHelpArgumentNameIs("a"); -verify.currentParameterSpanIs("a: number"); - -goTo.marker('parameterFunction2'); -verify.currentSignatureHelpIs('callback(a: number, b: string): void'); -verify.currentParameterHelpArgumentNameIs("b"); -verify.currentParameterSpanIs("b: string"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpImplicitConstructor.ts b/tests/cases/fourslash_old/signatureHelpImplicitConstructor.ts deleted file mode 100644 index 9e42d25dbe..0000000000 --- a/tests/cases/fourslash_old/signatureHelpImplicitConstructor.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -////class ImplicitConstructor { -////} -////var implicitConstructor = new ImplicitConstructor(/**/); - -goTo.marker(); -verify.signatureHelpCountIs(1); -verify.currentSignatureHelpIs("ImplicitConstructor(): ImplicitConstructor"); -verify.currentSignatureParamterCountIs(0); diff --git a/tests/cases/fourslash_old/signatureHelpInCallback.ts b/tests/cases/fourslash_old/signatureHelpInCallback.ts deleted file mode 100644 index dd4856b48e..0000000000 --- a/tests/cases/fourslash_old/signatureHelpInCallback.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -////declare function forEach(f: () => void); -////forEach(/*1*/() => { -//// /*2*/ -////}); - -goTo.marker('1'); -verify.signatureHelpPresent(); -goTo.marker('2'); -verify.not.signatureHelpPresent(); diff --git a/tests/cases/fourslash_old/signatureHelpInCompleteGenericsCall.ts b/tests/cases/fourslash_old/signatureHelpInCompleteGenericsCall.ts deleted file mode 100644 index 12036cd6db..0000000000 --- a/tests/cases/fourslash_old/signatureHelpInCompleteGenericsCall.ts +++ /dev/null @@ -1,8 +0,0 @@ -/// - -////function foo(x: number, callback: (x: T) => number) { -////} -////foo(/*1*/ - -goTo.marker('1'); -verify.currentSignatureHelpIs("foo(x: number, callback: (x: T) => number): void"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles.ts b/tests/cases/fourslash_old/signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles.ts deleted file mode 100644 index 2339af0252..0000000000 --- a/tests/cases/fourslash_old/signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file0.ts -////declare function fn(x: string, y: number); - -// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file1.ts -////declare function fn(x: string); - -// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file2.ts -////fn(/*1*/ - -diagnostics.setEditValidation(IncrementalEditValidation.None); -goTo.marker('1'); -verify.signatureHelpCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpInIncompleteInvocationExpression.ts b/tests/cases/fourslash_old/signatureHelpInIncompleteInvocationExpression.ts deleted file mode 100644 index 2e097b2a76..0000000000 --- a/tests/cases/fourslash_old/signatureHelpInIncompleteInvocationExpression.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// - -/////** -//// * Returns the substring at the specified location within a String object. -//// * @param start The zero-based index integer indicating the beginning of the substring. -//// * @param end Zero-based index integer indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. -//// * If end is omitted, the characters from start through the end of the original string are returned. -//// */ -////function foo(start: number, end?: number) { -//// return ""; -////} -//// -////foo(/*1*/ -goTo.marker('1'); -verify.currentParameterHelpArgumentDocCommentIs("The zero-based index integer indicating the beginning of the substring."); -edit.insert("10,"); -verify.currentParameterHelpArgumentDocCommentIs("Zero-based index integer indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\nIf end is omitted, the characters from start through the end of the original string are returned."); -edit.insert(" "); -verify.currentParameterHelpArgumentDocCommentIs("Zero-based index integer indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\nIf end is omitted, the characters from start through the end of the original string are returned."); diff --git a/tests/cases/fourslash_old/signatureHelpInParenthetical.ts b/tests/cases/fourslash_old/signatureHelpInParenthetical.ts deleted file mode 100644 index 0628d904fd..0000000000 --- a/tests/cases/fourslash_old/signatureHelpInParenthetical.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -//// class base { constructor (public n: number, public y: string) { } } -//// (new base(/**/ - -goTo.marker(); -verify.currentParameterHelpArgumentNameIs('n'); -edit.insert('0, '); -verify.currentParameterHelpArgumentNameIs('y'); diff --git a/tests/cases/fourslash_old/signatureHelpIncompleteCalls.ts b/tests/cases/fourslash_old/signatureHelpIncompleteCalls.ts deleted file mode 100644 index e73217b1d8..0000000000 --- a/tests/cases/fourslash_old/signatureHelpIncompleteCalls.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -////module IncompleteCalls { -//// class Foo { -//// public f1() { } -//// public f2(n: number): number { return 0; } -//// public f3(n: number, s: string) : string { return ""; } -//// } -//// var x = new Foo(); -//// x.f1(); -//// x.f2(5); -//// x.f3(5, ""); -//// x.f1(/*incompleteCalls1*/ -//// x.f2(5,/*incompleteCalls2*/ -//// x.f3(5,/*incompleteCalls3*/ -////} - -goTo.marker('incompleteCalls1'); -verify.currentSignatureHelpIs("f1(): void"); -verify.currentSignatureParamterCountIs(0); - -goTo.marker('incompleteCalls2'); -verify.currentSignatureParamterCountIs(1); -verify.currentSignatureHelpIs("f2(n: number): number"); -goTo.marker('incompleteCalls3'); -verify.currentSignatureParamterCountIs(2); -verify.currentSignatureHelpIs("f3(n: number, s: string): string"); - -verify.currentParameterHelpArgumentNameIs("s"); -verify.currentParameterSpanIs("s: string"); - diff --git a/tests/cases/fourslash_old/signatureHelpNoArguments.ts b/tests/cases/fourslash_old/signatureHelpNoArguments.ts deleted file mode 100644 index 16a1896a74..0000000000 --- a/tests/cases/fourslash_old/signatureHelpNoArguments.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - - -////function foo(n: number): string { -////} -//// -////foo(/**/ - -goTo.marker(); -verify.currentSignatureHelpIs("foo(n: number): string"); -verify.currentParameterHelpArgumentNameIs("n"); -verify.currentParameterSpanIs("n: number"); diff --git a/tests/cases/fourslash_old/signatureHelpObjectLiteral.ts b/tests/cases/fourslash_old/signatureHelpObjectLiteral.ts deleted file mode 100644 index cbc5df697b..0000000000 --- a/tests/cases/fourslash_old/signatureHelpObjectLiteral.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -////var objectLiteral = { n: 5, s: "", f: (a: number, b: string) => "" }; -////objectLiteral.f(/*objectLiteral1*/4, /*objectLiteral2*/""); - -goTo.marker('objectLiteral1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureParamterCountIs(2); -verify.currentSignatureHelpIs('f(a: number, b: string): string'); - -verify.currentParameterHelpArgumentNameIs("a"); -verify.currentParameterSpanIs("a: number"); - -goTo.marker('objectLiteral2'); -verify.currentSignatureHelpIs('f(a: number, b: string): string'); -verify.currentParameterHelpArgumentNameIs("b"); -verify.currentParameterSpanIs("b: string"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpOnOverloadOnConst.ts b/tests/cases/fourslash_old/signatureHelpOnOverloadOnConst.ts deleted file mode 100644 index 8edd0617d7..0000000000 --- a/tests/cases/fourslash_old/signatureHelpOnOverloadOnConst.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -////function x1(x: 'hi'); -////function x1(y: 'bye'); -////function x1(z: string); -////function x1(a: any) { -////} -//// -////x1(''/*1*/); -////x1('hi'/*2*/); -////x1('bye'/*3*/); - -goTo.marker('1'); -verify.signatureHelpCountIs(3); -verify.currentParameterHelpArgumentNameIs("z"); -verify.currentParameterSpanIs("z: string"); - -goTo.marker('2'); -verify.signatureHelpCountIs(3); -verify.currentParameterHelpArgumentNameIs("x"); -verify.currentParameterSpanIs("x: 'hi'"); - -goTo.marker('3'); -verify.signatureHelpCountIs(3); -verify.currentParameterHelpArgumentNameIs("y"); -verify.currentParameterSpanIs("y: 'bye'"); diff --git a/tests/cases/fourslash_old/signatureHelpOnOverloads.ts b/tests/cases/fourslash_old/signatureHelpOnOverloads.ts deleted file mode 100644 index 9712c9dc30..0000000000 --- a/tests/cases/fourslash_old/signatureHelpOnOverloads.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -////declare function fn(x: string); -////declare function fn(x: string, y: number); -////fn(/*1*/ - -goTo.marker('1'); -verify.signatureHelpCountIs(2); -verify.currentSignatureHelpIs("fn(x: string): any"); -verify.currentParameterHelpArgumentNameIs("x"); -verify.currentParameterSpanIs("x: string"); - -edit.insert("'',"); - -verify.signatureHelpCountIs(2); -verify.currentSignatureHelpIs("fn(x: string, y: number): any"); -verify.currentParameterHelpArgumentNameIs("y"); -verify.currentParameterSpanIs("y: number"); diff --git a/tests/cases/fourslash_old/signatureHelpOnSuperWhenMembersAreNotResolved.ts b/tests/cases/fourslash_old/signatureHelpOnSuperWhenMembersAreNotResolved.ts deleted file mode 100644 index 5613ca71a7..0000000000 --- a/tests/cases/fourslash_old/signatureHelpOnSuperWhenMembersAreNotResolved.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -////class A { } -////class B extends A { constructor(public x: string) { } } -////class C extends B { -//// constructor() { -//// /*1*/ -//// } -////} - -diagnostics.setEditValidation(IncrementalEditValidation.None); -goTo.marker("1"); -edit.insert("super("); -verify.currentSignatureHelpIs("B(x: string): B"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpSimpleConstructorCall.ts b/tests/cases/fourslash_old/signatureHelpSimpleConstructorCall.ts deleted file mode 100644 index 81af0422f9..0000000000 --- a/tests/cases/fourslash_old/signatureHelpSimpleConstructorCall.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -////class ConstructorCall { -//// constructor(str: string, num: number) { -//// } -////} -////var x = new ConstructorCall(/*constructorCall1*/1,/*constructorCall2*/2); - -goTo.marker('constructorCall1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureHelpIs("ConstructorCall(str: string, num: number): ConstructorCall"); -verify.currentParameterHelpArgumentNameIs("str"); -verify.currentParameterSpanIs("str: string"); -goTo.marker('constructorCall2'); -verify.currentSignatureHelpIs("ConstructorCall(str: string, num: number): ConstructorCall"); -verify.currentParameterHelpArgumentNameIs("num"); -verify.currentParameterSpanIs("num: number"); diff --git a/tests/cases/fourslash_old/signatureHelpSimpleFunctionCall.ts b/tests/cases/fourslash_old/signatureHelpSimpleFunctionCall.ts deleted file mode 100644 index 6e5817ad90..0000000000 --- a/tests/cases/fourslash_old/signatureHelpSimpleFunctionCall.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// - -////// Simple function test -////function functionCall(str: string, num: number) { -////} -////functionCall(/*functionCall1*/); -////functionCall("", /*functionCall2*/1); - - -goTo.marker('functionCall1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureHelpIs("functionCall(str: string, num: number): void"); -verify.currentParameterHelpArgumentNameIs("str"); -verify.currentParameterSpanIs("str: string"); -goTo.marker('functionCall2'); -verify.currentSignatureHelpIs("functionCall(str: string, num: number): void"); -verify.currentParameterHelpArgumentNameIs("num"); -verify.currentParameterSpanIs("num: number"); - diff --git a/tests/cases/fourslash_old/signatureHelpSimpleSuperCall.ts b/tests/cases/fourslash_old/signatureHelpSimpleSuperCall.ts deleted file mode 100644 index ff8913a6b0..0000000000 --- a/tests/cases/fourslash_old/signatureHelpSimpleSuperCall.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -////class SuperCallBase { -//// constructor(b: boolean) { -//// } -////} -////class SuperCall extends SuperCallBase { -//// constructor() { -//// super(/*superCall*/); -//// } -////} - -// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker('superCall'); -verify.signatureHelpCountIs(1); -verify.currentSignatureHelpIs("SuperCallBase(b: boolean): SuperCallBase"); -verify.currentParameterHelpArgumentNameIs("b"); -verify.currentParameterSpanIs("b: boolean"); diff --git a/tests/cases/fourslash_old/signatureHelpSuperConstructorOverload.ts b/tests/cases/fourslash_old/signatureHelpSuperConstructorOverload.ts deleted file mode 100644 index 1be8c3202a..0000000000 --- a/tests/cases/fourslash_old/signatureHelpSuperConstructorOverload.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -////class SuperOverloadlBase { -//// constructor(); -//// constructor(test: string); -//// constructor(test?: string) { -//// } -////} -////class SuperOverLoad1 extends SuperOverloadlBase { -//// constructor() { -//// super(/*superOverload1*/); -//// } -////} -////class SuperOverLoad2 extends SuperOverloadlBase { -//// constructor() { -//// super(""/*superOverload2*/); -//// } -////} - -goTo.marker('superOverload1'); -verify.signatureHelpCountIs(2); -verify.currentSignatureHelpIs("SuperOverloadlBase(): SuperOverloadlBase"); -verify.currentSignatureParamterCountIs(0); -goTo.marker('superOverload2'); -verify.currentSignatureParamterCountIs(1); -verify.currentSignatureHelpIs("SuperOverloadlBase(test: string): SuperOverloadlBase"); -verify.currentParameterHelpArgumentNameIs("test"); -verify.currentParameterSpanIs("test: string"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/signatureHelpWhenEditingCallExpression.ts b/tests/cases/fourslash_old/signatureHelpWhenEditingCallExpression.ts deleted file mode 100644 index 61e51d0a4e..0000000000 --- a/tests/cases/fourslash_old/signatureHelpWhenEditingCallExpression.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -/////** -//// * Returns the substring at the specified location within a String object. -//// * @param start The zero-based index integer indicating the beginning of the substring. -//// * @param end Zero-based index integer indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. -//// * If end is omitted, the characters from start through the end of the original string are returned. -//// */ -////function foo(start: number, end?: number) { -//// return ""; -////} -//// -////fo/*1*/ -goTo.marker('1'); -verify.not.signatureHelpPresent(); -edit.insert("o"); -verify.not.signatureHelpPresent(); -edit.insert("("); -verify.currentParameterHelpArgumentDocCommentIs("The zero-based index integer indicating the beginning of the substring."); -edit.insert("10,"); -verify.currentParameterHelpArgumentDocCommentIs("Zero-based index integer indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\nIf end is omitted, the characters from start through the end of the original string are returned."); -edit.insert(" "); -verify.currentParameterHelpArgumentDocCommentIs("Zero-based index integer indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\nIf end is omitted, the characters from start through the end of the original string are returned."); -edit.insert(", "); -edit.backspace(3); -verify.currentParameterHelpArgumentDocCommentIs("Zero-based index integer indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\nIf end is omitted, the characters from start through the end of the original string are returned."); -edit.insert("12"); -verify.currentParameterHelpArgumentDocCommentIs("Zero-based index integer indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\nIf end is omitted, the characters from start through the end of the original string are returned."); -edit.insert(")"); -verify.not.signatureHelpPresent(); diff --git a/tests/cases/fourslash_old/staticGenericOverloads1.ts b/tests/cases/fourslash_old/staticGenericOverloads1.ts deleted file mode 100644 index 141d88eed4..0000000000 --- a/tests/cases/fourslash_old/staticGenericOverloads1.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -////class A { -//// static B(v: A): A; -//// static B(v: S): A; -//// static B(v: any): A { -//// return null; -//// } -////} - -////var a = new A(); -////A.B(/**/ - -goTo.marker(); -verify.signatureHelpCountIs(2); -edit.insert('a'); -verify.signatureHelpCountIs(2); -verify.currentSignatureHelpIs('B(v: A): A') -edit.insert('); A.B('); -verify.currentSignatureHelpIs('B(v: A): A'); -edit.insert('a'); -verify.currentSignatureHelpIs('B(v: A): A') diff --git a/tests/cases/fourslash_old/todoComments1.ts b/tests/cases/fourslash_old/todoComments1.ts deleted file mode 100644 index 900b4694c6..0000000000 --- a/tests/cases/fourslash_old/todoComments1.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// // [|TODO|] -debugger; -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments10.ts b/tests/cases/fourslash_old/todoComments10.ts deleted file mode 100644 index 26ee7a4014..0000000000 --- a/tests/cases/fourslash_old/todoComments10.ts +++ /dev/null @@ -1,6 +0,0 @@ -//// /* -//// [|todo 1|] -//// [|hack 2|] -//// */ -debugger; -verify.todoCommentsInCurrentFile(["TODO", "HACK"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments11.ts b/tests/cases/fourslash_old/todoComments11.ts deleted file mode 100644 index 976368315d..0000000000 --- a/tests/cases/fourslash_old/todoComments11.ts +++ /dev/null @@ -1,6 +0,0 @@ -//// /* -//// [|TODO(jason) 1|] -//// [|HACK 2|] -//// */ -debugger; -verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments12.ts b/tests/cases/fourslash_old/todoComments12.ts deleted file mode 100644 index d9cd3dea4d..0000000000 --- a/tests/cases/fourslash_old/todoComments12.ts +++ /dev/null @@ -1,6 +0,0 @@ -//// /* -//// [|TODO(jason) 1|] -//// [|HACK 2|] -//// */ -debugger; -verify.todoCommentsInCurrentFile(["HACK", "TODO(jason)"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments13.ts b/tests/cases/fourslash_old/todoComments13.ts deleted file mode 100644 index 93147b30e4..0000000000 --- a/tests/cases/fourslash_old/todoComments13.ts +++ /dev/null @@ -1,4 +0,0 @@ -//// TODO - -debugger; -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments14.ts b/tests/cases/fourslash_old/todoComments14.ts deleted file mode 100644 index 46f8f48fe3..0000000000 --- a/tests/cases/fourslash_old/todoComments14.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// BAR // [|TODO|] -debugger; -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments15.ts b/tests/cases/fourslash_old/todoComments15.ts deleted file mode 100644 index 22cee54d0f..0000000000 --- a/tests/cases/fourslash_old/todoComments15.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// "// HACK 1"; -debugger; -verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments16.ts b/tests/cases/fourslash_old/todoComments16.ts deleted file mode 100644 index bbdeac0c5e..0000000000 --- a/tests/cases/fourslash_old/todoComments16.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// //// [|HACK 1|] -debugger; -verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments17.ts b/tests/cases/fourslash_old/todoComments17.ts deleted file mode 100644 index 5231694160..0000000000 --- a/tests/cases/fourslash_old/todoComments17.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// /**** [|HACK 1 |]*/ a -debugger; -verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments2.ts b/tests/cases/fourslash_old/todoComments2.ts deleted file mode 100644 index b58b0fda7a..0000000000 --- a/tests/cases/fourslash_old/todoComments2.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// // not TODO -debugger; -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments3.ts b/tests/cases/fourslash_old/todoComments3.ts deleted file mode 100644 index 62eb02642e..0000000000 --- a/tests/cases/fourslash_old/todoComments3.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// // [|TODO with stuff|] -debugger; -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments4.ts b/tests/cases/fourslash_old/todoComments4.ts deleted file mode 100644 index c9ec94785f..0000000000 --- a/tests/cases/fourslash_old/todoComments4.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// // TODOnomatch -debugger; -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments5.ts b/tests/cases/fourslash_old/todoComments5.ts deleted file mode 100644 index 157ac162a8..0000000000 --- a/tests/cases/fourslash_old/todoComments5.ts +++ /dev/null @@ -1,6 +0,0 @@ -//// /* -//// [|TODO 1|] -//// [|TODO 2|] -//// */ -debugger; -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments6.ts b/tests/cases/fourslash_old/todoComments6.ts deleted file mode 100644 index 0d2692511c..0000000000 --- a/tests/cases/fourslash_old/todoComments6.ts +++ /dev/null @@ -1,6 +0,0 @@ -//// /* -//// * [|TODO 1|] -//// * [|TODO 2|] -//// */ -debugger; -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments7.ts b/tests/cases/fourslash_old/todoComments7.ts deleted file mode 100644 index ffb5bcf660..0000000000 --- a/tests/cases/fourslash_old/todoComments7.ts +++ /dev/null @@ -1,6 +0,0 @@ -//// /* -//// [|TODO 1|] -//// [|HACK 2|] -//// */ -debugger; -verify.todoCommentsInCurrentFile(["TODO", "HACK"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments8.ts b/tests/cases/fourslash_old/todoComments8.ts deleted file mode 100644 index 5d53b7b57c..0000000000 --- a/tests/cases/fourslash_old/todoComments8.ts +++ /dev/null @@ -1,6 +0,0 @@ -//// /* -//// [|HACK 1|] -//// [|TODO 2|] -//// */ -debugger; -verify.todoCommentsInCurrentFile(["TODO", "HACK"]); \ No newline at end of file diff --git a/tests/cases/fourslash_old/todoComments9.ts b/tests/cases/fourslash_old/todoComments9.ts deleted file mode 100644 index 36cba71cec..0000000000 --- a/tests/cases/fourslash_old/todoComments9.ts +++ /dev/null @@ -1,6 +0,0 @@ -//// /* -//// [|TODO HACK|] -//// [|HACK TODO|] -//// */ -debugger; -verify.todoCommentsInCurrentFile(["TODO", "HACK"]); \ No newline at end of file From acac08147bc634edd4c97014195a8a06c01df92d Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 19 Nov 2014 11:09:57 -0800 Subject: [PATCH 16/35] Address code review --- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- src/compiler/parser.ts | 6 +++--- .../reference/objectTypesWithOptionalProperties.errors.txt | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 53a20a99fd..2160c7e64e 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -124,7 +124,7 @@ module ts { Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." }, Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." }, - A_object_member_cannot_be_declared_optional: { code: 1160, category: DiagnosticCategory.Error, key: "A object member cannot be declared optional." }, + An_object_member_cannot_be_declared_optional: { code: 1160, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, 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." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 78c60f2276..8995670ac0 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -488,7 +488,7 @@ "code": 1161 }, - "A object member cannot be declared optional.": { + "An object member cannot be declared optional.": { "category": "Error", "code": 1160 }, diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9b2485a424..c20c0a6ada 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2733,7 +2733,7 @@ module ts { function parsePropertyAssignment(): Declaration { var nodePos = scanner.getStartPos(); - var isTokenIdentifier = isIdentifier(); + var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); var node: Declaration; @@ -2753,12 +2753,12 @@ module ts { // Disallow optional property assignment if (token === SyntaxKind.QuestionToken) { var questionStart = scanner.getTokenPos(); - grammarErrorAtPos(questionStart, scanner.getStartPos() - questionStart, Diagnostics.A_object_member_cannot_be_declared_optional); + grammarErrorAtPos(questionStart, scanner.getStartPos() - questionStart, Diagnostics.An_object_member_cannot_be_declared_optional); nextToken(); } // Parse to check if it is short-hand property assignment or normal property assignment - if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && isTokenIdentifier) { + if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && tokenIsIdentifier) { node = createNode(SyntaxKind.ShorthandPropertyAssignment, nodePos); node.name = propertyName; } diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt index e73e8adc93..14afcebd21 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(12,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(20,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1160: A object member cannot be declared optional. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1160: An object member cannot be declared optional. ==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (3 errors) ==== @@ -33,5 +33,5 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith var b = { x?: 1 // error -!!! error TS1160: A object member cannot be declared optional. +!!! error TS1160: An object member cannot be declared optional. } \ No newline at end of file From c2f253f4aa84f9259a2d861154df49e0fec5b353 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Nov 2014 13:19:00 -0800 Subject: [PATCH 17/35] Fix for crash in QuickInfo on module path in import statement. --- src/services/services.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 2bc429ce43..4fa28c5601 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2751,7 +2751,7 @@ module ts { while (true) { node = node.parent; if (!node) { - return node; + return undefined; } switch (node.kind) { case SyntaxKind.SourceFile: @@ -3966,6 +3966,10 @@ module ts { for (var i = 0, n = declarations.length; i < n; i++) { var container = getContainerNode(declarations[i]); + if (!container) { + return undefined; + } + if (scope && scope !== container) { // Different declarations have different containers, bail out return undefined; @@ -4530,8 +4534,8 @@ module ts { fileName: filename, textSpan: TextSpan.fromBounds(declaration.getStart(), declaration.getEnd()), // TODO(jfreeman): What should be the containerName when the container has a computed name? - containerName: container.name ? (container.name).text : "", - containerKind: container.name ? getNodeKind(container) : "" + containerName: container && container.name ? (container.name).text : "", + containerKind: container && container.name ? getNodeKind(container) : "" }); } } @@ -4685,10 +4689,12 @@ module ts { else { return SemanticMeaning.Namespace; } - break; case SyntaxKind.ImportDeclaration: return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + + case SyntaxKind.SourceFile: + return SemanticMeaning.Namespace | SemanticMeaning.Value; } Debug.fail("Unknown declaration type"); } From 57780944288f6f39e157fd71a43c454d0b050c47 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Wed, 19 Nov 2014 14:03:20 -0800 Subject: [PATCH 18/35] Added test case for quickinfo on import statement. --- tests/cases/fourslash/quickInfoForRequire.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/cases/fourslash/quickInfoForRequire.ts diff --git a/tests/cases/fourslash/quickInfoForRequire.ts b/tests/cases/fourslash/quickInfoForRequire.ts new file mode 100644 index 0000000000..394f107436 --- /dev/null +++ b/tests/cases/fourslash/quickInfoForRequire.ts @@ -0,0 +1,10 @@ +/// + +//@Filename: AA/BB.ts +////export class a{} + +//@Filename: quickInfoForRequire_input.ts +////import a = require("AA/B/*1*/B"); + +goTo.marker('1'); +verify.quickInfoIs('module a'); \ No newline at end of file From 90b7a1c40aee5381b30af0d5c4e7637d8a4d51fa Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 14:38:53 -0800 Subject: [PATCH 19/35] Move tuple checks to the grammar checker. --- src/compiler/parser.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index fcea7adcff..6a25699f0b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1639,12 +1639,7 @@ module ts { function parseTupleType(): TupleTypeNode { var node = createNode(SyntaxKind.TupleType); - var startTokenPos = scanner.getTokenPos(); - var startErrorCount = file.parseDiagnostics.length; node.elementTypes = parseBracketedList(ParsingContext.TupleElementTypes, parseType, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); - if (!node.elementTypes.length && file.parseDiagnostics.length === startErrorCount) { - grammarErrorAtPos(startTokenPos, scanner.getStartPos() - startTokenPos, Diagnostics.A_tuple_type_element_list_cannot_be_empty); - } return finishNode(node); } @@ -4422,7 +4417,14 @@ module ts { } function visitTupleType(node: TupleTypeNode) { - checkForTrailingComma(node.elementTypes); + checkForTrailingComma(node.elementTypes) || + checkForAtLeastOneType(node); + } + + function checkForAtLeastOneType(node: TupleTypeNode): boolean { + if (node.elementTypes.length === 0) { + return grammarErrorOnNode(node, Diagnostics.A_tuple_type_element_list_cannot_be_empty) + } } function visitTypeReference(node: TypeReferenceNode) { From cd75243d83a67490d9b71180e84c2dd419307ee9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 15:00:45 -0800 Subject: [PATCH 20/35] Move optional property checking to the grammar checker. --- .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 11 +- src/compiler/parser.ts | 100 +++++++++++------- ...objectTypeWithOptionalProperty1.errors.txt | 9 ++ ...jectTypesWithOptionalProperties.errors.txt | 5 +- .../objectTypeWithOptionalProperty1.ts | 3 + 6 files changed, 79 insertions(+), 51 deletions(-) create mode 100644 tests/baselines/reference/objectTypeWithOptionalProperty1.errors.txt create mode 100644 tests/cases/compiler/objectTypeWithOptionalProperty1.ts diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 213661fdd6..a87b1f8cc2 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -124,7 +124,7 @@ module ts { Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." }, Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." }, - A_object_member_cannot_be_declared_optional: { code: 1160, category: DiagnosticCategory.Error, key: "A object member cannot be declared optional." }, + An_object_member_cannot_be_declared_optional: { code: 1160, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, 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." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index cd2e209e3e..c05770bdd8 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -479,18 +479,17 @@ "category": "Error", "code": 1159 }, - "Unterminated template literal.": { + "An object member cannot be declared optional.": { "category": "Error", - "code": 1160 + "code": 1160 }, - "Unterminated regular expression literal.": { + "Unterminated template literal.": { "category": "Error", "code": 1161 }, - - "A object member cannot be declared optional.": { + "Unterminated regular expression literal.": { "category": "Error", - "code": 1160 + "code": 1162 }, "Duplicate identifier '{0}'.": { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6a25699f0b..5818929d6e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2264,7 +2264,6 @@ module ts { } if (parseOptional(SyntaxKind.OpenBracketToken)) { - var indexedAccess = createNode(SyntaxKind.IndexedAccess, expr.pos); indexedAccess.object = expr; @@ -2441,10 +2440,12 @@ module ts { (node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, undefined, sig, body); return finishNode(node); } - // Disallow optional property assignment + + var flags: NodeFlags = 0; + + // Disallowing of optional property assignments happens in the grammar checker. if (token === SyntaxKind.QuestionToken) { - var questionStart = scanner.getTokenPos(); - grammarErrorAtPos(questionStart, scanner.getStartPos() - questionStart, Diagnostics.A_object_member_cannot_be_declared_optional); + flags |= NodeFlags.QuestionMark; nextToken(); } @@ -2459,6 +2460,8 @@ module ts { parseExpected(SyntaxKind.ColonToken); (node).initializer = parseAssignmentExpression(false); } + + node.flags = flags; return finishNode(node); } @@ -3740,42 +3743,44 @@ module ts { function dispatch(node: Node) { switch (node.kind) { - case SyntaxKind.ArrowFunction: return visitArrowFunction(node); - case SyntaxKind.BinaryExpression: return visitBinaryExpression(node); - case SyntaxKind.BreakStatement: return visitBreakOrContinueStatement(node); - case SyntaxKind.CallExpression: return visitCallExpression(node); - case SyntaxKind.CallSignature: return visitCallSignature(node); - case SyntaxKind.CatchBlock: return visitCatchBlock(node); - case SyntaxKind.ClassDeclaration: return visitClassDeclaration(node); - case SyntaxKind.Constructor: return visitConstructor(node); - case SyntaxKind.ConstructorType: return visitConstructorType(node); - case SyntaxKind.ConstructSignature: return visitConstructSignature(node); - case SyntaxKind.ContinueStatement: return visitBreakOrContinueStatement(node); - case SyntaxKind.EnumDeclaration: return visitEnumDeclaration(node); - case SyntaxKind.ForInStatement: return visitForInStatement(node); - case SyntaxKind.ForStatement: return visitForStatement(node); - case SyntaxKind.FunctionDeclaration: return visitFunctionDeclaration(node); - case SyntaxKind.FunctionExpression: return visitFunctionExpression(node); - case SyntaxKind.FunctionType: return visitFunctionType(node); - case SyntaxKind.GetAccessor: return visitGetAccessor(node); - case SyntaxKind.IndexSignature: return visitIndexSignature(node); - case SyntaxKind.InterfaceDeclaration: return visitInterfaceDeclaration(node); - case SyntaxKind.LabeledStatement: return visitLabeledStatement(node); - case SyntaxKind.Method: return visitMethod(node); - case SyntaxKind.ModuleDeclaration: return visitModuleDeclaration(node); - case SyntaxKind.NewExpression: return visitNewExpression(node); - case SyntaxKind.ObjectLiteral: return visitObjectLiteral(node); - case SyntaxKind.Parameter: return visitParameter(node); - case SyntaxKind.PostfixOperator: return visitPostfixOperator(node); - case SyntaxKind.PrefixOperator: return visitPrefixOperator(node); - case SyntaxKind.SetAccessor: return visitSetAccessor(node); - case SyntaxKind.SwitchStatement: return visitSwitchStatement(node); - case SyntaxKind.TaggedTemplateExpression: return visitTaggedTemplateExpression(node); - case SyntaxKind.TupleType: return visitTupleType(node); - case SyntaxKind.TypeReference: return visitTypeReference(node); - case SyntaxKind.VariableDeclaration: return visitVariableDeclaration(node); - case SyntaxKind.VariableStatement: return visitVariableStatement(node); - case SyntaxKind.WithStatement: return visitWithStatement(node); + case SyntaxKind.ArrowFunction: return visitArrowFunction(node); + case SyntaxKind.BinaryExpression: return visitBinaryExpression(node); + case SyntaxKind.BreakStatement: return visitBreakOrContinueStatement(node); + case SyntaxKind.CallExpression: return visitCallExpression(node); + case SyntaxKind.CallSignature: return visitCallSignature(node); + case SyntaxKind.CatchBlock: return visitCatchBlock(node); + case SyntaxKind.ClassDeclaration: return visitClassDeclaration(node); + case SyntaxKind.Constructor: return visitConstructor(node); + case SyntaxKind.ConstructorType: return visitConstructorType(node); + case SyntaxKind.ConstructSignature: return visitConstructSignature(node); + case SyntaxKind.ContinueStatement: return visitBreakOrContinueStatement(node); + case SyntaxKind.EnumDeclaration: return visitEnumDeclaration(node); + case SyntaxKind.ForInStatement: return visitForInStatement(node); + case SyntaxKind.ForStatement: return visitForStatement(node); + case SyntaxKind.FunctionDeclaration: return visitFunctionDeclaration(node); + case SyntaxKind.FunctionExpression: return visitFunctionExpression(node); + case SyntaxKind.FunctionType: return visitFunctionType(node); + case SyntaxKind.GetAccessor: return visitGetAccessor(node); + case SyntaxKind.IndexSignature: return visitIndexSignature(node); + case SyntaxKind.InterfaceDeclaration: return visitInterfaceDeclaration(node); + case SyntaxKind.LabeledStatement: return visitLabeledStatement(node); + case SyntaxKind.Method: return visitMethod(node); + case SyntaxKind.ModuleDeclaration: return visitModuleDeclaration(node); + case SyntaxKind.NewExpression: return visitNewExpression(node); + case SyntaxKind.ObjectLiteral: return visitObjectLiteral(node); + case SyntaxKind.Parameter: return visitParameter(node); + case SyntaxKind.PostfixOperator: return visitPostfixOperator(node); + case SyntaxKind.PrefixOperator: return visitPrefixOperator(node); + case SyntaxKind.PropertyAssignment: return visitPropertyAssignment(node); + case SyntaxKind.SetAccessor: return visitSetAccessor(node); + case SyntaxKind.ShorthandPropertyAssignment: return visitShorthandPropertyAssignment(node); + case SyntaxKind.SwitchStatement: return visitSwitchStatement(node); + case SyntaxKind.TaggedTemplateExpression: return visitTaggedTemplateExpression(node); + case SyntaxKind.TupleType: return visitTupleType(node); + case SyntaxKind.TypeReference: return visitTypeReference(node); + case SyntaxKind.VariableDeclaration: return visitVariableDeclaration(node); + case SyntaxKind.VariableStatement: return visitVariableStatement(node); + case SyntaxKind.WithStatement: return visitWithStatement(node); } } @@ -4346,6 +4351,17 @@ module ts { } } + function visitPropertyAssignment(node: PropertyDeclaration) { + checkForInvalidQuestionMark(node, Diagnostics.An_object_member_cannot_be_declared_optional); + } + + function checkForInvalidQuestionMark(node: Declaration, message: DiagnosticMessage) { + if (node.flags & NodeFlags.QuestionMark) { + var pos = skipTrivia(sourceText, node.name.end); + return grammarErrorAtPos(pos, "?".length, message); + } + } + function visitSetAccessor(node: MethodDeclaration) { checkTypeParameterList(node.typeParameters) || checkParameterList(node.parameters) || @@ -4391,6 +4407,10 @@ module ts { } } + function visitShorthandPropertyAssignment(node: ShortHandPropertyDeclaration): void { + checkForInvalidQuestionMark(node, Diagnostics.An_object_member_cannot_be_declared_optional); + } + function visitSwitchStatement(node: SwitchStatement) { var firstDefaultClause: CaseOrDefaultClause; diff --git a/tests/baselines/reference/objectTypeWithOptionalProperty1.errors.txt b/tests/baselines/reference/objectTypeWithOptionalProperty1.errors.txt new file mode 100644 index 0000000000..7e17563873 --- /dev/null +++ b/tests/baselines/reference/objectTypeWithOptionalProperty1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/objectTypeWithOptionalProperty1.ts(2,10): error TS1160: An object member cannot be declared optional. + + +==== tests/cases/compiler/objectTypeWithOptionalProperty1.ts (1 errors) ==== + var b = { + x?: 1 // error + ~ +!!! error TS1160: An object member cannot be declared optional. + } \ No newline at end of file diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt index e73e8adc93..669fbfb595 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt @@ -1,9 +1,8 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(12,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(20,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1160: A object member cannot be declared optional. -==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (3 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (2 errors) ==== // Basic uses of optional properties var a: { @@ -32,6 +31,4 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith var b = { x?: 1 // error - -!!! error TS1160: A object member cannot be declared optional. } \ No newline at end of file diff --git a/tests/cases/compiler/objectTypeWithOptionalProperty1.ts b/tests/cases/compiler/objectTypeWithOptionalProperty1.ts new file mode 100644 index 0000000000..69f6e1f51e --- /dev/null +++ b/tests/cases/compiler/objectTypeWithOptionalProperty1.ts @@ -0,0 +1,3 @@ + var b = { + x?: 1 // error + } \ No newline at end of file From 629ea860430c58d7054a31c5cf75c05cc7d1a2cc Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Wed, 19 Nov 2014 15:05:07 -0800 Subject: [PATCH 21/35] Updated test case and added comment --- src/services/services.ts | 1 + tests/cases/fourslash/quickInfoForRequire.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/services.ts b/src/services/services.ts index 4fa28c5601..ef16b1f1cc 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -4693,6 +4693,7 @@ module ts { case SyntaxKind.ImportDeclaration: return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + // An external module can be a Value case SyntaxKind.SourceFile: return SemanticMeaning.Namespace | SemanticMeaning.Value; } diff --git a/tests/cases/fourslash/quickInfoForRequire.ts b/tests/cases/fourslash/quickInfoForRequire.ts index 394f107436..91d59cb431 100644 --- a/tests/cases/fourslash/quickInfoForRequire.ts +++ b/tests/cases/fourslash/quickInfoForRequire.ts @@ -7,4 +7,5 @@ ////import a = require("AA/B/*1*/B"); goTo.marker('1'); -verify.quickInfoIs('module a'); \ No newline at end of file +verify.quickInfoIs('module a'); +verify.referencesCountIs(0); \ No newline at end of file From b9353086a4ed3dbbd0b8f958a8a7f391b0f666bb Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 15:30:35 -0800 Subject: [PATCH 22/35] Move return checks to the grammar checker. --- src/compiler/parser.ts | 87 ++++++++++--------- ...torWithIncompleteTypeAnnotation.errors.txt | 17 +--- .../interfaceExtendingClass2.errors.txt | 5 +- ...overloadOnConstAsTypeAnnotation.errors.txt | 5 +- ...serErrorRecovery_ModuleElement1.errors.txt | 8 +- ...rserErrorRecovery_VariableList1.errors.txt | 5 +- .../reference/propertyWrappedInTry.errors.txt | 5 +- ...hStatementsWithMultipleDefaults.errors.txt | 8 +- 8 files changed, 61 insertions(+), 79 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 5818929d6e..b6455304cd 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -835,7 +835,6 @@ module ts { var lookAheadMode = LookAheadMode.NotLookingAhead; var inAmbientContext = false; - var inFunctionBody = false; function getLineStarts(): number[] { return lineStarts || (lineStarts = computeLineStarts(sourceText)); @@ -2062,7 +2061,7 @@ module ts { var body: Node; if (token === SyntaxKind.OpenBraceToken) { - body = parseBody(/* ignoreMissingOpenBrace */ false); + body = parseFunctionBlock(/* ignoreMissingOpenBrace */ false); } else if (isStatement(/* inErrorRecovery */ true) && !isStartOfExpressionStatement() && token !== SyntaxKind.FunctionKeyword) { // Check if we got a plain statement (i.e. no expression-statements, no functions expressions/declarations) @@ -2079,7 +2078,7 @@ module ts { // up preemptively closing the containing construct. // // Note: even when 'ignoreMissingOpenBrace' is passed as true, parseBody will still error. - body = parseBody(/* ignoreMissingOpenBrace */ true); + body = parseFunctionBlock(/* ignoreMissingOpenBrace */ true); } else { body = parseAssignmentExpression(noIn); @@ -2431,7 +2430,7 @@ module ts { node = createNode(SyntaxKind.PropertyAssignment, nodePos); node.name = propertyName; var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); - var body = parseBody(/* ignoreMissingOpenBrace */ false); + var body = parseFunctionBlock(/* ignoreMissingOpenBrace */ false); // do not propagate property name as name for function expression // for scenarios like // var x = 1; @@ -2492,7 +2491,7 @@ module ts { parseExpected(SyntaxKind.FunctionKeyword); var name = isIdentifier() ? parseIdentifier() : undefined; var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); - var body = parseBody(/* ignoreMissingOpenBrace */ false); + var body = parseFunctionBlock(/* ignoreMissingOpenBrace */ false); return makeFunctionExpression(SyntaxKind.FunctionExpression, pos, name, sig, body); } @@ -2530,13 +2529,9 @@ module ts { return finishNode(node); } - function parseBody(ignoreMissingOpenBrace: boolean): Block { - var saveInFunctionBody = inFunctionBody; - - inFunctionBody = true; + function parseFunctionBlock(ignoreMissingOpenBrace: boolean): Block { var block = parseBlock(ignoreMissingOpenBrace, /*checkForStrictMode*/ true); block.kind = SyntaxKind.FunctionBlock; - inFunctionBody = saveInFunctionBody; return block; } @@ -2660,18 +2655,15 @@ module ts { function parseReturnStatement(): ReturnStatement { var node = createNode(SyntaxKind.ReturnStatement); - var errorCountBeforeReturnStatement = file.parseDiagnostics.length; var returnTokenStart = scanner.getTokenPos(); var returnTokenLength = scanner.getTextPos() - returnTokenStart; parseExpected(SyntaxKind.ReturnKeyword); - if (!canParseSemicolon()) node.expression = parseExpression(); - parseSemicolon(); - - // In an ambient context, we will already give an error for having a statement. - if (!inFunctionBody && !inAmbientContext && errorCountBeforeReturnStatement === file.parseDiagnostics.length) { - grammarErrorAtPos(returnTokenStart, returnTokenLength, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + if (!canParseSemicolon()) { + node.expression = parseExpression(); } + + parseSemicolon(); return finishNode(node); } @@ -2914,7 +2906,7 @@ module ts { function parseFunctionBlockOrSemicolon(): Block { if (token === SyntaxKind.OpenBraceToken) { - return parseBody(/* ignoreMissingOpenBrace */ false); + return parseFunctionBlock(/* ignoreMissingOpenBrace */ false); } if (canParseSemicolon()) { @@ -3045,7 +3037,7 @@ module ts { node.body = createMissingNode(); } else { - node.body = parseBody(/* ignoreMissingOpenBrace */ false); + node.body = parseFunctionBlock(/* ignoreMissingOpenBrace */ false); } return finishNode(node); @@ -3293,7 +3285,6 @@ module ts { if (parseOptional(SyntaxKind.ImplementsKeyword)) { node.implementedTypes = parseDelimitedList(ParsingContext.BaseTypeReferences, parseTypeReference); } - var errorCountBeforeClassBody = file.parseDiagnostics.length; if (parseExpected(SyntaxKind.OpenBraceToken)) { node.members = parseList(ParsingContext.ClassMembers, /*checkForStrictMode*/ false, parseClassMemberDeclaration); parseExpected(SyntaxKind.CloseBraceToken); @@ -3700,6 +3691,7 @@ module ts { // We're automatically in an ambient context if this is a .d.ts file. var inAmbientContext = fileExtensionIs(file.filename, ".d.ts"); + var inFunctionBlock = false; var parent: Node; visitNode(file); @@ -3709,6 +3701,11 @@ module ts { node.parent = parent; parent = node; + var savedInFunctionBlock = inFunctionBlock; + if (node.kind === SyntaxKind.FunctionBlock) { + inFunctionBlock = true; + } + var savedInAmbientContext = inAmbientContext if (node.flags & NodeFlags.Ambient) { inAmbientContext = true; @@ -3717,6 +3714,7 @@ module ts { checkNode(node); inAmbientContext = savedInAmbientContext; + inFunctionBlock = savedInFunctionBlock; parent = savedParent; } @@ -3724,7 +3722,7 @@ module ts { // First, check if you have a statement in a place where it is not allowed. We want // to do this before recursing, because we'd prefer to report these errors at the top // level instead of at some nested level. - if (checkForStatementInAmbientContext(node)) { + if (inAmbientContext && checkForStatementInAmbientContext(node)) { return; } @@ -3772,6 +3770,7 @@ module ts { case SyntaxKind.PostfixOperator: return visitPostfixOperator(node); case SyntaxKind.PrefixOperator: return visitPrefixOperator(node); case SyntaxKind.PropertyAssignment: return visitPropertyAssignment(node); + case SyntaxKind.ReturnStatement: return visitReturnStatement(node); case SyntaxKind.SetAccessor: return visitSetAccessor(node); case SyntaxKind.ShorthandPropertyAssignment: return visitShorthandPropertyAssignment(node); case SyntaxKind.SwitchStatement: return visitSwitchStatement(node); @@ -3814,27 +3813,25 @@ module ts { } function checkForStatementInAmbientContext(node: Node): boolean { - if (inAmbientContext) { - switch (node.kind) { - case SyntaxKind.Block: - case SyntaxKind.EmptyStatement: - case SyntaxKind.IfStatement: - case SyntaxKind.DoStatement: - case SyntaxKind.WhileStatement: - case SyntaxKind.ForStatement: - case SyntaxKind.ForInStatement: - case SyntaxKind.ContinueStatement: - case SyntaxKind.BreakStatement: - case SyntaxKind.ReturnStatement: - case SyntaxKind.WithStatement: - case SyntaxKind.SwitchStatement: - case SyntaxKind.ThrowStatement: - case SyntaxKind.TryStatement: - case SyntaxKind.DebuggerStatement: - case SyntaxKind.LabeledStatement: - case SyntaxKind.ExpressionStatement: - return grammarErrorOnFirstToken(node, Diagnostics.Statements_are_not_allowed_in_ambient_contexts); - } + switch (node.kind) { + case SyntaxKind.Block: + case SyntaxKind.EmptyStatement: + case SyntaxKind.IfStatement: + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.ContinueStatement: + case SyntaxKind.BreakStatement: + case SyntaxKind.ReturnStatement: + case SyntaxKind.WithStatement: + case SyntaxKind.SwitchStatement: + case SyntaxKind.ThrowStatement: + case SyntaxKind.TryStatement: + case SyntaxKind.DebuggerStatement: + case SyntaxKind.LabeledStatement: + case SyntaxKind.ExpressionStatement: + return grammarErrorOnFirstToken(node, Diagnostics.Statements_are_not_allowed_in_ambient_contexts); } } @@ -4362,6 +4359,12 @@ module ts { } } + function visitReturnStatement(node: ReturnStatement) { + if (!inFunctionBlock) { + grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + } + } + function visitSetAccessor(node: MethodDeclaration) { checkTypeParameterList(node.typeParameters) || checkParameterList(node.parameters) || diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index c18dfb8e35..53d24b3d0f 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -7,14 +7,11 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,30): error TS tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,33): error TS1138: Parameter declaration expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,34): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,36): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(30,21): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(31,18): error TS1129: Statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(38,17): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,41): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,45): error TS1002: Unterminated string literal. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(43,21): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(46,13): error TS1005: 'try' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(55,13): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(58,5): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(69,13): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(72,37): error TS1127: Invalid character. @@ -35,10 +32,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(234,14): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,9): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,27): error TS1005: ',' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(236,13): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,26): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(239,13): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(241,5): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,69): error TS1110: Type expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS1128: Declaration or statement expected. @@ -93,7 +88,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,29): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2304: Cannot find name 'string'. -==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (93 errors) ==== +==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (88 errors) ==== declare module "fs" { export class File { constructor(filename: string); @@ -153,8 +148,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T !!! error TS2391: Function implementation is missing or not immediately following the declaration. return 1; - ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. ^ ~ !!! error TS1129: Statement expected. @@ -188,8 +181,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T !!! error TS2304: Cannot find name 'retValue'. return 1; - ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. } } catch (e) { @@ -208,8 +199,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T !!! error TS2304: Cannot find name 'console'. return 0; - ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. } } @@ -453,8 +442,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T ~~~~~~ !!! error TS2304: Cannot find name 'number'. return val; - ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. } public method2() { ~~~~~~ @@ -464,8 +451,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T ~~~~~~~ !!! error TS2304: Cannot find name 'method2'. return 2 * this.method1(2); - ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. } } ~ diff --git a/tests/baselines/reference/interfaceExtendingClass2.errors.txt b/tests/baselines/reference/interfaceExtendingClass2.errors.txt index 83cd97c72c..1e07199686 100644 --- a/tests/baselines/reference/interfaceExtendingClass2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClass2.errors.txt @@ -1,11 +1,10 @@ -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(13,13): error TS1108: A 'return' statement can only be used within a function body. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(13,13): error TS1131: Property or signature expected. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(14,9): error TS1128: Declaration or statement expected. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(15,5): error TS1128: Declaration or statement expected. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(11,5): error TS2411: Property 'a' of type '{ toString: () => {}; }' is not assignable to string index type 'Object'. -==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts (5 errors) ==== +==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts (4 errors) ==== class Foo { x: string; y() { } @@ -23,8 +22,6 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending !!! error TS2411: Property 'a' of type '{ toString: () => {}; }' is not assignable to string index type 'Object'. return 1; ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. - ~~~~~~ !!! error TS1131: Property or signature expected. }; ~ diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt index 0d4cd775c5..70530d409b 100644 --- a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt @@ -1,13 +1,10 @@ tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(1,37): error TS1005: ';' expected. -tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(1,42): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(1,8): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (3 errors) ==== +==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (2 errors) ==== var f: (x: 'hi') => number = ('hi') => { return 1; }; ~~ !!! error TS1005: ';' expected. - ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. ~~~~~~~~~~~~~~~~~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ModuleElement1.errors.txt b/tests/baselines/reference/parserErrorRecovery_ModuleElement1.errors.txt index ad23c21ec1..4b8be3e17a 100644 --- a/tests/baselines/reference/parserErrorRecovery_ModuleElement1.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ModuleElement1.errors.txt @@ -1,19 +1,13 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(1,1): error TS1108: A 'return' statement can only be used within a function body. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(2,1): error TS1128: Declaration or statement expected. -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(3,1): error TS1108: A 'return' statement can only be used within a function body. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(4,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts (4 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts (2 errors) ==== return foo; - ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. } ~ !!! error TS1128: Declaration or statement expected. return bar; - ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. } ~ !!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_VariableList1.errors.txt b/tests/baselines/reference/parserErrorRecovery_VariableList1.errors.txt index a42ffcdd47..b69cab688f 100644 --- a/tests/baselines/reference/parserErrorRecovery_VariableList1.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_VariableList1.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserErrorRecovery_VariableList1.ts(1,6): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserErrorRecovery_VariableList1.ts(2,1): error TS1108: A 'return' statement can only be used within a function body. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserErrorRecovery_VariableList1.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserErrorRecovery_VariableList1.ts (2 errors) ==== var a, + ~ +!!! error TS1009: Trailing comma not allowed. return; ~~~~~~ !!! error TS1108: A 'return' statement can only be used within a function body. \ No newline at end of file diff --git a/tests/baselines/reference/propertyWrappedInTry.errors.txt b/tests/baselines/reference/propertyWrappedInTry.errors.txt index 36608ca7d8..0809067b33 100644 --- a/tests/baselines/reference/propertyWrappedInTry.errors.txt +++ b/tests/baselines/reference/propertyWrappedInTry.errors.txt @@ -2,14 +2,13 @@ tests/cases/compiler/propertyWrappedInTry.ts(3,5): error TS1068: Unexpected toke tests/cases/compiler/propertyWrappedInTry.ts(5,9): error TS1129: Statement expected. tests/cases/compiler/propertyWrappedInTry.ts(11,5): error TS1128: Declaration or statement expected. tests/cases/compiler/propertyWrappedInTry.ts(11,18): error TS1005: ';' expected. -tests/cases/compiler/propertyWrappedInTry.ts(13,9): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/propertyWrappedInTry.ts(17,1): error TS1128: Declaration or statement expected. tests/cases/compiler/propertyWrappedInTry.ts(5,16): error TS2304: Cannot find name 'bar'. tests/cases/compiler/propertyWrappedInTry.ts(5,22): error TS2304: Cannot find name 'someInitThatMightFail'. tests/cases/compiler/propertyWrappedInTry.ts(11,12): error TS2304: Cannot find name 'baz'. -==== tests/cases/compiler/propertyWrappedInTry.ts (9 errors) ==== +==== tests/cases/compiler/propertyWrappedInTry.ts (8 errors) ==== class Foo { try { @@ -37,8 +36,6 @@ tests/cases/compiler/propertyWrappedInTry.ts(11,12): error TS2304: Cannot find n !!! error TS2304: Cannot find name 'baz'. return this.bar; // doesn't get rewritten to Foo.bar. - ~~~~~~ -!!! error TS1108: A 'return' statement can only be used within a function body. } diff --git a/tests/baselines/reference/switchStatementsWithMultipleDefaults.errors.txt b/tests/baselines/reference/switchStatementsWithMultipleDefaults.errors.txt index cd892f5faa..9c46389e90 100644 --- a/tests/baselines/reference/switchStatementsWithMultipleDefaults.errors.txt +++ b/tests/baselines/reference/switchStatementsWithMultipleDefaults.errors.txt @@ -1,7 +1,9 @@ +tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(9,5): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement. +tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(10,5): error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement. tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(28,22): error TS1108: A 'return' statement can only be used within a function body. -==== tests/cases/compiler/switchStatementsWithMultipleDefaults.ts (1 errors) ==== +==== tests/cases/compiler/switchStatementsWithMultipleDefaults.ts (3 errors) ==== var x = 10; @@ -11,7 +13,11 @@ tests/cases/compiler/switchStatementsWithMultipleDefaults.ts(28,22): error TS110 default: // No issues. break; default: // Error; second 'default' clause. + ~~~~~~~~ +!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement. default: // Error; third 'default' clause. + ~~~~~~~~ +!!! error TS1113: A 'default' clause cannot appear more than once in a 'switch' statement. case 3: x *= x; } From 385fdd5eb2d03b7bc13c32771eb848516081684e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 16:10:27 -0800 Subject: [PATCH 23/35] Move export assignment checks to the grammar checker. --- src/compiler/parser.ts | 20 +++++++++++-------- ...ntWithDeclareAndExportModifiers.errors.txt | 9 +++------ ...rtAssignmentWithDeclareModifier.errors.txt | 7 ++----- ...ortAssignmentWithExportModifier.errors.txt | 7 ++----- ...AssignmentWithDeclareAndExportModifiers.ts | 3 ++- .../exportAssignmentWithDeclareModifier.ts | 3 ++- .../exportAssignmentWithExportModifier.ts | 3 ++- 7 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b6455304cd..871e5d60ea 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3421,8 +3421,11 @@ module ts { return finishNode(node); } - function parseExportAssignmentTail(pos: number): ExportAssignment { + function parseExportAssignmentTail(pos: number, flags: NodeFlags): ExportAssignment { var node = createNode(SyntaxKind.ExportAssignment, pos); + if (flags) { + node.flags = flags; + } node.exportName = parseIdentifier(); parseSemicolon(); return finishNode(node); @@ -3460,19 +3463,13 @@ module ts { function parseDeclaration(modifierContext: ModifierContext): Statement { var pos = getNodePos(); - var errorCountBeforeModifiers = file.parseDiagnostics.length; var flags = parseAndCheckModifiers(modifierContext); if (token === SyntaxKind.ExportKeyword) { var modifiersEnd = scanner.getStartPos(); nextToken(); if (parseOptional(SyntaxKind.EqualsToken)) { - var exportAssignmentTail = parseExportAssignmentTail(pos); - if (flags !== 0 && errorCountBeforeModifiers === file.parseDiagnostics.length) { - var modifiersStart = skipTrivia(sourceText, pos); - grammarErrorAtPos(modifiersStart, modifiersEnd - modifiersStart, Diagnostics.An_export_assignment_cannot_have_modifiers); - } - return exportAssignmentTail; + return parseExportAssignmentTail(pos, flags); } } @@ -3753,6 +3750,7 @@ module ts { case SyntaxKind.ConstructSignature: return visitConstructSignature(node); case SyntaxKind.ContinueStatement: return visitBreakOrContinueStatement(node); case SyntaxKind.EnumDeclaration: return visitEnumDeclaration(node); + case SyntaxKind.ExportAssignment: return visitExportAssignment(node); case SyntaxKind.ForInStatement: return visitForInStatement(node); case SyntaxKind.ForStatement: return visitForStatement(node); case SyntaxKind.FunctionDeclaration: return visitFunctionDeclaration(node); @@ -4069,6 +4067,12 @@ module ts { return false; } + function visitExportAssignment(node: ExportAssignment) { + if (node.flags & NodeFlags.Modifier) { + grammarErrorOnFirstToken(node, Diagnostics.An_export_assignment_cannot_have_modifiers); + } + } + function visitForInStatement(node: ForInStatement) { checkVariableDeclarations(node.declarations) || checkForMoreThanOneDeclaration(node.declarations); diff --git a/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.errors.txt b/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.errors.txt index 20355aec05..f8dc011459 100644 --- a/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.errors.txt +++ b/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.errors.txt @@ -1,11 +1,8 @@ tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts(2,1): error TS1120: An export assignment cannot have modifiers. -tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. -==== tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts (2 errors) ==== +==== tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts (1 errors) ==== var x; export declare export = x; - ~~~~~~~~~~~~~~ -!!! error TS1120: An export assignment cannot have modifiers. - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file + ~~~~~~ +!!! error TS1120: An export assignment cannot have modifiers. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentWithDeclareModifier.errors.txt b/tests/baselines/reference/exportAssignmentWithDeclareModifier.errors.txt index 1d2f2e265d..2f9d8d801a 100644 --- a/tests/baselines/reference/exportAssignmentWithDeclareModifier.errors.txt +++ b/tests/baselines/reference/exportAssignmentWithDeclareModifier.errors.txt @@ -1,11 +1,8 @@ tests/cases/compiler/exportAssignmentWithDeclareModifier.ts(2,1): error TS1120: An export assignment cannot have modifiers. -tests/cases/compiler/exportAssignmentWithDeclareModifier.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. -==== tests/cases/compiler/exportAssignmentWithDeclareModifier.ts (2 errors) ==== +==== tests/cases/compiler/exportAssignmentWithDeclareModifier.ts (1 errors) ==== var x; declare export = x; ~~~~~~~ -!!! error TS1120: An export assignment cannot have modifiers. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file +!!! error TS1120: An export assignment cannot have modifiers. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentWithExportModifier.errors.txt b/tests/baselines/reference/exportAssignmentWithExportModifier.errors.txt index e19ce5bc85..275f4b0ba1 100644 --- a/tests/baselines/reference/exportAssignmentWithExportModifier.errors.txt +++ b/tests/baselines/reference/exportAssignmentWithExportModifier.errors.txt @@ -1,11 +1,8 @@ tests/cases/compiler/exportAssignmentWithExportModifier.ts(2,1): error TS1120: An export assignment cannot have modifiers. -tests/cases/compiler/exportAssignmentWithExportModifier.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. -==== tests/cases/compiler/exportAssignmentWithExportModifier.ts (2 errors) ==== +==== tests/cases/compiler/exportAssignmentWithExportModifier.ts (1 errors) ==== var x; export export = x; ~~~~~~ -!!! error TS1120: An export assignment cannot have modifiers. - ~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file +!!! error TS1120: An export assignment cannot have modifiers. \ No newline at end of file diff --git a/tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts b/tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts index 02e40fd364..c329544098 100644 --- a/tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts +++ b/tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts @@ -1,2 +1,3 @@ -var x; +// @module: commonjs +var x; export declare export = x; \ No newline at end of file diff --git a/tests/cases/compiler/exportAssignmentWithDeclareModifier.ts b/tests/cases/compiler/exportAssignmentWithDeclareModifier.ts index e38f7fa8d3..0cd0625e12 100644 --- a/tests/cases/compiler/exportAssignmentWithDeclareModifier.ts +++ b/tests/cases/compiler/exportAssignmentWithDeclareModifier.ts @@ -1,2 +1,3 @@ -var x; +// @module: commonjs +var x; declare export = x; \ No newline at end of file diff --git a/tests/cases/compiler/exportAssignmentWithExportModifier.ts b/tests/cases/compiler/exportAssignmentWithExportModifier.ts index c6b543caee..9d940eb278 100644 --- a/tests/cases/compiler/exportAssignmentWithExportModifier.ts +++ b/tests/cases/compiler/exportAssignmentWithExportModifier.ts @@ -1,2 +1,3 @@ -var x; +// @module: commonjs +var x; export export = x; \ No newline at end of file From 75977add21be4bdd4d59d64c1795aa25997f6dbe Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 16:32:27 -0800 Subject: [PATCH 24/35] Move octal checks to the grammar checker. --- src/compiler/parser.ts | 25 +++++---- src/compiler/types.ts | 1 + .../reference/objectLiteralErrors.errors.txt | 53 ++++++++++++++++++- .../scannerNumericLiteral3.errors.txt | 5 +- .../scannerNumericLiteral9.errors.txt | 5 +- 5 files changed, 71 insertions(+), 18 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 871e5d60ea..96a1534e77 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1403,16 +1403,11 @@ module ts { // never get a token like this. Instead, we would get 00 and 9 as two separate tokens. // We also do not need to check for negatives because any prefix operator would be part of a // parent unary expression. - if (node.kind === SyntaxKind.NumericLiteral - && sourceText.charCodeAt(tokenPos) === CharacterCodes._0 - && isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === SyntaxKind.NumericLiteral && + sourceText.charCodeAt(tokenPos) === CharacterCodes._0 && + isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - if (isInStrictMode) { - grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); - } - else if (languageVersion >= ScriptTarget.ES5) { - grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); - } + node.flags |= NodeFlags.OctalLiteral; } return node; @@ -3764,6 +3759,7 @@ module ts { case SyntaxKind.ModuleDeclaration: return visitModuleDeclaration(node); case SyntaxKind.NewExpression: return visitNewExpression(node); case SyntaxKind.ObjectLiteral: return visitObjectLiteral(node); + case SyntaxKind.NumericLiteral: return visitNumericLiteral(node); case SyntaxKind.Parameter: return visitParameter(node); case SyntaxKind.PostfixOperator: return visitPostfixOperator(node); case SyntaxKind.PrefixOperator: return visitPrefixOperator(node); @@ -4262,6 +4258,17 @@ module ts { }); } + function visitNumericLiteral(node: LiteralExpression): void { + if (node.flags & NodeFlags.OctalLiteral) { + if (node.flags & NodeFlags.ParsedInStrictMode) { + grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); + } + else if (languageVersion >= ScriptTarget.ES5) { + grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + } + } + } + function visitParameter(node: ParameterDeclaration): void { checkParameterName(node); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 7865a4f246..81e2375780 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -273,6 +273,7 @@ module ts { // Set if this node was parsed in strict mode. Used for grammar error checks, as well as // checking if the node can be reused in incremental settings. ParsedInStrictMode = 0x00002000, + OctalLiteral = 0x00004000, Modifier = Export | Ambient | Public | Private | Protected | Static, AccessibilityModifier = Public | Private | Protected, diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index 8a1774c452..d27823a30a 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -1,5 +1,22 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,22): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,22): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,25): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,22): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,24): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,25): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,12): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,18): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,12): error TS2300: Duplicate identifier 'a'. @@ -79,7 +96,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,12) tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51): error TS2380: 'get' and 'set' accessor must have the same type. -==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (79 errors) ==== +==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (96 errors) ==== // Multiple properties with the same name var e1 = { a: 0, a: 0 }; @@ -177,71 +194,99 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51) // Accessor and property with the same name var f1 = { a: 0, get a() { return 0; } }; + ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var f2 = { a: '', get a() { return ''; } }; + ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var f3 = { a: 0, get a() { return ''; } }; + ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var f4 = { a: true, get a() { return false; } }; + ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var f5 = { a: {}, get a() { return {}; } }; + ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var f6 = { a: 0, get 'a'() { return 0; } }; + ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~~~ !!! error TS2300: Duplicate identifier ''a''. var f7 = { 'a': 0, get a() { return 0; } }; + ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier ''a''. ~ !!! error TS2300: Duplicate identifier 'a'. var f8 = { 'a': 0, get "a"() { return 0; } }; + ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier ''a''. ~~~ !!! error TS2300: Duplicate identifier '"a"'. var f9 = { 'a': 0, get 'a'() { return 0; } }; + ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier ''a''. ~~~ !!! error TS2300: Duplicate identifier ''a''. var f10 = { "a": 0, get 'a'() { return 0; } }; + ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier '"a"'. ~~~ !!! error TS2300: Duplicate identifier ''a''. var f11 = { 1.0: 0, get '1'() { return 0; } }; + ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier '1.0'. ~~~ !!! error TS2300: Duplicate identifier ''1''. var f12 = { 0: 0, get 0() { return 0; } }; + ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier '0'. ~ !!! error TS2300: Duplicate identifier '0'. var f13 = { 0: 0, get 0() { return 0; } }; + ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier '0'. ~ !!! error TS2300: Duplicate identifier '0'. var f14 = { 0: 0, get 0x0() { return 0; } }; + ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier '0'. ~~~ @@ -254,16 +299,22 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51) ~~~ !!! error TS2300: Duplicate identifier '000'. var f15 = { "100": 0, get 1e2() { return 0; } }; + ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~~~ !!! error TS2300: Duplicate identifier '"100"'. ~~~ !!! error TS2300: Duplicate identifier '1e2'. var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; + ~~~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~~ !!! error TS2300: Duplicate identifier '0x20'. ~~~~~ !!! error TS2300: Duplicate identifier '3.2e1'. var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; + ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ diff --git a/tests/baselines/reference/scannerNumericLiteral3.errors.txt b/tests/baselines/reference/scannerNumericLiteral3.errors.txt index 4bfbbd3b42..894eb391f6 100644 --- a/tests/baselines/reference/scannerNumericLiteral3.errors.txt +++ b/tests/baselines/reference/scannerNumericLiteral3.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral3.ts(1,1): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral3.ts(1,3): error TS1005: ';' expected. -==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral3.ts (2 errors) ==== +==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral3.ts (1 errors) ==== 01.0 - ~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. ~~ !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/scannerNumericLiteral9.errors.txt b/tests/baselines/reference/scannerNumericLiteral9.errors.txt index 3bcf3a34d8..7f53ca111d 100644 --- a/tests/baselines/reference/scannerNumericLiteral9.errors.txt +++ b/tests/baselines/reference/scannerNumericLiteral9.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral9.ts(1,1): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral9.ts(1,3): error TS1005: ';' expected. -==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral9.ts (2 errors) ==== +==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral9.ts (1 errors) ==== 009 - ~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. ~ !!! error TS1005: ';' expected. \ No newline at end of file From b2112f863affbe556d587208bea45df13701b969 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 16:47:43 -0800 Subject: [PATCH 25/35] Move module name checks to the grammar checker. Make some errors shorter. --- src/compiler/parser.ts | 42 ++++--- ...DeclarationInModuleDeclaration1.errors.txt | 2 +- .../reference/importInsideModule.errors.txt | 2 +- .../parserExportAssignment5.errors.txt | 2 +- .../amd/intReferencingExtAndInt.errors.txt | 2 +- .../node/intReferencingExtAndInt.errors.txt | 2 +- .../nestedLocalModuleSimpleCase.errors.txt | 2 +- .../nestedLocalModuleSimpleCase.errors.txt | 2 +- ...calModuleWithRecursiveTypecheck.errors.txt | 2 +- ...calModuleWithRecursiveTypecheck.errors.txt | 2 +- ...dModuleDeclarationsInsideModule.errors.txt | 7 +- ...dModuleDeclarationsInsideModule.errors.txt | 7 +- ...arationsInsideNonExportedModule.errors.txt | 7 +- ...arationsInsideNonExportedModule.errors.txt | 7 +- ...leImportStatementInParentModule.errors.txt | 7 +- ...leImportStatementInParentModule.errors.txt | 7 +- ...ateStringsTypeArgumentInference.errors.txt | 112 +++++++++--------- ...tringsWithIncompatibleTypedTags.errors.txt | 36 +++--- ...ithManyCallAndMemberExpressions.errors.txt | 4 +- ...eStringsWithOverloadResolution1.errors.txt | 24 ++-- ...eStringsWithOverloadResolution2.errors.txt | 8 +- ...eStringsWithOverloadResolution3.errors.txt | 88 +++++++------- ...mplateStringsWithTagsTypedAsAny.errors.txt | 40 +++---- ...gedTemplateStringsWithTypedTags.errors.txt | 32 ++--- ...tringsArrayTypeDefinedInES5Mode.errors.txt | 4 +- ...ringsArrayTypeNotDefinedES5Mode.errors.txt | 4 +- 26 files changed, 221 insertions(+), 233 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 96a1534e77..696b3986c5 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3375,14 +3375,6 @@ module ts { var node = createNode(SyntaxKind.ModuleDeclaration, pos); node.flags = flags; node.name = parseStringLiteral(); - if (!inAmbientContext) { - var errorCount = file.parseDiagnostics.length; - // Only report this error if we have not already errored about a missing declare modifier, - // which would have been at or after pos - if (!errorCount || file.parseDiagnostics[errorCount - 1].start < getTokenPos(pos)) { - grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names); - } - } // For error recovery, just in case the user forgot the declare modifier on this ambient // external module, treat it as ambient anyway. @@ -4080,7 +4072,7 @@ module ts { function checkForMoreThanOneDeclaration(declarations: NodeArray) { if (declarations && declarations.length > 1) { - return grammarErrorOnNode(declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); + return grammarErrorOnFirstToken(declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); } } @@ -4174,16 +4166,30 @@ module ts { } function visitModuleDeclaration(node: ModuleDeclaration): void { + checkModuleDeclarationName(node) || + checkModuleDeclarationStatements(node); + } + + function checkModuleDeclarationName(node: ModuleDeclaration) { + if (!inAmbientContext && node.name.kind === SyntaxKind.StringLiteral) { + return grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names); + } + } + + function checkModuleDeclarationStatements(node: ModuleDeclaration): boolean { if (node.name.kind === SyntaxKind.Identifier && node.body.kind === SyntaxKind.ModuleBlock) { - forEach((node.body).statements, s => { - if (s.kind === SyntaxKind.ExportAssignment) { + var statements = (node.body).statements; + for (var i = 0, n = statements.length; i < n; i++) { + var statement = statements[i]; + + if (statement.kind === SyntaxKind.ExportAssignment) { // Export assignments are not allowed in an internal module - grammarErrorOnNode(s, Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + return grammarErrorOnFirstToken(statement, Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } - else if (s.kind === SyntaxKind.ImportDeclaration && (s).externalModuleName) { - grammarErrorOnNode(s, Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + else if (statement.kind === SyntaxKind.ImportDeclaration && (statement).externalModuleName) { + return grammarErrorOnFirstToken(statement, Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); } - }); + } } } @@ -4446,7 +4452,7 @@ module ts { function visitTaggedTemplateExpression(node: TaggedTemplateExpression) { if (languageVersion < ScriptTarget.ES6) { - grammarErrorOnNode(node, Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); + grammarErrorOnFirstToken(node.template, Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); } } @@ -4493,10 +4499,10 @@ module ts { var decl = declarations[0]; if (languageVersion < ScriptTarget.ES6) { if (decl.flags & NodeFlags.Let) { - return grammarErrorOnNode(decl, Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + return grammarErrorOnFirstToken(decl, Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); } else if (decl.flags & NodeFlags.Const) { - return grammarErrorOnNode(decl, Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + return grammarErrorOnFirstToken(decl, Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); } } } diff --git a/tests/baselines/reference/importDeclarationInModuleDeclaration1.errors.txt b/tests/baselines/reference/importDeclarationInModuleDeclaration1.errors.txt index 82132947ee..ba6aae1e36 100644 --- a/tests/baselines/reference/importDeclarationInModuleDeclaration1.errors.txt +++ b/tests/baselines/reference/importDeclarationInModuleDeclaration1.errors.txt @@ -4,6 +4,6 @@ tests/cases/compiler/importDeclarationInModuleDeclaration1.ts(2,5): error TS1147 ==== tests/cases/compiler/importDeclarationInModuleDeclaration1.ts (1 errors) ==== module m2 { import m3 = require("use_glo_M1_public"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. } \ No newline at end of file diff --git a/tests/baselines/reference/importInsideModule.errors.txt b/tests/baselines/reference/importInsideModule.errors.txt index dc89bb5e9c..4a7ab9d5b7 100644 --- a/tests/baselines/reference/importInsideModule.errors.txt +++ b/tests/baselines/reference/importInsideModule.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/importInsideModule_file2.ts(2,26): error TS2307: Cannot fin ==== tests/cases/compiler/importInsideModule_file2.ts (2 errors) ==== export module myModule { import foo = require("importInsideModule_file1"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find external module 'importInsideModule_file1'. diff --git a/tests/baselines/reference/parserExportAssignment5.errors.txt b/tests/baselines/reference/parserExportAssignment5.errors.txt index b463034f62..16c4188bc0 100644 --- a/tests/baselines/reference/parserExportAssignment5.errors.txt +++ b/tests/baselines/reference/parserExportAssignment5.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignm ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts (2 errors) ==== module M { export = A; - ~~~~~~~~~~~ + ~~~~~~ !!! error TS1063: An export assignment cannot be used in an internal module. ~~~~~~~~~~~ !!! error TS2304: Cannot find name 'A'. diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt index 29925d2255..59cbb44a3c 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt +++ b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt @@ -4,7 +4,7 @@ internal2.ts(2,2): error TS1147: Import declarations in an internal module canno ==== internal2.ts (1 errors) ==== module outer { import g = require("external2") - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. export var a = g.square(5); export var b = "foo"; diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt index 29925d2255..59cbb44a3c 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt +++ b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt @@ -4,7 +4,7 @@ internal2.ts(2,2): error TS1147: Import declarations in an internal module canno ==== internal2.ts (1 errors) ==== module outer { import g = require("external2") - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. export var a = g.square(5); export var b = "foo"; diff --git a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.errors.txt b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.errors.txt index b2bc48b454..43f02e4fb9 100644 --- a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.errors.txt @@ -4,7 +4,7 @@ test1.ts(2,2): error TS1147: Import declarations in an internal module cannot re ==== test1.ts (1 errors) ==== export module myModule { import foo = require("test2"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. //console.log(foo.$); } diff --git a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.errors.txt b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.errors.txt index b2bc48b454..43f02e4fb9 100644 --- a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.errors.txt @@ -4,7 +4,7 @@ test1.ts(2,2): error TS1147: Import declarations in an internal module cannot re ==== test1.ts (1 errors) ==== export module myModule { import foo = require("test2"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. //console.log(foo.$); } diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt index d40bca7397..35c81a722d 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt @@ -5,7 +5,7 @@ test1.ts(3,2): error TS1147: Import declarations in an internal module cannot re module myModule { import foo = require("test2"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. //console.log(foo.$); diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt index d40bca7397..35c81a722d 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt @@ -5,7 +5,7 @@ test1.ts(3,2): error TS1147: Import declarations in an internal module cannot re module myModule { import foo = require("test2"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. //console.log(foo.$); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt index b92bb48308..09f7aed73f 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt @@ -1,11 +1,10 @@ testGlo.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module. -testGlo.ts(21,5): error TS1147: Import declarations in an internal module cannot reference an external module. -==== testGlo.ts (2 errors) ==== +==== testGlo.ts (1 errors) ==== module m2 { export import mExported = require("mExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. export var c1 = new mExported.me.class1; export function f1() { @@ -26,8 +25,6 @@ testGlo.ts(21,5): error TS1147: Import declarations in an internal module cannot } import mNonExported = require("mNonExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1147: Import declarations in an internal module cannot reference an external module. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt index b92bb48308..09f7aed73f 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt @@ -1,11 +1,10 @@ testGlo.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module. -testGlo.ts(21,5): error TS1147: Import declarations in an internal module cannot reference an external module. -==== testGlo.ts (2 errors) ==== +==== testGlo.ts (1 errors) ==== module m2 { export import mExported = require("mExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. export var c1 = new mExported.me.class1; export function f1() { @@ -26,8 +25,6 @@ testGlo.ts(21,5): error TS1147: Import declarations in an internal module cannot } import mNonExported = require("mNonExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1147: Import declarations in an internal module cannot reference an external module. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt index bbf4831914..ad44386dcd 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt @@ -1,14 +1,13 @@ test.ts(5,5): error TS1147: Import declarations in an internal module cannot reference an external module. -test.ts(24,5): error TS1147: Import declarations in an internal module cannot reference an external module. -==== test.ts (2 errors) ==== +==== test.ts (1 errors) ==== export module m1 { } module m2 { export import mExported = require("mExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. export var c1 = new mExported.me.class1; export function f1() { @@ -29,8 +28,6 @@ test.ts(24,5): error TS1147: Import declarations in an internal module cannot re } import mNonExported = require("mNonExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1147: Import declarations in an internal module cannot reference an external module. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt index bbf4831914..ad44386dcd 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt @@ -1,14 +1,13 @@ test.ts(5,5): error TS1147: Import declarations in an internal module cannot reference an external module. -test.ts(24,5): error TS1147: Import declarations in an internal module cannot reference an external module. -==== test.ts (2 errors) ==== +==== test.ts (1 errors) ==== export module m1 { } module m2 { export import mExported = require("mExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. export var c1 = new mExported.me.class1; export function f1() { @@ -29,8 +28,6 @@ test.ts(24,5): error TS1147: Import declarations in an internal module cannot re } import mNonExported = require("mNonExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1147: Import declarations in an internal module cannot reference an external module. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt index ff9a9f604a..0d281b950f 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt @@ -1,11 +1,10 @@ test.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module. -test.ts(42,5): error TS1147: Import declarations in an internal module cannot reference an external module. -==== test.ts (2 errors) ==== +==== test.ts (1 errors) ==== export module m2 { export import mExported = require("mExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. module Internal_M1 { @@ -47,8 +46,6 @@ test.ts(42,5): error TS1147: Import declarations in an internal module cannot re } import mNonExported = require("mNonExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1147: Import declarations in an internal module cannot reference an external module. module Internal_M3 { export var c3 = new mNonExported.mne.class1; export function f3() { diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt index ff9a9f604a..0d281b950f 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt @@ -1,11 +1,10 @@ test.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module. -test.ts(42,5): error TS1147: Import declarations in an internal module cannot reference an external module. -==== test.ts (2 errors) ==== +==== test.ts (1 errors) ==== export module m2 { export import mExported = require("mExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. module Internal_M1 { @@ -47,8 +46,6 @@ test.ts(42,5): error TS1147: Import declarations in an internal module cannot re } import mNonExported = require("mNonExported"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1147: Import declarations in an internal module cannot reference an external module. module Internal_M3 { export var c3 = new mNonExported.mne.class1; export function f3() { diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt index c4a34fccd9..ac184e9489 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt @@ -1,31 +1,31 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(5,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(9,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(13,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(16,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(20,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(23,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(27,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(28,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(29,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(33,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(34,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(35,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(39,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(40,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(41,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(45,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(46,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(47,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(51,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(52,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(53,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(57,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(58,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,11): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(81,11): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(86,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(90,11): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(5,10): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(9,17): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(13,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(16,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(20,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(23,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(27,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(28,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(29,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(33,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(34,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(35,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(39,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(40,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(41,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(45,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(46,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(47,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(51,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(52,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(53,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(57,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(58,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(81,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(86,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(90,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. @@ -38,104 +38,104 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference // Generic tag with one parameter function noParams(n: T) { } noParams ``; - ~~~~~~~~~~~ + ~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with parameter which does not use type parameter function noGenericParams(n: string[]) { } noGenericParams ``; - ~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple type parameters and only one used in parameter type annotation function someGenerics1a(n: T, m: number) { } someGenerics1a `${3}`; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. function someGenerics1b(n: string[], m: U) { } someGenerics1b `${3}`; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with argument of function type whose parameter is of type parameter type function someGenerics2a(strs: string[], n: (x: T) => void) { } someGenerics2a `${(n: string) => n}`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. function someGenerics2b(strs: string[], n: (x: T, y: U) => void) { } someGenerics2b `${ (n: string, x: number) => n }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(strs: string[], producer: () => T) { } someGenerics3 `${() => ''}`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics3 `${() => undefined}`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics3 `${() => 3}`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(strs: string[], n: T, f: (x: U) => void) { } someGenerics4 `${4}${ () => null }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics4 `${''}${ () => 3 }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics4 `${ null }${ null }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(strs: string[], n: T, f: (x: U) => void) { } someGenerics5 `${ 4 } ${ () => null }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics5 `${ '' }${ () => 3 }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics5 `${null}${null}`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { } someGenerics6 `${ n => n }${ n => n}${ n => n}`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics6 `${ n => n }${ n => n}${ n => n}`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple arguments of function types that each have parameters of different generic type function someGenerics7(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { } someGenerics7 `${ n => n }${ n => n }${ n => n }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics7 `${ n => n }${ n => n }${ n => n }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with argument of generic function type function someGenerics8(strs: string[], n: T): T { return n; } var x = someGenerics8 `${ someGenerics7 }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. x `${null}${null}${null}`; - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple parameters of generic type passed arguments with no best common type @@ -143,7 +143,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference return null; } var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. @@ -161,7 +161,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference } var a9e = someGenerics9 `${ undefined }${ { x: 6, z: new Date() } }${ { x: 6, y: '' } }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. @@ -170,20 +170,20 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference // Generic tag with multiple parameters of generic type passed arguments with a single best common type var a9d = someGenerics9 `${ { x: 3 }}${ { x: 6 }}${ { x: 6 } }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a9d: { x: number; }; // Generic tag with multiple parameters of generic type where one argument is of type 'any' var anyVar: any; var a = someGenerics9 `${ 7 }${ anyVar }${ 4 }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a: any; // Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any' var arr = someGenerics9 `${ [] }${ null }${ undefined }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var arr: any[]; diff --git a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt index 7dedca9eb3..6676a6d8a8 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(12,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(14,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(16,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(18,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(20,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(22,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(28,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(12,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(14,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(16,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(18,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(20,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(22,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(28,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(14,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(18,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(22,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. @@ -28,49 +28,49 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTyped var f: I; f `abc` - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc`.member - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`.member; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc`["member"]; - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`["member"]; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc`[0].member `abc${1}def${2}ghi`; - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc${ true }def${ true }ghi`["member"].member `abc${ 1 }def${ 2 }ghi`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. diff --git a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt index f6300855a1..17c0b330db 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts(13,21): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts(13,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts (1 errors) ==== @@ -15,7 +15,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMember var f: I; var x = new new new f `abc${ 0 }def`.member("hello")(42) === true; - ~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index d49ec4b716..bb5b56578d 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(16,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(17,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(18,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(20,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(16,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(17,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(18,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(20,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(14,9): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. @@ -31,24 +31,24 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio !!! error TS2346: Supplied parameters do not match any signature of call target. var u = foo ``; // number - ~~~~~~ + ~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var v = foo `${1}`; // string - ~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var w = foo `${1}${2}`; // boolean - ~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var x = foo `${1}${true}`; // boolean (with error) - ~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. var y = foo `${1}${"2"}`; // {} - ~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var z = foo `${1}${2}${3}`; // any (with error) - ~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt index fcde15afc2..3bf4af3977 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts(8,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts(17,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts(8,14): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts(17,14): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts (2 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio } var a = foo1 `${1}`; // string - ~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var b = foo1([], 1); // number @@ -22,6 +22,6 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio } var c = foo2 `${1}`; // number - ~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var d = foo2([], 1); // number \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt index dd943e518f..3ffe3d5820 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt @@ -1,25 +1,25 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(7,17): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(16,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(17,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(23,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(26,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(34,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(35,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(36,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(40,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(41,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(42,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(54,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(55,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(56,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(57,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(60,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(64,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(70,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(71,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(7,21): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(16,20): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(17,20): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(23,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(26,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(34,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(35,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(36,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(40,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(41,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(42,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(54,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(55,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(56,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(57,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(60,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(64,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(70,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(71,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(19,4): error TS2339: Property 'foo' does not exist on type 'Date'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,1): error TS2346: Supplied parameters do not match any signature of call target. @@ -36,12 +36,12 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn1() { return null; } var s: string = fn1 `${ undefined }`; - ~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // No candidate overloads found fn1 `${ {} }`; // Error - ~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~ !!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. @@ -51,10 +51,10 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn2() { return undefined; } var d1: Date = fn2 `${ 0 }${ undefined }`; // contextually typed - ~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var d2 = fn2 `${ 0 }${ undefined }`; // any - ~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. d1.foo(); // error @@ -64,12 +64,12 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // Generic and non-generic overload where generic overload is the only candidate fn2 `${ 0 }${ '' }`; // OK - ~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic and non-generic overload where non-generic overload is the only candidate fn2 `${ '' }${ 0 }`; // OK - ~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with differing arity @@ -79,30 +79,30 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn3() { return null; } var s = fn3 `${ 3 }`; - ~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var s = fn3 `${'' }${ 3 }${ '' }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var n = fn3 `${ 5 }${ 5 }${ 5 }`; - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var n: number; // Generic overloads with differing arity tagging with arguments matching each overload type parameter count var s = fn3 `${ 4 }` - ~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var s = fn3 `${ '' }${ '' }${ '' }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var n = fn3 `${ '' }${ '' }${ 3 }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with differing arity tagging with argument count that doesn't match any overload fn3 ``; // Error - ~~~~~~ + ~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. @@ -115,31 +115,31 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // Generic overloads with constraints tagged with types that satisfy the constraints fn4 `${ '' }${ 3 }`; - ~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. fn4 `${ 3 }${ '' }`; - ~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. fn4 `${ 3 }${ undefined }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. fn4 `${ '' }${ null }`; - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with constraints called with type arguments that do not satisfy the constraints fn4 `${ null }${ null }`; // Error - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 `${ true }${ null }`; - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. fn4 `${ null }${ true }`; - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. @@ -149,12 +149,12 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn5(strs: TemplateStringsArray, f: (n: number) => void): number; function fn5() { return undefined; } fn5 `${ (n) => n.toFixed() }`; // will error; 'n' should have type 'string'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~ !!! error TS2339: Property 'toFixed' does not exist on type 'string'. fn5 `${ (n) => n.substr(0) }`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt index 8a334a5611..a50339adf1 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt @@ -1,56 +1,56 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(3,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(5,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(7,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(9,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(11,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(13,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(15,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(17,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(3,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(5,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(7,7): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(9,7): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(11,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(13,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(15,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(17,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts (10 errors) ==== var f: any; f `abc` - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f.g.h `abc` - ~~~~~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f.g.h `abc${1}def${2}ghi`; - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc`.member - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`.member; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc`["member"]; - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`["member"]; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc`["member"].someOtherTag `abc${1}def${2}ghi`; - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`["member"].someOtherTag `abc${1}def${2}ghi`; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f.thisIsNotATag(`abc`); diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt index 41f3492317..02de690a22 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(12,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(14,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(16,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(18,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(20,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(22,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(12,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(14,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(16,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(18,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(20,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(22,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts (8 errors) ==== @@ -21,35 +21,35 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,1 var f: I; f `abc` - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc`.member - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`.member; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc`["member"]; - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`["member"]; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc`[0].member `abc${1}def${2}ghi`; - ~~~~~~~ + ~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f.thisIsNotATag(`abc`); diff --git a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt index a5e05d986c..572ddfbd68 100644 --- a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(10,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(10,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. lib.d.ts(502,11): error TS2300: Duplicate identifier 'TemplateStringsArray'. tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(2,7): error TS2300: Duplicate identifier 'TemplateStringsArray'. tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. @@ -21,5 +21,5 @@ tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2 !!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'. f `abcdef${ 1234 }${ 5678 }ghijkl`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt index 6b2d29139e..56793bf95a 100644 --- a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(7,1): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(7,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type '{ [x: number]: undefined; }'. @@ -14,5 +14,5 @@ tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS !!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'. f `abcdef${ 1234 }${ 5678 }ghijkl`; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file From 1a0f32213f885a55439348d4e89df5961b21f2a8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 16:55:18 -0800 Subject: [PATCH 26/35] Move type parameter error handling code to the grammar checker. --- src/compiler/parser.ts | 27 ++++++------------- src/compiler/types.ts | 3 +++ .../typeParameterConstraints1.errors.txt | 2 +- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 696b3986c5..34b49c5b07 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -855,23 +855,6 @@ module ts { errorAtPos(start, length, message, arg0, arg1, arg2); } - // This is just like createDiagnosticForNode except that it uses the current file - // being parsed instead of the file containing the node. This is because during - // parse, the nodes do not have parent pointers to get to the file. - // - // It is very intentional that we are not checking or changing the lookAheadMode value - // here. 'grammarErrorOnNode' is called when we are doing extra grammar checks and not - // when we are doing the actual parsing to determine what the user wrote. In other - // words, this function is called once we have already parsed the node, and are just - // applying some stricter checks on that node. - function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { - var span = getErrorSpanForNode(node); - var start = span.end > span.pos ? skipTrivia(file.text, span.pos) : span.pos; - var length = span.end - start; - - file.parseDiagnostics.push(createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); - } - function grammarErrorAtPos(start: number, length: number, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { file.parseDiagnostics.push(createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); } @@ -1458,8 +1441,7 @@ module ts { // // // We do *not* want to consume the > as we're consuming the expression for "". - var expr = parseUnaryExpression(); - grammarErrorOnNode(expr, Diagnostics.Type_expected); + node.expression = parseUnaryExpression(); } } @@ -3762,6 +3744,7 @@ module ts { case SyntaxKind.SwitchStatement: return visitSwitchStatement(node); case SyntaxKind.TaggedTemplateExpression: return visitTaggedTemplateExpression(node); case SyntaxKind.TupleType: return visitTupleType(node); + case SyntaxKind.TypeParameter: return visitTypeParameter(node); case SyntaxKind.TypeReference: return visitTypeReference(node); case SyntaxKind.VariableDeclaration: return visitVariableDeclaration(node); case SyntaxKind.VariableStatement: return visitVariableStatement(node); @@ -4467,6 +4450,12 @@ module ts { } } + function visitTypeParameter(node: TypeParameterDeclaration) { + if (node.expression) { + grammarErrorOnFirstToken(node.expression, Diagnostics.Type_expected); + } + } + function visitTypeReference(node: TypeReferenceNode) { checkForAtLeastOneTypeArgument(node.typeArguments); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 81e2375780..97db90ea04 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -326,6 +326,9 @@ module ts { export interface TypeParameterDeclaration extends Declaration { name: Identifier; constraint?: TypeNode; + + // For error recovery purposes. + expression?: Expression; } export interface SignatureDeclaration extends Declaration, ParsedSignature { } diff --git a/tests/baselines/reference/typeParameterConstraints1.errors.txt b/tests/baselines/reference/typeParameterConstraints1.errors.txt index e081f3c6ce..d2e1f505c8 100644 --- a/tests/baselines/reference/typeParameterConstraints1.errors.txt +++ b/tests/baselines/reference/typeParameterConstraints1.errors.txt @@ -23,7 +23,7 @@ tests/cases/compiler/typeParameterConstraints1.ts(12,26): error TS2304: Cannot f ~ !!! error TS1110: Type expected. function foo10 (test: T) { } - ~~~ + ~ !!! error TS1110: Type expected. function foo11 (test: T) { } ~~~~ From cfb74249c895bed48215f7c81bec0ea93fbfe12d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 17:15:25 -0800 Subject: [PATCH 27/35] Don't report a grammar error for a real parse error. --- src/compiler/parser.ts | 24 ++++++++++++------- ...umConflictsWithGlobalIdentifier.errors.txt | 4 ++-- .../reference/enumMemberResolution.errors.txt | 4 ++-- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 34b49c5b07..7c6942960a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1010,7 +1010,10 @@ module ts { function createNode(kind: SyntaxKind, pos?: number): Node { nodeCount++; var node = new (nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)))(); - if (!(pos >= 0)) pos = scanner.getStartPos(); + if (!(pos >= 0)) { + pos = scanner.getStartPos(); + } + node.pos = pos; node.end = pos; return node; @@ -2225,16 +2228,21 @@ module ts { // the code would be implicitly: "name.keyword; identifierNameOrKeyword". // In the first case though, ASI will not take effect because there is not a // line terminator after the keyword. - if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(() => scanner.isReservedWord())) { - grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, Diagnostics.Identifier_expected); - var id = createMissingNode(); - } - else { - var id = parseIdentifierName(); + var id: Identifier; + if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord()) { + var matchesPattern = lookAhead(() => { + nextToken(); + return !scanner.hasPrecedingLineBreak() && (scanner.isIdentifier() || scanner.isReservedWord); + }); + + if (matchesPattern) { + errorAtPos(dotOrBracketStart + 1, 0, Diagnostics.Identifier_expected); + id = createMissingNode(); + } } propertyAccess.left = expr; - propertyAccess.right = id; + propertyAccess.right = id || parseIdentifierName(); expr = finishNode(propertyAccess); continue; } diff --git a/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt b/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt index 235b665cdc..e6859558f7 100644 --- a/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt +++ b/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,28): error TS1003: Identifier expected. +tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,29): error TS1003: Identifier expected. tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'. @@ -7,7 +7,7 @@ tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Ca IgnoreRulesSpecific = 0, } var x = IgnoreRulesSpecific. - ~ + !!! error TS1003: Identifier expected. ~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'IgnoreRulesSpecific'. diff --git a/tests/baselines/reference/enumMemberResolution.errors.txt b/tests/baselines/reference/enumMemberResolution.errors.txt index 5c84c08d98..f446c0d790 100644 --- a/tests/baselines/reference/enumMemberResolution.errors.txt +++ b/tests/baselines/reference/enumMemberResolution.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/enumMemberResolution.ts(4,28): error TS1003: Identifier expected. +tests/cases/compiler/enumMemberResolution.ts(4,29): error TS1003: Identifier expected. tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'. @@ -7,7 +7,7 @@ tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find nam IgnoreRulesSpecific = 0 } var x = IgnoreRulesSpecific. // error - ~ + !!! error TS1003: Identifier expected. ~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'IgnoreRulesSpecific'. From 4a76206e0c8cbcdfab9518601f841e6cb9822bf0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 17:19:03 -0800 Subject: [PATCH 28/35] Move away from a grammar error when a real parse error occurs. --- src/compiler/parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7c6942960a..e1e2cd28a0 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2255,7 +2255,7 @@ module ts { // Check for that common pattern and report a better error message. if (inNewExpression && parseOptional(SyntaxKind.CloseBracketToken)) { indexedAccess.index = createMissingNode(); - grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + errorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { indexedAccess.index = parseExpression(); From 7a414fc308ba9730c5bce0b2cb64f1b54d63dd5f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 17:43:08 -0800 Subject: [PATCH 29/35] Move parser error to the grammar checker. --- src/compiler/parser.ts | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9e13f50cd8..0b974a3520 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2317,10 +2317,11 @@ module ts { } function parseSingleTypeArgument(): TypeNode { + // Be resilient to something like: Foo<,,>(); + // We want to parse this out as a type argument list (esp. for signature help), and we + // don't want to rollback just because we were missing a type arg. The grammar checker + // will report the actual error later on. if (token === SyntaxKind.CommaToken) { - var errorStart = scanner.getTokenPos(); - var errorLength = scanner.getTextPos() - errorStart; - grammarErrorAtPos(errorStart, errorLength, Diagnostics.Type_expected); return createNode(SyntaxKind.Missing); } @@ -3920,11 +3921,27 @@ module ts { } function visitCallExpression(node: CallExpression) { - checkForTrailingComma(node.typeArguments) || - checkForAtLeastOneTypeArgument(node.typeArguments) || + checkTypeArguments(node.typeArguments) || checkForTrailingComma(node.arguments); } + function checkTypeArguments(typeArguments: NodeArray) { + return checkForTrailingComma(typeArguments) || + checkForAtLeastOneTypeArgument(typeArguments) || + checkForMissingTypeArgument(typeArguments); + } + + function checkForMissingTypeArgument(typeArguments: NodeArray) { + if (typeArguments) { + for (var i = 0, n = typeArguments.length; i < n; i++) { + var arg = typeArguments[i]; + if (arg.kind === SyntaxKind.Missing) { + return grammarErrorAtPos(arg.pos, 0, Diagnostics.Type_expected); + } + } + } + } + function checkForAtLeastOneTypeArgument(typeArguments: NodeArray) { if (typeArguments && typeArguments.length === 0) { var start = typeArguments.pos - "<".length; @@ -4185,8 +4202,7 @@ module ts { } function visitNewExpression(node: NewExpression): void { - checkForTrailingComma(node.typeArguments) || - checkForAtLeastOneTypeArgument(node.typeArguments) || + checkTypeArguments(node.typeArguments) || checkForTrailingComma(node.arguments); } @@ -4465,7 +4481,7 @@ module ts { } function visitTypeReference(node: TypeReferenceNode) { - checkForAtLeastOneTypeArgument(node.typeArguments); + checkTypeArguments(node.typeArguments); } function visitVariableDeclaration(node: VariableDeclaration) { From 76f88392a4d0b7d157747a2799c3f43d2ede498e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 17:57:35 -0800 Subject: [PATCH 30/35] Move missing argument checks to the grammar walker. --- src/compiler/parser.ts | 39 ++++++++++++------- .../reference/missingArgument1.errors.txt | 16 ++++++++ ...rserErrorRecovery_ArgumentList6.errors.txt | 5 +-- ...rserErrorRecovery_ArgumentList7.errors.txt | 5 +-- tests/cases/compiler/missingArgument1.ts | 1 + 5 files changed, 43 insertions(+), 23 deletions(-) create mode 100644 tests/baselines/reference/missingArgument1.errors.txt create mode 100644 tests/cases/compiler/missingArgument1.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 0b974a3520..2fe60edd4c 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2376,25 +2376,18 @@ module ts { return finishNode(node); } - function parseAssignmentExpressionOrOmittedExpression(omittedExpressionDiagnostic: DiagnosticMessage): Expression { - if (token === SyntaxKind.CommaToken) { - if (omittedExpressionDiagnostic) { - var errorStart = scanner.getTokenPos(); - var errorLength = scanner.getTextPos() - errorStart; - grammarErrorAtPos(errorStart, errorLength, omittedExpressionDiagnostic); - } - return createNode(SyntaxKind.OmittedExpression); - } - - return parseAssignmentExpression(); + function parseAssignmentExpressionOrOmittedExpression(): Expression { + return token === SyntaxKind.CommaToken + ? createNode(SyntaxKind.OmittedExpression) + : parseAssignmentExpression(); } function parseArrayLiteralElement(): Expression { - return parseAssignmentExpressionOrOmittedExpression(/*omittedExpressionDiagnostic*/ undefined); + return parseAssignmentExpressionOrOmittedExpression(); } function parseArgumentExpression(): Expression { - return parseAssignmentExpressionOrOmittedExpression(Diagnostics.Argument_expression_expected); + return parseAssignmentExpressionOrOmittedExpression(); } function parseArrayLiteral(): ArrayLiteral { @@ -3922,7 +3915,12 @@ module ts { function visitCallExpression(node: CallExpression) { checkTypeArguments(node.typeArguments) || - checkForTrailingComma(node.arguments); + checkArguments(node.arguments); + } + + function checkArguments(arguments: NodeArray) { + return checkForTrailingComma(arguments) || + checkForOmittedArgument(arguments); } function checkTypeArguments(typeArguments: NodeArray) { @@ -3931,6 +3929,17 @@ module ts { checkForMissingTypeArgument(typeArguments); } + function checkForOmittedArgument(arguments: NodeArray) { + if (arguments) { + for (var i = 0, n = arguments.length; i < n; i++) { + var arg = arguments[i]; + if (arg.kind === SyntaxKind.OmittedExpression) { + return grammarErrorAtPos(arg.pos, 0, Diagnostics.Argument_expression_expected); + } + } + } + } + function checkForMissingTypeArgument(typeArguments: NodeArray) { if (typeArguments) { for (var i = 0, n = typeArguments.length; i < n; i++) { @@ -4203,7 +4212,7 @@ module ts { function visitNewExpression(node: NewExpression): void { checkTypeArguments(node.typeArguments) || - checkForTrailingComma(node.arguments); + checkArguments(node.arguments); } function visitObjectLiteral(node: ObjectLiteral): void { diff --git a/tests/baselines/reference/missingArgument1.errors.txt b/tests/baselines/reference/missingArgument1.errors.txt new file mode 100644 index 0000000000..02911e3c9b --- /dev/null +++ b/tests/baselines/reference/missingArgument1.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/missingArgument1.ts(1,7): error TS1135: Argument expression expected. +tests/cases/compiler/missingArgument1.ts(1,1): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/missingArgument1.ts(1,5): error TS2304: Cannot find name 'a'. +tests/cases/compiler/missingArgument1.ts(1,8): error TS2304: Cannot find name 'b'. + + +==== tests/cases/compiler/missingArgument1.ts (4 errors) ==== + foo(a,,b); + +!!! error TS1135: Argument expression expected. + ~~~ +!!! error TS2304: Cannot find name 'foo'. + ~ +!!! error TS2304: Cannot find name 'a'. + ~ +!!! error TS2304: Cannot find name 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList6.errors.txt b/tests/baselines/reference/parserErrorRecovery_ArgumentList6.errors.txt index 799c67593e..cf6f7b1093 100644 --- a/tests/baselines/reference/parserErrorRecovery_ArgumentList6.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList6.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList6.ts(1,5): error TS1135: Argument expression expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList6.ts(1,6): error TS1005: ')' expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList6.ts(1,1): error TS2304: Cannot find name 'Foo'. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList6.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList6.ts (2 errors) ==== Foo(, - ~ -!!! error TS1135: Argument expression expected. !!! error TS1005: ')' expected. ~~~ diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList7.errors.txt b/tests/baselines/reference/parserErrorRecovery_ArgumentList7.errors.txt index 95f4febf44..67602cb11a 100644 --- a/tests/baselines/reference/parserErrorRecovery_ArgumentList7.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList7.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList7.ts(1,7): error TS1135: Argument expression expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList7.ts(1,8): error TS1005: ')' expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList7.ts(1,1): error TS2304: Cannot find name 'Foo'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList7.ts(1,5): error TS2304: Cannot find name 'a'. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList7.ts (4 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList7.ts (3 errors) ==== Foo(a,, - ~ -!!! error TS1135: Argument expression expected. !!! error TS1005: ')' expected. ~~~ diff --git a/tests/cases/compiler/missingArgument1.ts b/tests/cases/compiler/missingArgument1.ts new file mode 100644 index 0000000000..27408bc2cd --- /dev/null +++ b/tests/cases/compiler/missingArgument1.ts @@ -0,0 +1 @@ +foo(a,,b); \ No newline at end of file From 9751dca80962409aadc9c3b9b4a8e8158ca90bdb Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 18:06:01 -0800 Subject: [PATCH 31/35] Move property initializer checks to the grammar checker. --- src/compiler/parser.ts | 10 +++-- .../reference/ambientErrors.errors.txt | 45 +++++++++++++++---- .../initializersInDeclarations.errors.txt | 25 ++++++++--- 3 files changed, 63 insertions(+), 17 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2fe60edd4c..12712fcf80 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2994,9 +2994,6 @@ module ts { property.initializer = parseInitializer(/*inParameter*/ false); parseSemicolon(); - if (inAmbientContext && property.initializer && errorCountBeforePropertyDeclaration === file.parseDiagnostics.length) { - grammarErrorAtPos(initializerStart, initializerFirstTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); - } return finishNode(property); } } @@ -3739,6 +3736,7 @@ module ts { case SyntaxKind.Parameter: return visitParameter(node); case SyntaxKind.PostfixOperator: return visitPostfixOperator(node); case SyntaxKind.PrefixOperator: return visitPrefixOperator(node); + case SyntaxKind.Property: return visitProperty(node); case SyntaxKind.PropertyAssignment: return visitPropertyAssignment(node); case SyntaxKind.ReturnStatement: return visitReturnStatement(node); case SyntaxKind.SetAccessor: return visitSetAccessor(node); @@ -4381,6 +4379,12 @@ module ts { } } + function visitProperty(node: PropertyDeclaration) { + if (inAmbientContext && node.initializer) { + grammarErrorOnFirstToken(node.initializer, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + function visitPropertyAssignment(node: PropertyDeclaration) { checkForInvalidQuestionMark(node, Diagnostics.An_object_member_cannot_be_declared_optional); } diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt index a1e85be740..6fe7a25dfe 100644 --- a/tests/baselines/reference/ambientErrors.errors.txt +++ b/tests/baselines/reference/ambientErrors.errors.txt @@ -1,5 +1,14 @@ -tests/cases/conformance/ambient/ambientErrors.ts(37,18): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/conformance/ambient/ambientErrors.ts(38,11): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(24,5): error TS1066: Ambient enum elements can only have integer literal initializers. +tests/cases/conformance/ambient/ambientErrors.ts(29,5): error TS1066: Ambient enum elements can only have integer literal initializers. +tests/cases/conformance/ambient/ambientErrors.ts(34,11): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(35,19): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(37,20): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(38,13): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1111: A constructor implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/conformance/ambient/ambientErrors.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules. @@ -7,9 +16,11 @@ tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient e tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== tests/cases/conformance/ambient/ambientErrors.ts (7 errors) ==== +==== tests/cases/conformance/ambient/ambientErrors.ts (16 errors) ==== // Ambient variable with an initializer declare var x = 4; + ~ +!!! error TS1039: Initializers are not allowed in ambient contexts. // Ambient functions with invalid overloads declare function fn(x: number): string; @@ -32,31 +43,47 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export // Ambient function with function body declare function fn4() { }; + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. // Ambient enum with non - integer literal constant member declare enum E1 { y = 4.23 + ~ +!!! error TS1066: Ambient enum elements can only have integer literal initializers. } // Ambient enum with computer member declare enum E2 { x = 'foo'.length + ~ +!!! error TS1066: Ambient enum elements can only have integer literal initializers. } // Ambient module with initializers for values, bodies for functions / classes declare module M1 { var x = 3; - function fn() { } - class C { - static x = 3; - ~ -!!! error TS1039: Initializers are not allowed in ambient contexts. - y = 4; ~ +!!! error TS1039: Initializers are not allowed in ambient contexts. + function fn() { } + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. + class C { + static x = 3; + ~ +!!! error TS1039: Initializers are not allowed in ambient contexts. + y = 4; + ~ !!! error TS1039: Initializers are not allowed in ambient contexts. constructor() { } + ~ +!!! error TS1111: A constructor implementation cannot be declared in an ambient context. fn() { } + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. static sfn() { } + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. } } diff --git a/tests/baselines/reference/initializersInDeclarations.errors.txt b/tests/baselines/reference/initializersInDeclarations.errors.txt index 9e02a1cd74..99798d749c 100644 --- a/tests/baselines/reference/initializersInDeclarations.errors.txt +++ b/tests/baselines/reference/initializersInDeclarations.errors.txt @@ -1,28 +1,43 @@ -tests/cases/conformance/externalModules/initializersInDeclarations.ts(5,7): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/conformance/externalModules/initializersInDeclarations.ts(6,14): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(5,9): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(6,16): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(8,3): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(12,15): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(13,15): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(16,2): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(18,16): error TS1039: Initializers are not allowed in ambient contexts. -==== tests/cases/conformance/externalModules/initializersInDeclarations.ts (2 errors) ==== +==== tests/cases/conformance/externalModules/initializersInDeclarations.ts (7 errors) ==== // Errors: Initializers & statements in declaration file declare class Foo { name = "test"; - ~ + ~~~~~~ !!! error TS1039: Initializers are not allowed in ambient contexts. "some prop" = 42; - ~ + ~~ !!! error TS1039: Initializers are not allowed in ambient contexts. fn(): boolean { return false; + ~~~~~~ +!!! error TS1036: Statements are not allowed in ambient contexts. } } declare var x = []; + ~ +!!! error TS1039: Initializers are not allowed in ambient contexts. declare var y = {}; + ~ +!!! error TS1039: Initializers are not allowed in ambient contexts. declare module M1 { while(true); + ~~~~~ +!!! error TS1036: Statements are not allowed in ambient contexts. export var v1 = () => false; + ~ +!!! error TS1039: Initializers are not allowed in ambient contexts. } \ No newline at end of file From bffd1d2ae25329c2927ffd237552d33476dd5cad Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 18:36:05 -0800 Subject: [PATCH 32/35] Move errors about "new Foo[]" to the grammar checker. --- src/compiler/parser.ts | 17 ++++++++++--- .../reference/badArraySyntax.errors.txt | 25 ++++++++----------- ...annotInvokeNewOnErrorExpression.errors.txt | 4 +-- .../reference/createArray.errors.txt | 16 ++++++------ .../baselines/reference/libMembers.errors.txt | 4 +-- .../reference/newOperator.errors.txt | 12 +++++---- ...rserObjectCreationArrayLiteral1.errors.txt | 4 +-- ...rserObjectCreationArrayLiteral3.errors.txt | 4 +-- .../reference/parserRealSource10.errors.txt | 20 +++++++-------- .../reference/parserRealSource11.errors.txt | 17 +++++++------ .../reference/parserRealSource4.errors.txt | 4 +-- .../reference/parserRealSource7.errors.txt | 4 +-- .../reference/parserRealSource9.errors.txt | 4 +-- 13 files changed, 74 insertions(+), 61 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 12712fcf80..0bd407fc95 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1028,8 +1028,8 @@ module ts { return node; } - function createMissingNode(): Node { - return createNode(SyntaxKind.Missing); + function createMissingNode(pos?: number): Node { + return createNode(SyntaxKind.Missing, pos); } function internIdentifier(text: string): string { @@ -2254,7 +2254,6 @@ module ts { // Check for that common pattern and report a better error message. if (inNewExpression && parseOptional(SyntaxKind.CloseBracketToken)) { indexedAccess.index = createMissingNode(); - errorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { indexedAccess.index = parseExpression(); @@ -3725,6 +3724,7 @@ module ts { case SyntaxKind.FunctionExpression: return visitFunctionExpression(node); case SyntaxKind.FunctionType: return visitFunctionType(node); case SyntaxKind.GetAccessor: return visitGetAccessor(node); + case SyntaxKind.IndexedAccess: return visitIndexedAccess(node); case SyntaxKind.IndexSignature: return visitIndexSignature(node); case SyntaxKind.InterfaceDeclaration: return visitInterfaceDeclaration(node); case SyntaxKind.LabeledStatement: return visitLabeledStatement(node); @@ -4123,6 +4123,17 @@ module ts { checkAccessor(node); } + function visitIndexedAccess(node: IndexedAccess): void { + if (node.index.kind === SyntaxKind.Missing && + node.parent.kind === SyntaxKind.NewExpression && + (node.parent).func === node) { + + var start = skipTrivia(sourceText, node.parent.pos); + var end = node.end; + grammarErrorAtPos(start, end - start, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + } + } + function visitIndexSignature(node: SignatureDeclaration): void { checkIndexSignatureParameters(node); } diff --git a/tests/baselines/reference/badArraySyntax.errors.txt b/tests/baselines/reference/badArraySyntax.errors.txt index 8c9bd45fba..500a89d85a 100644 --- a/tests/baselines/reference/badArraySyntax.errors.txt +++ b/tests/baselines/reference/badArraySyntax.errors.txt @@ -1,32 +1,29 @@ -tests/cases/compiler/badArraySyntax.ts(6,15): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/badArraySyntax.ts(7,15): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/badArraySyntax.ts(8,20): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/badArraySyntax.ts(9,20): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/badArraySyntax.ts(10,29): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/badArraySyntax.ts(10,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(6,10): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(7,10): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(8,15): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(9,15): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(10,17): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -==== tests/cases/compiler/badArraySyntax.ts (6 errors) ==== +==== tests/cases/compiler/badArraySyntax.ts (5 errors) ==== class Z { public x = ""; } var a1: Z[] = []; var a2 = new Z[]; - ~~ + ~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var a3 = new Z[](); - ~~ + ~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var a4: Z[] = new Z[]; - ~~ + ~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var a5: Z[] = new Z[](); - ~~ + ~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var a6: Z[][] = new Z [ ] [ ]; - ~~~~~~~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. - ~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. \ No newline at end of file diff --git a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt index cfb9287cdb..f0397f5ee6 100644 --- a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt +++ b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,21): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,9): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,15): error TS2339: Property 'ClassA' does not exist on type 'typeof M'. @@ -8,7 +8,7 @@ tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,15): error TS2339: Pr class ClassA {} } var t = new M.ClassA[]; - ~~ + ~~~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2339: Property 'ClassA' does not exist on type 'typeof M'. \ No newline at end of file diff --git a/tests/baselines/reference/createArray.errors.txt b/tests/baselines/reference/createArray.errors.txt index 6f79c4b47d..2e2b456756 100644 --- a/tests/baselines/reference/createArray.errors.txt +++ b/tests/baselines/reference/createArray.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/createArray.ts(1,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/createArray.ts(6,6): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/createArray.ts(7,19): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/createArray.ts(8,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/createArray.ts(1,8): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/createArray.ts(6,1): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/createArray.ts(7,8): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/createArray.ts(8,8): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/createArray.ts(1,12): error TS2304: Cannot find name 'number'. tests/cases/compiler/createArray.ts(7,12): error TS2304: Cannot find name 'boolean'. tests/cases/compiler/createArray.ts(8,12): error TS2304: Cannot find name 'string'. @@ -9,7 +9,7 @@ tests/cases/compiler/createArray.ts(8,12): error TS2304: Cannot find name 'strin ==== tests/cases/compiler/createArray.ts (7 errors) ==== var na=new number[]; - ~~ + ~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2304: Cannot find name 'number'. @@ -18,15 +18,15 @@ tests/cases/compiler/createArray.ts(8,12): error TS2304: Cannot find name 'strin } new C[]; - ~~ + ~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var ba=new boolean[]; - ~~ + ~~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~~ !!! error TS2304: Cannot find name 'boolean'. var sa=new string[]; - ~~ + ~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2304: Cannot find name 'string'. diff --git a/tests/baselines/reference/libMembers.errors.txt b/tests/baselines/reference/libMembers.errors.txt index a6af67821b..73f5c945f7 100644 --- a/tests/baselines/reference/libMembers.errors.txt +++ b/tests/baselines/reference/libMembers.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/libMembers.ts(9,16): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/libMembers.ts(9,11): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/libMembers.ts(4,3): error TS2339: Property 'subby' does not exist on type 'string'. tests/cases/compiler/libMembers.ts(12,15): error TS2339: Property 'prototype' does not exist on type 'C'. @@ -15,7 +15,7 @@ tests/cases/compiler/libMembers.ts(12,15): error TS2339: Property 'prototype' do export class C { } var a=new C[]; - ~~ + ~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. a.length; a.push(new C()); diff --git a/tests/baselines/reference/newOperator.errors.txt b/tests/baselines/reference/newOperator.errors.txt index 2d3fd00544..47f0a68b68 100644 --- a/tests/baselines/reference/newOperator.errors.txt +++ b/tests/baselines/reference/newOperator.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/newOperator.ts(18,20): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/newOperator.ts(22,1): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/newOperator.ts(45,23): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/newOperator.ts(18,10): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/newOperator.ts(20,1): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/newOperator.ts(45,16): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/newOperator.ts(3,13): error TS2304: Cannot find name 'ifc'. tests/cases/compiler/newOperator.ts(10,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/newOperator.ts(11,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. @@ -38,14 +38,16 @@ tests/cases/compiler/newOperator.ts(31,10): error TS2351: Cannot use 'new' with // Various spacing var t3 = new string[]( ); - ~~ + ~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2304: Cannot find name 'string'. var t4 = new + ~~~ string ~~~~~~ + ~~~~~~ !!! error TS2304: Cannot find name 'string'. [ ~ @@ -78,7 +80,7 @@ tests/cases/compiler/newOperator.ts(31,10): error TS2351: Cannot use 'new' with class S { public get xs(): M.T[] { return new M.T[]; - ~~ + ~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. } } diff --git a/tests/baselines/reference/parserObjectCreationArrayLiteral1.errors.txt b/tests/baselines/reference/parserObjectCreationArrayLiteral1.errors.txt index 04be3a6d04..f0ca8d45b7 100644 --- a/tests/baselines/reference/parserObjectCreationArrayLiteral1.errors.txt +++ b/tests/baselines/reference/parserObjectCreationArrayLiteral1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral1.ts(1,8): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral1.ts(1,1): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral1.ts(1,5): error TS2304: Cannot find name 'Foo'. ==== tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral1.ts (2 errors) ==== new Foo[]; - ~~ + ~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~ !!! error TS2304: Cannot find name 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserObjectCreationArrayLiteral3.errors.txt b/tests/baselines/reference/parserObjectCreationArrayLiteral3.errors.txt index 89f861cfcd..3187d985cc 100644 --- a/tests/baselines/reference/parserObjectCreationArrayLiteral3.errors.txt +++ b/tests/baselines/reference/parserObjectCreationArrayLiteral3.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral3.ts(1,8): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral3.ts(1,1): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral3.ts(1,5): error TS2304: Cannot find name 'Foo'. ==== tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral3.ts (2 errors) ==== new Foo[](); - ~~ + ~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~ !!! error TS2304: Cannot find name 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserRealSource10.errors.txt b/tests/baselines/reference/parserRealSource10.errors.txt index aabafd751e..4184d9ac23 100644 --- a/tests/baselines/reference/parserRealSource10.errors.txt +++ b/tests/baselines/reference/parserRealSource10.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. -tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(127,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(129,47): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(130,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(449,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(127,29): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,32): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(129,37): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(130,31): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(449,31): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,36): error TS2304: Cannot find name 'string'. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(129,41): error TS2304: Cannot find name 'number'. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(130,35): error TS2304: Cannot find name 'boolean'. @@ -472,20 +472,20 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(356,53): error } export var tokenTable = new TokenInfo[]; - ~~ + ~~~~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. export var nodeTypeTable = new string[]; - ~~ + ~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2304: Cannot find name 'string'. export var nodeTypeToTokTable = new number[]; - ~~ + ~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2304: Cannot find name 'number'. export var noRegexTable = new boolean[]; - ~~ + ~~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~~ !!! error TS2304: Cannot find name 'boolean'. @@ -1474,7 +1474,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(356,53): error // TODO: new with length TokenID.LimFixed export var staticTokens = new Token[]; - ~~ + ~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. export function initializeStaticTokens() { for (var i = 0; i <= TokenID.LimFixed; i++) { diff --git a/tests/baselines/reference/parserRealSource11.errors.txt b/tests/baselines/reference/parserRealSource11.errors.txt index 68fe64a63f..c76206b821 100644 --- a/tests/baselines/reference/parserRealSource11.errors.txt +++ b/tests/baselines/reference/parserRealSource11.errors.txt @@ -1,7 +1,8 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(193,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1009,45): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1024,47): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(193,33): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(867,29): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1009,31): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1024,33): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(13,22): error TS2304: Cannot find name 'Type'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(14,24): error TS2304: Cannot find name 'ASTFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(17,38): error TS2304: Cannot find name 'CompilerDiagnostics'. @@ -514,7 +515,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,30): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error TS2304: Cannot find name 'TokenID'. -==== tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts (514 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts (515 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -792,7 +793,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error ~~~~~~~~~~~ !!! error TS2304: Cannot find name 'SymbolScope'. public members: AST[] = new AST[]; - ~~ + ~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. constructor () { @@ -1814,6 +1815,8 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error } public getAliasName(aliasAST?: AST = this.alias) : string { + ~~~~~~~~ +!!! error TS1015: Parameter cannot have question mark and initializer. if (aliasAST.nodeType == NodeType.Name) { ~~~~~~~~ !!! error TS2304: Cannot find name 'NodeType'. @@ -2026,7 +2029,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error !!! error TS2304: Cannot find name 'Symbol'. if (this.envids == null) { this.envids = new Identifier[]; - ~~ + ~~~~~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. } this.envids[this.envids.length] = id; @@ -2045,7 +2048,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error !!! error TS2304: Cannot find name 'Symbol'. if (this.jumpRefs == null) { this.jumpRefs = new Identifier[]; - ~~ + ~~~~~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. } var id = new Identifier(sym.name); diff --git a/tests/baselines/reference/parserRealSource4.errors.txt b/tests/baselines/reference/parserRealSource4.errors.txt index e0ae0d2221..5974d62df4 100644 --- a/tests/baselines/reference/parserRealSource4.errors.txt +++ b/tests/baselines/reference/parserRealSource4.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource4.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. -tests/cases/conformance/parser/ecmascript5/parserRealSource4.ts(195,37): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource4.ts(195,24): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ==== tests/cases/conformance/parser/ecmascript5/parserRealSource4.ts (2 errors) ==== @@ -200,7 +200,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource4.ts(195,37): error T export class HashTable { public itemCount: number = 0; public table = new HashEntry[]; - ~~ + ~~~~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. constructor (public size: number, public hashFn: (key) =>number, diff --git a/tests/baselines/reference/parserRealSource7.errors.txt b/tests/baselines/reference/parserRealSource7.errors.txt index 7fddac2c46..773dd49942 100644 --- a/tests/baselines/reference/parserRealSource7.errors.txt +++ b/tests/baselines/reference/parserRealSource7.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(16,45): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(16,33): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(12,38): error TS2304: Cannot find name 'ASTList'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(12,62): error TS2304: Cannot find name 'TypeLink'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(16,37): error TS2304: Cannot find name 'TypeLink'. @@ -326,7 +326,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T var len = bases.members.length; if (baseTypeLinks == null) { baseTypeLinks = new TypeLink[]; - ~~ + ~~~~~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~~~ !!! error TS2304: Cannot find name 'TypeLink'. diff --git a/tests/baselines/reference/parserRealSource9.errors.txt b/tests/baselines/reference/parserRealSource9.errors.txt index 1880a72f18..0dc0de6c12 100644 --- a/tests/baselines/reference/parserRealSource9.errors.txt +++ b/tests/baselines/reference/parserRealSource9.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. -tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(12,39): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(12,31): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(8,38): error TS2304: Cannot find name 'TypeChecker'. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(9,48): error TS2304: Cannot find name 'TypeLink'. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(9,67): error TS2304: Cannot find name 'SymbolScope'. @@ -56,7 +56,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(200,48): error T !!! error TS2304: Cannot find name 'Type'. if (typeLinks) { extendsList = new Type[]; - ~~ + ~~~~~~~~~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~ !!! error TS2304: Cannot find name 'Type'. From 77165355112f3491d3068036a49142ceb5277c25 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 18:52:37 -0800 Subject: [PATCH 33/35] Move optional method/property checking to the grammar checker. --- src/compiler/parser.ts | 14 +++++++++++--- .../objectTypesWithOptionalProperties.errors.txt | 5 ++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 0bd407fc95..565320d3eb 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2968,7 +2968,9 @@ module ts { var questionStart = scanner.getTokenPos(); if (parseOptional(SyntaxKind.QuestionToken)) { - errorAtPos(questionStart, scanner.getStartPos() - questionStart, Diagnostics.A_class_member_cannot_be_declared_optional); + // Note: this is not legal as per the grammar. But we allow it in the parser and + // report an error in the grammar checker. + flags |= NodeFlags.QuestionMark; } if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { @@ -4179,7 +4181,8 @@ module ts { function visitMethod(node: MethodDeclaration) { checkTypeParameterList(node.typeParameters) || checkParameterList(node.parameters) || - checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false); + checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false) || + (node.parent.kind === SyntaxKind.ClassDeclaration && checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional)); } function checkForBodyInAmbientContext(body: Block | Expression, isConstructor: boolean): boolean { @@ -4391,8 +4394,13 @@ module ts { } function visitProperty(node: PropertyDeclaration) { + (node.parent.kind === SyntaxKind.ClassDeclaration && checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional)) || + checkForInitializerInAmbientContext(node); + } + + function checkForInitializerInAmbientContext(node: PropertyDeclaration) { if (inAmbientContext && node.initializer) { - grammarErrorOnFirstToken(node.initializer, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + return grammarErrorOnFirstToken(node.initializer, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); } } diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt index 669fbfb595..d33a5e35b6 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(12,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(20,6): error TS1112: A class member cannot be declared optional. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1160: An object member cannot be declared optional. -==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (2 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (3 errors) ==== // Basic uses of optional properties var a: { @@ -31,4 +32,6 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith var b = { x?: 1 // error + ~ +!!! error TS1160: An object member cannot be declared optional. } \ No newline at end of file From 6b866e719e0c1291b87ac7dcdac4cdf1bc8cdb3f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 19:04:21 -0800 Subject: [PATCH 34/35] Move indexer modifier checks to the grammar checker. --- src/compiler/parser.ts | 26 ++++++++++++------- .../parserIndexMemberDeclaration10.errors.txt | 5 +--- .../reference/staticIndexers.errors.txt | 5 +++- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 565320d3eb..724f4ea581 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1541,8 +1541,12 @@ module ts { return finishNode(node); } - function parseIndexSignatureMember(): SignatureDeclaration { - var node = createNode(SyntaxKind.IndexSignature); + function parseIndexSignatureMember(flags: NodeFlags, pos?: number): SignatureDeclaration { + var node = createNode(SyntaxKind.IndexSignature, pos); + if (flags) { + node.flags = flags; + } + node.parameters = parseParameterList(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); node.type = parseTypeAnnotation(); parseSemicolon(); @@ -1588,7 +1592,7 @@ module ts { case SyntaxKind.LessThanToken: return parseSignatureMember(SyntaxKind.CallSignature, SyntaxKind.ColonToken); case SyntaxKind.OpenBracketToken: - return parseIndexSignatureMember(); + return parseIndexSignatureMember(/*flags:*/ 0); case SyntaxKind.NewKeyword: if (lookAhead(() => nextToken() === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken)) { return parseSignatureMember(SyntaxKind.ConstructSignature, SyntaxKind.ColonToken); @@ -3238,12 +3242,7 @@ module ts { return parsePropertyMemberDeclaration(pos, flags); } if (token === SyntaxKind.OpenBracketToken) { - if (flags) { - var start = getTokenPos(pos); - var length = getNodePos() - start; - errorAtPos(start, length, Diagnostics.Modifiers_not_permitted_on_index_signature_members); - } - return parseIndexSignatureMember(); + return parseIndexSignatureMember(flags, pos); } // 'isClassMemberStart' should have hinted not to attempt parsing. @@ -4137,7 +4136,14 @@ module ts { } function visitIndexSignature(node: SignatureDeclaration): void { - checkIndexSignatureParameters(node); + checkIndexSignatureParameters(node) || + checkForIndexSignatureModifiers(node); + } + + function checkForIndexSignatureModifiers(node: SignatureDeclaration): boolean { + if (node.flags & NodeFlags.Modifier) { + return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_not_permitted_on_index_signature_members); + } } function checkIndexSignatureParameters(node: SignatureDeclaration): boolean { diff --git a/tests/baselines/reference/parserIndexMemberDeclaration10.errors.txt b/tests/baselines/reference/parserIndexMemberDeclaration10.errors.txt index e85a4817d8..d448aaa3f2 100644 --- a/tests/baselines/reference/parserIndexMemberDeclaration10.errors.txt +++ b/tests/baselines/reference/parserIndexMemberDeclaration10.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts(2,4): error TS1145: Modifiers not permitted on index signature members. tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts(2,11): error TS1030: 'static' modifier already seen. -==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts (1 errors) ==== class C { static static [x: string]: string; - ~~~~~~~~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. ~~~~~~ !!! error TS1030: 'static' modifier already seen. } \ No newline at end of file diff --git a/tests/baselines/reference/staticIndexers.errors.txt b/tests/baselines/reference/staticIndexers.errors.txt index 708c505841..29c46d0ce8 100644 --- a/tests/baselines/reference/staticIndexers.errors.txt +++ b/tests/baselines/reference/staticIndexers.errors.txt @@ -1,9 +1,10 @@ tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(4,5): error TS1145: Modifiers not permitted on index signature members. tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(8,5): error TS1145: Modifiers not permitted on index signature members. tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(12,5): error TS1145: Modifiers not permitted on index signature members. +tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(12,25): error TS2302: Static members cannot reference class type parameters. -==== tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts (3 errors) ==== +==== tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts (4 errors) ==== // static indexers not allowed class C { @@ -22,4 +23,6 @@ tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts(12,5): static [x: string]: T; ~~~~~~ !!! error TS1145: Modifiers not permitted on index signature members. + ~ +!!! error TS2302: Static members cannot reference class type parameters. } \ No newline at end of file From 20f418833a35c09328935f6c6b5c2316c916b23e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 19 Nov 2014 19:15:01 -0800 Subject: [PATCH 35/35] Remove forEach call in the grammar checker. --- src/compiler/parser.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 724f4ea581..4bc565205a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4240,12 +4240,15 @@ module ts { var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.flags & NodeFlags.ParsedInStrictMode) !== 0; - forEach(node.properties, (p: Declaration) => { + + for (var i = 0, n = node.properties.length; i < n; i++) { + var prop = node.properties[i]; // TODO(jfreeman): continue if we have a computed property - if (p.kind === SyntaxKind.OmittedExpression) { - return; + if (prop.kind === SyntaxKind.OmittedExpression) { + continue; } + var p = prop; var name = p.name; // ECMA-262 11.1.5 Object Initialiser @@ -4295,7 +4298,7 @@ module ts { grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } - }); + } } function visitNumericLiteral(node: LiteralExpression): void {