Merge pull request #1899 from Microsoft/earlyErrors2

Emit even in the presence of parse errors.
This commit is contained in:
CyrusNajmabadi
2015-02-02 20:24:06 -05:00
1012 changed files with 49770 additions and 421 deletions
+2 -2
View File
@@ -10119,7 +10119,7 @@ module ts {
return isImportResolvedToValue(getSymbolOfNode(node));
}
function hasSemanticErrors(sourceFile?: SourceFile) {
function hasSemanticDiagnostics(sourceFile?: SourceFile) {
// Return true if there is any semantic error in a file or globally
return getDiagnostics(sourceFile).length > 0 || getGlobalDiagnostics().length > 0;
}
@@ -10218,7 +10218,7 @@ module ts {
getNodeCheckFlags,
getEnumMemberValue,
isTopLevelValueImportWithEntityName,
hasSemanticErrors,
hasSemanticDiagnostics,
isDeclarationVisible,
isImplementationOfOverload,
writeTypeOfDeclaration,
+1 -3
View File
@@ -280,7 +280,6 @@ module ts {
messageText: text,
category: message.category,
code: message.code,
isEarly: message.isEarly
};
}
@@ -299,8 +298,7 @@ module ts {
messageText: text,
category: message.category,
code: message.code,
isEarly: message.isEarly
code: message.code
};
}
+107 -107
View File
@@ -4,87 +4,87 @@ module ts {
export var Diagnostics = {
Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." },
Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." },
_0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected.", isEarly: true },
_0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." },
A_file_cannot_have_a_reference_to_itself: { code: 1006, category: DiagnosticCategory.Error, key: "A file cannot have a reference to itself." },
Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed.", isEarly: true },
Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." },
Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." },
Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." },
Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation.", isEarly: true },
A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list.", isEarly: true },
Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer.", isEarly: true },
A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter.", isEarly: true },
An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter.", isEarly: true },
An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier.", isEarly: true },
An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark.", isEarly: true },
An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer.", isEarly: true },
An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation.", isEarly: true },
An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation.", isEarly: true },
An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'.", isEarly: true },
Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation." },
A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list." },
Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer." },
A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter." },
An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter." },
An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier." },
An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark." },
An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." },
An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." },
An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." },
An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.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: DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." },
An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." },
A_class_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "A class can only extend a single class." },
A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: DiagnosticCategory.Error, key: "A class declaration can only have one 'implements' clause." },
Accessibility_modifier_already_seen: { code: 1028, category: DiagnosticCategory.Error, key: "Accessibility modifier already seen.", isEarly: true },
_0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier.", isEarly: true },
_0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen.", isEarly: true },
_0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element.", isEarly: true },
Accessibility_modifier_already_seen: { code: 1028, category: DiagnosticCategory.Error, key: "Accessibility modifier already seen." },
_0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier." },
_0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen." },
_0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element." },
An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: DiagnosticCategory.Error, key: "An interface declaration cannot have an 'implements' clause." },
super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: DiagnosticCategory.Error, key: "'super' must be followed by an argument list or member access." },
Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names.", isEarly: true },
Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts.", isEarly: true },
A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context.", isEarly: true },
Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts.", isEarly: true },
_0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element.", isEarly: true },
A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration.", isEarly: true },
Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names." },
Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts." },
A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context." },
Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts." },
_0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element." },
A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.Error, key: "A rest parameter cannot be optional.", isEarly: true },
A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer.", isEarly: true },
A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter.", isEarly: true },
A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter.", isEarly: true },
A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer.", isEarly: true },
A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter.", isEarly: true },
A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters.", isEarly: true },
Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher.", isEarly: true },
Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer.", isEarly: true },
An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module.", isEarly: true },
Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers.", isEarly: true },
A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional." },
A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." },
A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter." },
A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter." },
A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer." },
A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter." },
A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." },
Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." },
Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer." },
An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." },
Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." },
Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: DiagnosticCategory.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: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration.", isEarly: true },
A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." },
Invalid_reference_directive_syntax: { code: 1084, category: DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." },
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: DiagnosticCategory.Error, key: "Octal literals are not available when targeting ECMAScript 5 and higher.", isEarly: true },
An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context.", isEarly: true },
_0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration.", isEarly: true },
_0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter.", isEarly: true },
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement.", isEarly: true },
Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration.", isEarly: true },
Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration.", isEarly: true },
An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters.", isEarly: true },
A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation.", isEarly: true },
An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter.", isEarly: true },
_0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty.", isEarly: true },
Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty.", isEarly: true },
Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty.", isEarly: true },
Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode.", isEarly: true },
with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode.", isEarly: true },
delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode.", isEarly: true },
A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: DiagnosticCategory.Error, key: "A 'continue' statement can only be used within an enclosing iteration statement.", isEarly: true },
A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: DiagnosticCategory.Error, key: "A 'break' statement can only be used within an enclosing iteration or switch statement.", isEarly: true },
Jump_target_cannot_cross_function_boundary: { code: 1107, category: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary.", isEarly: true },
A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body.", isEarly: true },
Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected.", isEarly: true },
Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected.", isEarly: true },
A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional.", isEarly: true },
A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement.", isEarly: true },
Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'", isEarly: true },
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement.", isEarly: true },
A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement.", isEarly: true },
An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode.", isEarly: true },
An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name.", isEarly: true },
An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name.", isEarly: true },
An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers.", isEarly: true },
Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode.", isEarly: true },
A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty.", isEarly: true },
Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty.", isEarly: true },
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: DiagnosticCategory.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: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context." },
_0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration." },
_0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter." },
Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.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: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration." },
Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration." },
An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters." },
A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation." },
An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter." },
_0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty." },
Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty." },
Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty." },
Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode." },
with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode." },
delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary." },
A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body." },
Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected." },
Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected." },
A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional." },
A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement." },
Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'" },
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." },
An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers." },
Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode." },
A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty." },
Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty." },
Digit_expected: { code: 1124, category: DiagnosticCategory.Error, key: "Digit expected." },
Hexadecimal_digit_expected: { code: 1125, category: DiagnosticCategory.Error, key: "Hexadecimal digit expected." },
Unexpected_end_of_text: { code: 1126, category: DiagnosticCategory.Error, key: "Unexpected end of text." },
@@ -96,53 +96,53 @@ module ts {
Enum_member_expected: { code: 1132, category: DiagnosticCategory.Error, key: "Enum member expected." },
Type_reference_expected: { code: 1133, category: DiagnosticCategory.Error, key: "Type reference expected." },
Variable_declaration_expected: { code: 1134, category: DiagnosticCategory.Error, key: "Variable declaration expected." },
Argument_expression_expected: { code: 1135, category: DiagnosticCategory.Error, key: "Argument expression expected.", isEarly: true },
Argument_expression_expected: { code: 1135, category: DiagnosticCategory.Error, key: "Argument expression expected." },
Property_assignment_expected: { code: 1136, category: DiagnosticCategory.Error, key: "Property assignment expected." },
Expression_or_comma_expected: { code: 1137, category: DiagnosticCategory.Error, key: "Expression or comma expected." },
Parameter_declaration_expected: { code: 1138, category: DiagnosticCategory.Error, key: "Parameter declaration expected." },
Type_parameter_declaration_expected: { code: 1139, category: DiagnosticCategory.Error, key: "Type parameter declaration expected." },
Type_argument_expected: { code: 1140, category: DiagnosticCategory.Error, key: "Type argument expected." },
String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected.", isEarly: true },
Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here.", isEarly: true },
String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected." },
Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here." },
or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." },
Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members.", isEarly: true },
Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." },
Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." },
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module.", isEarly: true },
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.", isEarly: true },
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." },
let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher.", isEarly: true },
const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher.", isEarly: true },
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized", isEarly: true },
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block.", isEarly: true },
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block.", isEarly: true },
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.", isEarly: true },
let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.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: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." },
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" },
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." },
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." },
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." },
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional.", isEarly: true },
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration.", isEarly: true },
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums.", isEarly: true },
Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context.", isEarly: true },
Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations.", isEarly: true },
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher.", isEarly: true },
Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads.", isEarly: true },
Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces.", isEarly: true },
Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals.", isEarly: true },
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." },
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." },
Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." },
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." },
Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." },
Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." },
Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." },
A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." },
extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen.", isEarly: true },
extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause.", isEarly: true },
Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class.", isEarly: true },
implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen.", isEarly: true },
Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause.", isEarly: true },
extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." },
extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." },
Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class." },
implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen." },
Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause." },
Binary_digit_expected: { code: 1177, category: DiagnosticCategory.Error, key: "Binary digit expected." },
Octal_digit_expected: { code: 1178, category: DiagnosticCategory.Error, key: "Octal digit expected." },
Unexpected_token_expected: { code: 1179, category: DiagnosticCategory.Error, key: "Unexpected token. '{' expected." },
Property_destructuring_pattern_expected: { code: 1180, category: DiagnosticCategory.Error, key: "Property destructuring pattern expected." },
Array_element_destructuring_pattern_expected: { code: 1181, category: DiagnosticCategory.Error, key: "Array element destructuring pattern expected." },
A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer.", isEarly: true },
Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "Destructuring declarations are not allowed in ambient contexts.", isEarly: true },
An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts.", isEarly: true },
A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." },
Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "Destructuring declarations are not allowed in ambient contexts." },
An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." },
Modifiers_cannot_appear_here: { code: 1184, category: DiagnosticCategory.Error, key: "Modifiers cannot appear here." },
Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." },
A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." },
@@ -284,10 +284,10 @@ module ts {
Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.Error, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true },
Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: DiagnosticCategory.Error, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true },
Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: DiagnosticCategory.Error, key: "Block-scoped variable '{0}' used before its declaration." },
The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator cannot be a constant." },
Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: DiagnosticCategory.Error, key: "Left-hand side of assignment expression cannot be a constant." },
Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: DiagnosticCategory.Error, key: "Cannot redeclare block-scoped variable '{0}'." },
An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.Error, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." },
@@ -373,12 +373,12 @@ module ts {
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.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: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." },
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true },
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." },
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: DiagnosticCategory.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." },
A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal.", isEarly: true },
A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." },
const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: DiagnosticCategory.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: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." },
Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'.", isEarly: true },
Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." },
The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." },
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." },
Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" },
@@ -450,8 +450,8 @@ module ts {
_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: DiagnosticCategory.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: DiagnosticCategory.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: DiagnosticCategory.Error, key: "You cannot rename this element." },
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported.", isEarly: true },
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported.", isEarly: true },
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
};
}
+107 -214
View File
@@ -9,8 +9,7 @@
},
"'{0}' expected.": {
"category": "Error",
"code": 1005,
"isEarly": true
"code": 1005
},
"A file cannot have a reference to itself.": {
"category": "Error",
@@ -18,8 +17,7 @@
},
"Trailing comma not allowed.": {
"category": "Error",
"code": 1009,
"isEarly": true
"code": 1009
},
"'*/' expected.": {
"category": "Error",
@@ -31,58 +29,47 @@
},
"Catch clause parameter cannot have a type annotation.": {
"category": "Error",
"code": 1013,
"isEarly": true
"code": 1013
},
"A rest parameter must be last in a parameter list.": {
"category": "Error",
"code": 1014,
"isEarly": true
"code": 1014
},
"Parameter cannot have question mark and initializer.": {
"category": "Error",
"code": 1015,
"isEarly": true
"code": 1015
},
"A required parameter cannot follow an optional parameter.": {
"category": "Error",
"code": 1016,
"isEarly": true
"code": 1016
},
"An index signature cannot have a rest parameter.": {
"category": "Error",
"code": 1017,
"isEarly": true
"code": 1017
},
"An index signature parameter cannot have an accessibility modifier.": {
"category": "Error",
"code": 1018,
"isEarly": true
"code": 1018
},
"An index signature parameter cannot have a question mark.": {
"category": "Error",
"code": 1019,
"isEarly": true
"code": 1019
},
"An index signature parameter cannot have an initializer.": {
"category": "Error",
"code": 1020,
"isEarly": true
"code": 1020
},
"An index signature must have a type annotation.": {
"category": "Error",
"code": 1021,
"isEarly": true
"code": 1021
},
"An index signature parameter must have a type annotation.": {
"category": "Error",
"code": 1022,
"isEarly": true
"code": 1022
},
"An index signature parameter type must be 'string' or 'number'.": {
"category": "Error",
"code": 1023,
"isEarly": true
"code": 1023
},
"A class or interface declaration can only have one 'extends' clause.": {
"category": "Error",
@@ -102,23 +89,19 @@
},
"Accessibility modifier already seen.": {
"category": "Error",
"code": 1028,
"isEarly": true
"code": 1028
},
"'{0}' modifier must precede '{1}' modifier.": {
"category": "Error",
"code": 1029,
"isEarly": true
"code": 1029
},
"'{0}' modifier already seen.": {
"category": "Error",
"code": 1030,
"isEarly": true
"code": 1030
},
"'{0}' modifier cannot appear on a class element.": {
"category": "Error",
"code": 1031,
"isEarly": true
"code": 1031
},
"An interface declaration cannot have an 'implements' clause.": {
"category": "Error",
@@ -130,33 +113,27 @@
},
"Only ambient modules can use quoted names.": {
"category": "Error",
"code": 1035,
"isEarly": true
"code": 1035
},
"Statements are not allowed in ambient contexts.": {
"category": "Error",
"code": 1036,
"isEarly": true
"code": 1036
},
"A 'declare' modifier cannot be used in an already ambient context.": {
"category": "Error",
"code": 1038,
"isEarly": true
"code": 1038
},
"Initializers are not allowed in ambient contexts.": {
"category": "Error",
"code": 1039,
"isEarly": true
"code": 1039
},
"'{0}' modifier cannot appear on a module element.": {
"category": "Error",
"code": 1044,
"isEarly": true
"code": 1044
},
"A 'declare' modifier cannot be used with an interface declaration.": {
"category": "Error",
"code": 1045,
"isEarly": true
"code": 1045
},
"A 'declare' modifier is required for a top level declaration in a .d.ts file.": {
"category": "Error",
@@ -164,58 +141,47 @@
},
"A rest parameter cannot be optional.": {
"category": "Error",
"code": 1047,
"isEarly": true
"code": 1047
},
"A rest parameter cannot have an initializer.": {
"category": "Error",
"code": 1048,
"isEarly": true
"code": 1048
},
"A 'set' accessor must have exactly one parameter.": {
"category": "Error",
"code": 1049,
"isEarly": true
"code": 1049
},
"A 'set' accessor cannot have an optional parameter.": {
"category": "Error",
"code": 1051,
"isEarly": true
"code": 1051
},
"A 'set' accessor parameter cannot have an initializer.": {
"category": "Error",
"code": 1052,
"isEarly": true
"code": 1052
},
"A 'set' accessor cannot have rest parameter.": {
"category": "Error",
"code": 1053,
"isEarly": true
"code": 1053
},
"A 'get' accessor cannot have parameters.": {
"category": "Error",
"code": 1054,
"isEarly": true
"code": 1054
},
"Accessors are only available when targeting ECMAScript 5 and higher.": {
"category": "Error",
"code": 1056,
"isEarly": true
"code": 1056
},
"Enum member must have initializer.": {
"category": "Error",
"code": 1061,
"isEarly": true
"code": 1061
},
"An export assignment cannot be used in an internal module.": {
"category": "Error",
"code": 1063,
"isEarly": true
"code": 1063
},
"Ambient enum elements can only have integer literal initializers.": {
"category": "Error",
"code": 1066,
"isEarly": true
"code": 1066
},
"Unexpected token. A constructor, method, accessor, or property was expected.": {
"category": "Error",
@@ -223,8 +189,7 @@
},
"A 'declare' modifier cannot be used with an import declaration.": {
"category": "Error",
"code": 1079,
"isEarly": true
"code": 1079
},
"Invalid 'reference' directive syntax.": {
"category": "Error",
@@ -232,173 +197,139 @@
},
"Octal literals are not available when targeting ECMAScript 5 and higher.": {
"category": "Error",
"code": 1085,
"isEarly": true
"code": 1085
},
"An accessor cannot be declared in an ambient context.": {
"category": "Error",
"code": 1086,
"isEarly": true
"code": 1086
},
"'{0}' modifier cannot appear on a constructor declaration.": {
"category": "Error",
"code": 1089,
"isEarly": true
"code": 1089
},
"'{0}' modifier cannot appear on a parameter.": {
"category": "Error",
"code": 1090,
"isEarly": true
"code": 1090
},
"Only a single variable declaration is allowed in a 'for...in' statement.": {
"category": "Error",
"code": 1091,
"isEarly": true
"code": 1091
},
"Type parameters cannot appear on a constructor declaration.": {
"category": "Error",
"code": 1092,
"isEarly": true
"code": 1092
},
"Type annotation cannot appear on a constructor declaration.": {
"category": "Error",
"code": 1093,
"isEarly": true
"code": 1093
},
"An accessor cannot have type parameters.": {
"category": "Error",
"code": 1094,
"isEarly": true
"code": 1094
},
"A 'set' accessor cannot have a return type annotation.": {
"category": "Error",
"code": 1095,
"isEarly": true
"code": 1095
},
"An index signature must have exactly one parameter.": {
"category": "Error",
"code": 1096,
"isEarly": true
"code": 1096
},
"'{0}' list cannot be empty.": {
"category": "Error",
"code": 1097,
"isEarly": true
"code": 1097
},
"Type parameter list cannot be empty.": {
"category": "Error",
"code": 1098,
"isEarly": true
"code": 1098
},
"Type argument list cannot be empty.": {
"category": "Error",
"code": 1099,
"isEarly": true
"code": 1099
},
"Invalid use of '{0}' in strict mode.": {
"category": "Error",
"code": 1100,
"isEarly": true
"code": 1100
},
"'with' statements are not allowed in strict mode.": {
"category": "Error",
"code": 1101,
"isEarly": true
"code": 1101
},
"'delete' cannot be called on an identifier in strict mode.": {
"category": "Error",
"code": 1102,
"isEarly": true
"code": 1102
},
"A 'continue' statement can only be used within an enclosing iteration statement.": {
"category": "Error",
"code": 1104,
"isEarly": true
"code": 1104
},
"A 'break' statement can only be used within an enclosing iteration or switch statement.": {
"category": "Error",
"code": 1105,
"isEarly": true
"code": 1105
},
"Jump target cannot cross function boundary.": {
"category": "Error",
"code": 1107,
"isEarly": true
"code": 1107
},
"A 'return' statement can only be used within a function body.": {
"category": "Error",
"code": 1108,
"isEarly": true
"code": 1108
},
"Expression expected.": {
"category": "Error",
"code": 1109,
"isEarly": true
"code": 1109
},
"Type expected.": {
"category": "Error",
"code": 1110,
"isEarly": true
"code": 1110
},
"A class member cannot be declared optional.": {
"category": "Error",
"code": 1112,
"isEarly": true
"code": 1112
},
"A 'default' clause cannot appear more than once in a 'switch' statement.": {
"category": "Error",
"code": 1113,
"isEarly": true
"code": 1113
},
"Duplicate label '{0}'": {
"category": "Error",
"code": 1114,
"isEarly": true
"code": 1114
},
"A 'continue' statement can only jump to a label of an enclosing iteration statement.": {
"category": "Error",
"code": 1115,
"isEarly": true
"code": 1115
},
"A 'break' statement can only jump to a label of an enclosing statement.": {
"category": "Error",
"code": 1116,
"isEarly": true
"code": 1116
},
"An object literal cannot have multiple properties with the same name in strict mode.": {
"category": "Error",
"code": 1117,
"isEarly": true
"code": 1117
},
"An object literal cannot have multiple get/set accessors with the same name.": {
"category": "Error",
"code": 1118,
"isEarly": true
"code": 1118
},
"An object literal cannot have property and accessor with the same name.": {
"category": "Error",
"code": 1119,
"isEarly": true
"code": 1119
},
"An export assignment cannot have modifiers.": {
"category": "Error",
"code": 1120,
"isEarly": true
"code": 1120
},
"Octal literals are not allowed in strict mode.": {
"category": "Error",
"code": 1121,
"isEarly": true
"code": 1121
},
"A tuple type element list cannot be empty.": {
"category": "Error",
"code": 1122,
"isEarly": true
"code": 1122
},
"Variable declaration list cannot be empty.": {
"category": "Error",
"code": 1123,
"isEarly": true
"code": 1123
},
"Digit expected.": {
"category": "Error",
@@ -446,8 +377,7 @@
},
"Argument expression expected.": {
"category": "Error",
"code": 1135,
"isEarly": true
"code": 1135
},
"Property assignment expected.": {
"category": "Error",
@@ -471,13 +401,11 @@
},
"String literal expected.": {
"category": "Error",
"code": 1141,
"isEarly": true
"code": 1141
},
"Line break not permitted here.": {
"category": "Error",
"code": 1142,
"isEarly": true
"code": 1142
},
"'{' or ';' expected.": {
"category": "Error",
@@ -485,8 +413,7 @@
},
"Modifiers not permitted on index signature members.": {
"category": "Error",
"code": 1145,
"isEarly": true
"code": 1145
},
"Declaration expected.": {
"category": "Error",
@@ -494,8 +421,7 @@
},
"Import declarations in an internal module cannot reference an external module.": {
"category": "Error",
"code": 1147,
"isEarly": true
"code": 1147
},
"Cannot compile external modules unless the '--module' flag is provided.": {
"category": "Error",
@@ -507,8 +433,7 @@
},
"'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.": {
"category": "Error",
"code": 1150,
"isEarly": true
"code": 1150
},
"'var', 'let' or 'const' expected.": {
"category": "Error",
@@ -516,33 +441,27 @@
},
"'let' declarations are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1153,
"isEarly": true
"code": 1153
},
"'const' declarations are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1154,
"isEarly": true
"code": 1154
},
"'const' declarations must be initialized": {
"category": "Error",
"code": 1155,
"isEarly": true
"code": 1155
},
"'const' declarations can only be declared inside a block.": {
"category": "Error",
"code": 1156,
"isEarly": true
"code": 1156
},
"'let' declarations can only be declared inside a block.": {
"category": "Error",
"code": 1157,
"isEarly": true
"code": 1157
},
"Tagged templates are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1159,
"isEarly": true
"code": 1159
},
"Unterminated template literal.": {
"category": "Error",
@@ -554,48 +473,39 @@
},
"An object member cannot be declared optional.": {
"category": "Error",
"code": 1162,
"isEarly": true
"code": 1162
},
"'yield' expression must be contained_within a generator declaration.": {
"category": "Error",
"code": 1163,
"isEarly": true
"code": 1163
},
"Computed property names are not allowed in enums.": {
"category": "Error",
"code": 1164,
"isEarly": true
"code": 1164
},
"Computed property names are not allowed in an ambient context.": {
"category": "Error",
"code": 1165,
"isEarly": true
"code": 1165
},
"Computed property names are not allowed in class property declarations.": {
"category": "Error",
"code": 1166,
"isEarly": true
"code": 1166
},
"Computed property names are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1167,
"isEarly": true
"code": 1167
},
"Computed property names are not allowed in method overloads.": {
"category": "Error",
"code": 1168,
"isEarly": true
"code": 1168
},
"Computed property names are not allowed in interfaces.": {
"category": "Error",
"code": 1169,
"isEarly": true
"code": 1169
},
"Computed property names are not allowed in type literals.": {
"category": "Error",
"code": 1170,
"isEarly": true
"code": 1170
},
"A comma expression is not allowed in a computed property name.": {
"category": "Error",
@@ -603,28 +513,23 @@
},
"'extends' clause already seen.": {
"category": "Error",
"code": 1172,
"isEarly": true
"code": 1172
},
"'extends' clause must precede 'implements' clause.": {
"category": "Error",
"code": 1173,
"isEarly": true
"code": 1173
},
"Classes can only extend a single class.": {
"category": "Error",
"code": 1174,
"isEarly": true
"code": 1174
},
"'implements' clause already seen.": {
"category": "Error",
"code": 1175,
"isEarly": true
"code": 1175
},
"Interface declaration cannot have 'implements' clause.": {
"category": "Error",
"code": 1176,
"isEarly": true
"code": 1176
},
"Binary digit expected.": {
"category": "Error",
@@ -648,18 +553,15 @@
},
"A destructuring declaration must have an initializer.": {
"category": "Error",
"code": 1182,
"isEarly": true
"code": 1182
},
"Destructuring declarations are not allowed in ambient contexts.": {
"category": "Error",
"code": 1183,
"isEarly": true
"code": 1183
},
"An implementation cannot be declared in ambient contexts.": {
"category": "Error",
"code": 1184,
"isEarly": true
"code": 1184
},
"Modifiers cannot appear here.": {
"category": "Error",
@@ -1228,23 +1130,19 @@
},
"Block-scoped variable '{0}' used before its declaration.": {
"category": "Error",
"code": 2448,
"isEarly": true
"code": 2448
},
"The operand of an increment or decrement operator cannot be a constant.": {
"category": "Error",
"code": 2449,
"isEarly": true
"code": 2449
},
"Left-hand side of assignment expression cannot be a constant.": {
"category": "Error",
"code": 2450,
"isEarly": true
"code": 2450
},
"Cannot redeclare block-scoped variable '{0}'.": {
"category": "Error",
"code": 2451,
"isEarly": true
"code": 2451
},
"An enum member cannot have a numeric name.": {
"category": "Error",
@@ -1589,8 +1487,7 @@
},
"In 'const' enum declarations member initializer must be constant expression.": {
"category": "Error",
"code": 4083,
"isEarly": true
"code": 4083
},
"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": {
"category": "Error",
@@ -1598,8 +1495,7 @@
},
"A const enum member can only be accessed using a string literal.": {
"category": "Error",
"code": 4085,
"isEarly": true
"code": 4085
},
"'const' enum member initializer was evaluated to a non-finite value.": {
"category": "Error",
@@ -1611,8 +1507,7 @@
},
"Property '{0}' does not exist on 'const' enum '{1}'.": {
"category": "Error",
"code": 4088,
"isEarly": true
"code": 4088
},
"The current host does not support the '{0}' option.": {
"category": "Error",
@@ -1901,13 +1796,11 @@
},
"'yield' expressions are not currently supported.": {
"category": "Error",
"code": 9000,
"isEarly": true
"code": 9000
},
"Generators are not currently supported.": {
"category": "Error",
"code": 9001,
"isEarly": true
"code": 9001
},
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
"category": "Error",
+78 -63
View File
@@ -2074,8 +2074,6 @@ module ts {
return;
}
Debug.assert(node.parent.kind !== SyntaxKind.TaggedTemplateExpression);
var emitOuterParens = isExpression(node.parent)
&& templateNeedsParens(node, <Expression>node.parent);
@@ -2153,10 +2151,9 @@ module ts {
case SyntaxKind.CallExpression:
case SyntaxKind.NewExpression:
return (<CallExpression>parent).expression === template;
case SyntaxKind.TaggedTemplateExpression:
case SyntaxKind.ParenthesizedExpression:
return false;
case SyntaxKind.TaggedTemplateExpression:
Debug.fail("Path should be unreachable; tagged templates not supported pre-ES6.");
default:
return comparePrecedenceToBinaryPlus(parent) !== Comparison.LessThan;
}
@@ -2176,7 +2173,6 @@ module ts {
//
// TODO (drosen): Note that we need to account for the upcoming 'yield' and
// spread ('...') unary operators that are anticipated for ES6.
Debug.assert(languageVersion < ScriptTarget.ES6);
switch (expression.kind) {
case SyntaxKind.BinaryExpression:
switch ((<BinaryExpression>expression).operator) {
@@ -2533,7 +2529,6 @@ module ts {
}
function emitTaggedTemplateExpression(node: TaggedTemplateExpression): void {
Debug.assert(languageVersion >= ScriptTarget.ES6, "Trying to emit a tagged template in pre-ES6 mode.");
emit(node.tag);
write(" ");
emit(node.template);
@@ -3320,62 +3315,70 @@ module ts {
write(" {");
scopeEmitStart(node);
increaseIndent();
emitDetachedComments(node.body.kind === SyntaxKind.Block ? (<Block>node.body).statements : node.body);
var startIndex = 0;
if (node.body.kind === SyntaxKind.Block) {
startIndex = emitDirectivePrologues((<Block>node.body).statements, /*startWithNewLine*/ true);
}
var outPos = writer.getTextPos();
emitCaptureThisForNodeIfNecessary(node);
emitDefaultValueAssignments(node);
emitRestParameter(node);
if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) {
decreaseIndent();
write(" ");
emitStart(node.body);
write("return ");
// Don't emit comments on this body. We'll have already taken care of it above
// when we called emitDetachedComments.
emitNode(node.body, /*disableComments:*/ true);
emitEnd(node.body);
write(";");
emitTempDeclarations(/*newLine*/ false);
write(" ");
emitStart(node.body);
if (!node.body) {
writeLine();
write("}");
emitEnd(node.body);
}
else {
increaseIndent();
emitDetachedComments(node.body.kind === SyntaxKind.Block ? (<Block>node.body).statements : node.body);
var startIndex = 0;
if (node.body.kind === SyntaxKind.Block) {
emitLinesStartingAt((<Block>node.body).statements, startIndex);
startIndex = emitDirectivePrologues((<Block>node.body).statements, /*startWithNewLine*/ true);
}
else {
writeLine();
emitLeadingComments(node.body);
var outPos = writer.getTextPos();
emitCaptureThisForNodeIfNecessary(node);
emitDefaultValueAssignments(node);
emitRestParameter(node);
if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) {
decreaseIndent();
write(" ");
emitStart(node.body);
write("return ");
emit(node.body, /*disableComments:*/ true);
// Don't emit comments on this body. We'll have already taken care of it above
// when we called emitDetachedComments.
emitNode(node.body, /*disableComments:*/ true);
emitEnd(node.body);
write(";");
emitTrailingComments(node.body);
}
emitTempDeclarations(/*newLine*/ true);
writeLine();
if (node.body.kind === SyntaxKind.Block) {
emitLeadingCommentsOfPosition((<Block>node.body).statements.end);
decreaseIndent();
emitToken(SyntaxKind.CloseBraceToken,(<Block>node.body).statements.end);
}
else {
decreaseIndent();
emitTempDeclarations(/*newLine*/ false);
write(" ");
emitStart(node.body);
write("}");
emitEnd(node.body);
}
else {
if (node.body.kind === SyntaxKind.Block) {
emitLinesStartingAt((<Block>node.body).statements, startIndex);
}
else {
writeLine();
emitLeadingComments(node.body);
write("return ");
emit(node.body, /*disableComments:*/ true);
write(";");
emitTrailingComments(node.body);
}
emitTempDeclarations(/*newLine*/ true);
writeLine();
if (node.body.kind === SyntaxKind.Block) {
emitLeadingCommentsOfPosition((<Block>node.body).statements.end);
decreaseIndent();
emitToken(SyntaxKind.CloseBraceToken, (<Block>node.body).statements.end);
}
else {
decreaseIndent();
emitStart(node.body);
write("}");
emitEnd(node.body);
}
}
}
scopeEmitEnd();
if (node.flags & NodeFlags.Export) {
writeLine();
@@ -3725,18 +3728,30 @@ module ts {
write("[");
emitExpressionForPropertyName(node.name);
write("] = ");
if (node.initializer && !isConst(enumParent)) {
emit(node.initializer);
}
else {
write(resolver.getEnumMemberValue(node).toString());
}
writeEnumMemberDeclarationValue(node);
write("] = ");
emitExpressionForPropertyName(node.name);
emitEnd(node);
write(";");
}
function writeEnumMemberDeclarationValue(member: EnumMember) {
if (!member.initializer || isConst(member.parent)) {
var value = resolver.getEnumMemberValue(member);
if (value !== undefined) {
write(value.toString());
return;
}
}
if (member.initializer) {
emit(member.initializer);
}
else {
write("undefined");
}
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration: ModuleDeclaration): ModuleDeclaration {
if (moduleDeclaration.body.kind === SyntaxKind.ModuleDeclaration) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(<ModuleDeclaration>moduleDeclaration.body);
@@ -4360,12 +4375,12 @@ module ts {
}
}
var hasSemanticErrors: boolean = false;
var isEmitBlocked: boolean = false;
var hasSemanticDiagnostics = false;
var isEmitBlocked = false;
if (targetSourceFile === undefined) {
// No targetSourceFile is specified (e.g. calling emitter from batch compiler)
hasSemanticErrors = resolver.hasSemanticErrors();
hasSemanticDiagnostics = resolver.hasSemanticDiagnostics();
isEmitBlocked = host.isEmitBlocked();
forEach(host.getSourceFiles(), sourceFile => {
@@ -4383,7 +4398,7 @@ module ts {
// targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service)
if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) {
// If shouldEmitToOwnFile returns true or targetSourceFile is an external module file, then emit targetSourceFile in its own output file
hasSemanticErrors = resolver.hasSemanticErrors(targetSourceFile);
hasSemanticDiagnostics = resolver.hasSemanticDiagnostics(targetSourceFile);
isEmitBlocked = host.isEmitBlocked(targetSourceFile);
var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js");
@@ -4394,7 +4409,7 @@ module ts {
// Emit all, non-external-module file, into one single output file
forEach(host.getSourceFiles(), sourceFile => {
if (!shouldEmitToOwnFile(sourceFile, compilerOptions)) {
hasSemanticErrors = hasSemanticErrors || resolver.hasSemanticErrors(sourceFile);
hasSemanticDiagnostics = hasSemanticDiagnostics || resolver.hasSemanticDiagnostics(sourceFile);
isEmitBlocked = isEmitBlocked || host.isEmitBlocked(sourceFile);
}
});
@@ -4406,7 +4421,7 @@ module ts {
function emitFile(jsFilePath: string, sourceFile?: SourceFile) {
if (!isEmitBlocked) {
emitJavaScript(jsFilePath, sourceFile);
if (!hasSemanticErrors && compilerOptions.declaration) {
if (!hasSemanticDiagnostics && compilerOptions.declaration) {
writeDeclarationFile(jsFilePath, sourceFile);
}
}
@@ -4425,9 +4440,9 @@ module ts {
emitResultStatus = EmitReturnStatus.AllOutputGenerationSkipped;
} else if (hasEmitterError) {
emitResultStatus = EmitReturnStatus.EmitErrorsEncountered;
} else if (hasSemanticErrors && compilerOptions.declaration) {
} else if (hasSemanticDiagnostics && compilerOptions.declaration) {
emitResultStatus = EmitReturnStatus.DeclarationGenerationSkipped;
} else if (hasSemanticErrors && !compilerOptions.declaration) {
} else if (hasSemanticDiagnostics && !compilerOptions.declaration) {
emitResultStatus = EmitReturnStatus.JSGeneratedWithSemanticErrors;
} else {
emitResultStatus = EmitReturnStatus.Succeeded;
+5 -7
View File
@@ -113,14 +113,12 @@ module ts {
return emitHost || (emitHost = createEmitHostFromProgram(program));
}
function hasEarlyErrors(sourceFile?: SourceFile): boolean {
return forEach(getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile), d => d.isEarly);
}
function isEmitBlocked(sourceFile?: SourceFile): boolean {
return getDiagnostics(sourceFile).length !== 0 ||
hasEarlyErrors(sourceFile) ||
(options.noEmitOnError && getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile).length !== 0);
if (options.noEmitOnError) {
return getDiagnostics(sourceFile).length !== 0 || getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile).length !== 0;
}
return false;
}
function getDiagnosticsProducingTypeChecker() {
+1 -6
View File
@@ -1123,7 +1123,7 @@ module ts {
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
getEnumMemberValue(node: EnumMember): number;
hasSemanticErrors(sourceFile?: SourceFile): boolean;
hasSemanticDiagnostics(sourceFile?: SourceFile): boolean;
isDeclarationVisible(node: Declaration): boolean;
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
@@ -1418,7 +1418,6 @@ module ts {
key: string;
category: DiagnosticCategory;
code: number;
isEarly?: boolean;
}
// A linked list of formatted diagnostic messages to be used as part of a multiline message.
@@ -1439,10 +1438,6 @@ module ts {
messageText: string;
category: DiagnosticCategory;
code: number;
/**
* Early error - any error (can be produced at parsing\binding\typechecking step) that blocks emit
*/
isEarly?: boolean;
}
export enum DiagnosticCategory {
-1
View File
@@ -308,7 +308,6 @@ module Utils {
assert.equal(d1.messageText, d2.messageText, "d1.messageText !== d2.messageText");
assert.equal(d1.category, d2.category, "d1.category !== d2.category");
assert.equal(d1.code, d2.code, "d1.code !== d2.code");
assert.equal(d1.isEarly, d2.isEarly, "d1.isEarly !== d2.isEarly");
}
}
@@ -0,0 +1,8 @@
//// [ArrowFunction1.ts]
var v = (a: ) => {
};
//// [ArrowFunction1.js]
var v = function (a) {
};
@@ -0,0 +1,8 @@
//// [ArrowFunction2.ts]
var v = (a: b,) => {
};
//// [ArrowFunction2.js]
var v = function (a) {
};
@@ -0,0 +1,8 @@
//// [ArrowFunction3.ts]
var v = (a): => {
};
//// [ArrowFunction3.js]
var v = function (a) {
};
@@ -0,0 +1,13 @@
//// [ExportAssignment7.ts]
export class C {
}
export = B;
//// [ExportAssignment7.js]
var C = (function () {
function C() {
}
return C;
})();
exports.C = C;
@@ -0,0 +1,13 @@
//// [ExportAssignment8.ts]
export = B;
export class C {
}
//// [ExportAssignment8.js]
var C = (function () {
function C() {
}
return C;
})();
exports.C = C;
@@ -0,0 +1,25 @@
//// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts]
module A {
class Point {
constructor(public x: number, public y: number) { }
}
export var UnitSquare : {
top: { left: Point, right: Point },
bottom: { left: Point, right: Point }
} = null;
}
//// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js]
var A;
(function (A) {
var Point = (function () {
function Point(x, y) {
this.x = x;
this.y = y;
}
return Point;
})();
A.UnitSquare = null;
})(A || (A = {}));
@@ -0,0 +1,8 @@
//// [FunctionDeclaration10_es6.ts]
function * foo(a = yield => yield) {
}
//// [FunctionDeclaration10_es6.js]
function foo(a) {
if (a === void 0) { a = function (yield) { return yield; }; }
}
@@ -0,0 +1,7 @@
//// [FunctionDeclaration11_es6.ts]
function * yield() {
}
//// [FunctionDeclaration11_es6.js]
function yield() {
}
@@ -0,0 +1,6 @@
//// [FunctionDeclaration12_es6.ts]
var v = function * yield() { }
//// [FunctionDeclaration12_es6.js]
var v = , yield = function () {
};
@@ -0,0 +1,12 @@
//// [FunctionDeclaration13_es6.ts]
function * foo() {
// Legal to use 'yield' in a type context.
var v: yield;
}
//// [FunctionDeclaration13_es6.js]
function foo() {
// Legal to use 'yield' in a type context.
var v;
}
@@ -0,0 +1,7 @@
//// [FunctionDeclaration1_es6.ts]
function * foo() {
}
//// [FunctionDeclaration1_es6.js]
function foo() {
}
@@ -0,0 +1,8 @@
//// [FunctionDeclaration5_es6.ts]
function*foo(yield) {
}
//// [FunctionDeclaration5_es6.js]
yield;
{
}
@@ -0,0 +1,8 @@
//// [FunctionDeclaration6_es6.ts]
function*foo(a = yield) {
}
//// [FunctionDeclaration6_es6.js]
function foo(a) {
if (a === void 0) { a = yield; }
}
@@ -0,0 +1,14 @@
//// [FunctionDeclaration7_es6.ts]
function*bar() {
// 'yield' here is an identifier, and not a yield expression.
function*foo(a = yield) {
}
}
//// [FunctionDeclaration7_es6.js]
function bar() {
// 'yield' here is an identifier, and not a yield expression.
function foo(a) {
if (a === void 0) { a = yield; }
}
}
@@ -0,0 +1,5 @@
//// [FunctionDeclaration8_es6.ts]
var v = { [yield]: foo }
//// [FunctionDeclaration8_es6.js]
var v = { [yield]: foo };
@@ -0,0 +1,9 @@
//// [FunctionDeclaration9_es6.ts]
function * foo() {
var v = { [yield]: foo }
}
//// [FunctionDeclaration9_es6.js]
function foo() {
var v = { []: foo };
}
@@ -0,0 +1,6 @@
//// [FunctionExpression1_es6.ts]
var v = function * () { }
//// [FunctionExpression1_es6.js]
var v = function () {
};
@@ -0,0 +1,6 @@
//// [FunctionExpression2_es6.ts]
var v = function * foo() { }
//// [FunctionExpression2_es6.js]
var v = function foo() {
};
@@ -0,0 +1,6 @@
//// [FunctionPropertyAssignments1_es6.ts]
var v = { *foo() { } }
//// [FunctionPropertyAssignments1_es6.js]
var v = { foo: function () {
} };
@@ -0,0 +1,6 @@
//// [FunctionPropertyAssignments2_es6.ts]
var v = { *() { } }
//// [FunctionPropertyAssignments2_es6.js]
var v = { : function () {
} };
@@ -0,0 +1,6 @@
//// [FunctionPropertyAssignments3_es6.ts]
var v = { *{ } }
//// [FunctionPropertyAssignments3_es6.js]
var v = { : function () {
} };
@@ -0,0 +1,6 @@
//// [FunctionPropertyAssignments4_es6.ts]
var v = { * }
//// [FunctionPropertyAssignments4_es6.js]
var v = { : function () {
} };
@@ -0,0 +1,6 @@
//// [FunctionPropertyAssignments5_es6.ts]
var v = { *[foo()]() { } }
//// [FunctionPropertyAssignments5_es6.js]
var v = { [foo()]: function () {
} };
@@ -0,0 +1,6 @@
//// [FunctionPropertyAssignments6_es6.ts]
var v = { *<T>() { } }
//// [FunctionPropertyAssignments6_es6.js]
var v = { : function () {
} };
@@ -0,0 +1,17 @@
//// [MemberAccessorDeclaration15.ts]
class C {
set Foo(public a: number) { }
}
//// [MemberAccessorDeclaration15.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "Foo", {
set: function (a) {
},
enumerable: true,
configurable: true
});
return C;
})();
@@ -0,0 +1,13 @@
//// [MemberFunctionDeclaration1_es6.ts]
class C {
*foo() { }
}
//// [MemberFunctionDeclaration1_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
return C;
})();
@@ -0,0 +1,13 @@
//// [MemberFunctionDeclaration2_es6.ts]
class C {
public * foo() { }
}
//// [MemberFunctionDeclaration2_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
return C;
})();
@@ -0,0 +1,13 @@
//// [MemberFunctionDeclaration3_es6.ts]
class C {
*[foo]() { }
}
//// [MemberFunctionDeclaration3_es6.js]
var C = (function () {
function C() {
}
C.prototype[foo] = function () {
};
return C;
})();
@@ -0,0 +1,13 @@
//// [MemberFunctionDeclaration4_es6.ts]
class C {
*() { }
}
//// [MemberFunctionDeclaration4_es6.js]
var C = (function () {
function C() {
}
C.prototype. = function () {
};
return C;
})();
@@ -0,0 +1,11 @@
//// [MemberFunctionDeclaration5_es6.ts]
class C {
*
}
//// [MemberFunctionDeclaration5_es6.js]
var C = (function () {
function C() {
}
return C;
})();
@@ -0,0 +1,11 @@
//// [MemberFunctionDeclaration6_es6.ts]
class C {
*foo
}
//// [MemberFunctionDeclaration6_es6.js]
var C = (function () {
function C() {
}
return C;
})();
@@ -0,0 +1,13 @@
//// [MemberFunctionDeclaration7_es6.ts]
class C {
*foo<T>() { }
}
//// [MemberFunctionDeclaration7_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
return C;
})();
@@ -0,0 +1,22 @@
//// [MemberFunctionDeclaration8_es6.ts]
class C {
foo() {
// Make sure we don't think of *bar as the start of a generator method.
if (a) # * bar;
return bar;
}
}
//// [MemberFunctionDeclaration8_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
// Make sure we don't think of *bar as the start of a generator method.
if (a)
;
* bar;
return bar;
};
return C;
})();
+10
View File
@@ -0,0 +1,10 @@
//// [Protected1.ts]
protected class C {
}
//// [Protected1.js]
var C = (function () {
function C() {
}
return C;
})();
+5
View File
@@ -0,0 +1,5 @@
//// [Protected2.ts]
protected module M {
}
//// [Protected2.js]
+11
View File
@@ -0,0 +1,11 @@
//// [Protected3.ts]
class C {
protected constructor() { }
}
//// [Protected3.js]
var C = (function () {
function C() {
}
return C;
})();
+13
View File
@@ -0,0 +1,13 @@
//// [Protected4.ts]
class C {
protected public m() { }
}
//// [Protected4.js]
var C = (function () {
function C() {
}
C.prototype.m = function () {
};
return C;
})();
+13
View File
@@ -0,0 +1,13 @@
//// [Protected6.ts]
class C {
static protected m() { }
}
//// [Protected6.js]
var C = (function () {
function C() {
}
C.m = function () {
};
return C;
})();
+13
View File
@@ -0,0 +1,13 @@
//// [Protected7.ts]
class C {
protected private m() { }
}
//// [Protected7.js]
var C = (function () {
function C() {
}
C.prototype.m = function () {
};
return C;
})();
@@ -0,0 +1,5 @@
//// [TemplateExpression1.ts]
var v = `foo ${ a
//// [TemplateExpression1.js]
var v = "foo " + a;
+5
View File
@@ -0,0 +1,5 @@
//// [TupleType3.ts]
var v: []
//// [TupleType3.js]
var v;
+5
View File
@@ -0,0 +1,5 @@
//// [TupleType4.ts]
var v: [
//// [TupleType4.js]
var v;
+5
View File
@@ -0,0 +1,5 @@
//// [TupleType5.ts]
var v: [number,]
//// [TupleType5.js]
var v;
@@ -0,0 +1,60 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.ts] ////
//// [part1.ts]
export module A {
export interface Point {
x: number;
y: number;
}
export module Utils {
export function mirror<T extends Point>(p: T) {
return { x: p.y, y: p.x };
}
}
export var Origin: Point = { x: 0, y: 0 };
}
//// [part2.ts]
export module A {
// collision with 'Origin' var in other part of merged module
export var Origin: Point = { x: 0, y: 0 };
export module Utils {
export class Plane {
constructor(public tl: Point, public br: Point) { }
}
}
}
//// [part1.js]
var A;
(function (A) {
var Utils;
(function (Utils) {
function mirror(p) {
return { x: p.y, y: p.x };
}
Utils.mirror = mirror;
})(Utils = A.Utils || (A.Utils = {}));
A.Origin = { x: 0, y: 0 };
})(A = exports.A || (exports.A = {}));
//// [part2.js]
var A;
(function (A) {
// collision with 'Origin' var in other part of merged module
A.Origin = { x: 0, y: 0 };
var Utils;
(function (Utils) {
var Plane = (function () {
function Plane(tl, br) {
this.tl = tl;
this.br = br;
}
return Plane;
})();
Utils.Plane = Plane;
})(Utils = A.Utils || (A.Utils = {}));
})(A = exports.A || (exports.A = {}));
@@ -0,0 +1,5 @@
//// [TypeArgumentList1.ts]
Foo<A,B,\ C>(4, 5, 6);
//// [TypeArgumentList1.js]
Foo(4, 5, 6);
@@ -0,0 +1,5 @@
//// [VariableDeclaration10_es6.ts]
let a: number = 1
//// [VariableDeclaration10_es6.js]
let a = 1;
@@ -0,0 +1,7 @@
//// [VariableDeclaration11_es6.ts]
"use strict";
let
//// [VariableDeclaration11_es6.js]
"use strict";
let ;
@@ -0,0 +1,5 @@
//// [VariableDeclaration1_es6.ts]
const
//// [VariableDeclaration1_es6.js]
const ;
@@ -0,0 +1,5 @@
//// [VariableDeclaration2_es6.ts]
const a
//// [VariableDeclaration2_es6.js]
const a;
@@ -0,0 +1,5 @@
//// [VariableDeclaration3_es6.ts]
const a = 1
//// [VariableDeclaration3_es6.js]
const a = 1;
@@ -0,0 +1,5 @@
//// [VariableDeclaration4_es6.ts]
const a: number
//// [VariableDeclaration4_es6.js]
const a;
@@ -0,0 +1,5 @@
//// [VariableDeclaration5_es6.ts]
const a: number = 1
//// [VariableDeclaration5_es6.js]
const a = 1;
@@ -0,0 +1,5 @@
//// [VariableDeclaration7_es6.ts]
let a
//// [VariableDeclaration7_es6.js]
let a;
@@ -0,0 +1,5 @@
//// [VariableDeclaration8_es6.ts]
let a = 1
//// [VariableDeclaration8_es6.js]
let a = 1;
@@ -0,0 +1,5 @@
//// [VariableDeclaration9_es6.ts]
let a: number
//// [VariableDeclaration9_es6.js]
let a;
@@ -0,0 +1,11 @@
//// [YieldExpression10_es6.ts]
var v = { * foo() {
yield(foo);
}
}
//// [YieldExpression10_es6.js]
var v = { foo: function () {
;
} };
@@ -0,0 +1,16 @@
//// [YieldExpression11_es6.ts]
class C {
*foo() {
yield(foo);
}
}
//// [YieldExpression11_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
;
};
return C;
})();
@@ -0,0 +1,14 @@
//// [YieldExpression12_es6.ts]
class C {
constructor() {
yield foo
}
}
//// [YieldExpression12_es6.js]
var C = (function () {
function C() {
;
}
return C;
})();
@@ -0,0 +1,7 @@
//// [YieldExpression13_es6.ts]
function* foo() { yield }
//// [YieldExpression13_es6.js]
function foo() {
;
}
@@ -0,0 +1,16 @@
//// [YieldExpression14_es6.ts]
class C {
foo() {
yield foo
}
}
//// [YieldExpression14_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
;
};
return C;
})();
@@ -0,0 +1,9 @@
//// [YieldExpression15_es6.ts]
var v = () => {
yield foo
}
//// [YieldExpression15_es6.js]
var v = function () {
;
};
@@ -0,0 +1,13 @@
//// [YieldExpression16_es6.ts]
function* foo() {
function bar() {
yield foo;
}
}
//// [YieldExpression16_es6.js]
function foo() {
function bar() {
;
}
}
@@ -0,0 +1,7 @@
//// [YieldExpression17_es6.ts]
var v = { get foo() { yield foo; } }
//// [YieldExpression17_es6.js]
var v = { get foo() {
;
} };
@@ -0,0 +1,7 @@
//// [YieldExpression18_es6.ts]
"use strict";
yield(foo);
//// [YieldExpression18_es6.js]
"use strict";
;
@@ -0,0 +1,17 @@
//// [YieldExpression19_es6.ts]
function*foo() {
function bar() {
function* quux() {
yield(foo);
}
}
}
//// [YieldExpression19_es6.js]
function foo() {
function bar() {
function quux() {
;
}
}
}
@@ -0,0 +1,5 @@
//// [YieldExpression2_es6.ts]
yield foo;
//// [YieldExpression2_es6.js]
;
@@ -0,0 +1,11 @@
//// [YieldExpression3_es6.ts]
function* foo() {
yield
yield
}
//// [YieldExpression3_es6.js]
function foo() {
;
;
}
@@ -0,0 +1,11 @@
//// [YieldExpression4_es6.ts]
function* foo() {
yield;
yield;
}
//// [YieldExpression4_es6.js]
function foo() {
;
;
}
@@ -0,0 +1,9 @@
//// [YieldExpression5_es6.ts]
function* foo() {
yield*
}
//// [YieldExpression5_es6.js]
function foo() {
;
}
@@ -0,0 +1,9 @@
//// [YieldExpression6_es6.ts]
function* foo() {
yield*foo
}
//// [YieldExpression6_es6.js]
function foo() {
;
}
@@ -0,0 +1,9 @@
//// [YieldExpression7_es6.ts]
function* foo() {
yield foo
}
//// [YieldExpression7_es6.js]
function foo() {
;
}
@@ -0,0 +1,11 @@
//// [YieldExpression8_es6.ts]
yield(foo);
function* foo() {
yield(foo);
}
//// [YieldExpression8_es6.js]
yield(foo);
function foo() {
;
}
@@ -0,0 +1,9 @@
//// [YieldExpression9_es6.ts]
var v = function*() {
yield(foo);
}
//// [YieldExpression9_es6.js]
var v = function () {
;
};
@@ -0,0 +1,171 @@
//// [accessibilityModifiers.ts]
// No errors
class C {
private static privateProperty;
private static privateMethod() { }
private static get privateGetter() { return 0; }
private static set privateSetter(a: number) { }
protected static protectedProperty;
protected static protectedMethod() { }
protected static get protectedGetter() { return 0; }
protected static set protectedSetter(a: number) { }
public static publicProperty;
public static publicMethod() { }
public static get publicGetter() { return 0; }
public static set publicSetter(a: number) { }
}
// Errors, accessibility modifiers must precede static
class D {
static private privateProperty;
static private privateMethod() { }
static private get privateGetter() { return 0; }
static private set privateSetter(a: number) { }
static protected protectedProperty;
static protected protectedMethod() { }
static protected get protectedGetter() { return 0; }
static protected set protectedSetter(a: number) { }
static public publicProperty;
static public publicMethod() { }
static public get publicGetter() { return 0; }
static public set publicSetter(a: number) { }
}
// Errors, multiple accessibility modifier
class E {
private public protected property;
public protected method() { }
private protected get getter() { return 0; }
public public set setter(a: number) { }
}
//// [accessibilityModifiers.js]
// No errors
var C = (function () {
function C() {
}
C.privateMethod = function () {
};
Object.defineProperty(C, "privateGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "privateSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
C.protectedMethod = function () {
};
Object.defineProperty(C, "protectedGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "protectedSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
C.publicMethod = function () {
};
Object.defineProperty(C, "publicGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "publicSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
return C;
})();
// Errors, accessibility modifiers must precede static
var D = (function () {
function D() {
}
D.privateMethod = function () {
};
Object.defineProperty(D, "privateGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(D, "privateSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
D.protectedMethod = function () {
};
Object.defineProperty(D, "protectedGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(D, "protectedSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
D.publicMethod = function () {
};
Object.defineProperty(D, "publicGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(D, "publicSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
return D;
})();
// Errors, multiple accessibility modifier
var E = (function () {
function E() {
}
E.prototype.method = function () {
};
Object.defineProperty(E.prototype, "getter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(E.prototype, "setter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
return E;
})();
@@ -0,0 +1,57 @@
//// [accessorWithES3.ts]
// error to use accessors in ES3 mode
class C {
get x() {
return 1;
}
}
class D {
set x(v) {
}
}
var x = {
get a() { return 1 }
}
var y = {
set b(v) { }
}
//// [accessorWithES3.js]
// error to use accessors in ES3 mode
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
get: function () {
return 1;
},
enumerable: true,
configurable: true
});
return C;
})();
var D = (function () {
function D() {
}
Object.defineProperty(D.prototype, "x", {
set: function (v) {
},
enumerable: true,
configurable: true
});
return D;
})();
var x = {
get a() {
return 1;
}
};
var y = {
set b(v) {
}
};
@@ -0,0 +1,27 @@
//// [accessorWithInitializer.ts]
class C {
set X(v = 0) { }
static set X(v2 = 0) { }
}
//// [accessorWithInitializer.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
set: function (v) {
if (v === void 0) { v = 0; }
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "X", {
set: function (v2) {
if (v2 === void 0) { v2 = 0; }
},
enumerable: true,
configurable: true
});
return C;
})();
@@ -0,0 +1,33 @@
//// [accessorWithRestParam.ts]
class C {
set X(...v) { }
static set X(...v2) { }
}
//// [accessorWithRestParam.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
set: function () {
var v = [];
for (var _i = 0; _i < arguments.length; _i++) {
v[_i - 0] = arguments[_i];
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "X", {
set: function () {
var v2 = [];
for (var _i = 0; _i < arguments.length; _i++) {
v2[_i - 0] = arguments[_i];
}
},
enumerable: true,
configurable: true
});
return C;
})();
@@ -0,0 +1,6 @@
//// [accessorWithoutBody1.ts]
var v = { get foo() }
//// [accessorWithoutBody1.js]
var v = { get foo() {
} };
@@ -0,0 +1,6 @@
//// [accessorWithoutBody2.ts]
var v = { set foo(a) }
//// [accessorWithoutBody2.js]
var v = { set foo(a) {
} };
@@ -0,0 +1,33 @@
//// [accessorsAreNotContextuallyTyped.ts]
// accessors are not contextually typed
class C {
set x(v: (a: string) => string) {
}
get x() {
return (x: string) => "";
}
}
var c: C;
var r = c.x(''); // string
//// [accessorsAreNotContextuallyTyped.js]
// accessors are not contextually typed
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
get: function () {
return function (x) { return ""; };
},
set: function (v) {
},
enumerable: true,
configurable: true
});
return C;
})();
var c;
var r = c.x(''); // string
@@ -0,0 +1,49 @@
//// [accessorsEmit.ts]
class Result { }
class Test {
get Property(): Result {
var x = 1;
return null;
}
}
class Test2 {
get Property() {
var x = 1;
return null;
}
}
//// [accessorsEmit.js]
var Result = (function () {
function Result() {
}
return Result;
})();
var Test = (function () {
function Test() {
}
Object.defineProperty(Test.prototype, "Property", {
get: function () {
var x = 1;
return null;
},
enumerable: true,
configurable: true
});
return Test;
})();
var Test2 = (function () {
function Test2() {
}
Object.defineProperty(Test2.prototype, "Property", {
get: function () {
var x = 1;
return null;
},
enumerable: true,
configurable: true
});
return Test2;
})();
@@ -0,0 +1,21 @@
//// [accessorsInAmbientContext.ts]
declare module M {
class C {
get X() { return 1; }
set X(v) { }
static get Y() { return 1; }
static set Y(v) { }
}
}
declare class C {
get X() { return 1; }
set X(v) { }
static get Y() { return 1; }
static set Y(v) { }
}
//// [accessorsInAmbientContext.js]
@@ -0,0 +1,24 @@
//// [accessorsNotAllowedInES3.ts]
class C {
get x(): number { return 1; }
}
var y = { get foo() { return 3; } };
//// [accessorsNotAllowedInES3.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
get: function () {
return 1;
},
enumerable: true,
configurable: true
});
return C;
})();
var y = { get foo() {
return 3;
} };
@@ -0,0 +1,59 @@
//// [accessors_spec_section-4.5_error-cases.ts]
class LanguageSpec_section_4_5_error_cases {
public set AnnotatedSetter_SetterFirst(a: number) { }
public get AnnotatedSetter_SetterFirst() { return ""; }
public get AnnotatedSetter_SetterLast() { return ""; }
public set AnnotatedSetter_SetterLast(a: number) { }
public get AnnotatedGetter_GetterFirst(): string { return ""; }
public set AnnotatedGetter_GetterFirst(aStr) { aStr = 0; }
public set AnnotatedGetter_GetterLast(aStr) { aStr = 0; }
public get AnnotatedGetter_GetterLast(): string { return ""; }
}
//// [accessors_spec_section-4.5_error-cases.js]
var LanguageSpec_section_4_5_error_cases = (function () {
function LanguageSpec_section_4_5_error_cases() {
}
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterFirst", {
get: function () {
return "";
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterLast", {
get: function () {
return "";
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterFirst", {
get: function () {
return "";
},
set: function (aStr) {
aStr = 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterLast", {
get: function () {
return "";
},
set: function (aStr) {
aStr = 0;
},
enumerable: true,
configurable: true
});
return LanguageSpec_section_4_5_error_cases;
})();
@@ -0,0 +1,104 @@
//// [accessors_spec_section-4.5_inference.ts]
class A { }
class B extends A { }
class LanguageSpec_section_4_5_inference {
public set InferredGetterFromSetterAnnotation(a: A) { }
public get InferredGetterFromSetterAnnotation() { return new B(); }
public get InferredGetterFromSetterAnnotation_GetterFirst() { return new B(); }
public set InferredGetterFromSetterAnnotation_GetterFirst(a: A) { }
public get InferredFromGetter() { return new B(); }
public set InferredFromGetter(a) { }
public set InferredFromGetter_SetterFirst(a) { }
public get InferredFromGetter_SetterFirst() { return new B(); }
public set InferredSetterFromGetterAnnotation(a) { }
public get InferredSetterFromGetterAnnotation() : A { return new B(); }
public get InferredSetterFromGetterAnnotation_GetterFirst() : A { return new B(); }
public set InferredSetterFromGetterAnnotation_GetterFirst(a) { }
}
//// [accessors_spec_section-4.5_inference.js]
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 A = (function () {
function A() {
}
return A;
})();
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
})(A);
var LanguageSpec_section_4_5_inference = (function () {
function LanguageSpec_section_4_5_inference() {
}
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation_GetterFirst", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter_SetterFirst", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation_GetterFirst", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
return LanguageSpec_section_4_5_inference;
})();
+68
View File
@@ -0,0 +1,68 @@
//// [aliasErrors.ts]
module foo {
export class Provide {
}
export module bar { export module baz {export class boo {}}}
}
import provide = foo;
import booz = foo.bar.baz;
import beez = foo.bar;
import m = no;
import m2 = no.mod;
import n = 5;
import o = "s";
import q = null;
import r = undefined;
var p = new provide.Provide();
function use() {
beez.baz.boo;
var p1: provide.Provide;
var p2: foo.Provide;
var p3:booz.bar;
var p22 = new provide.Provide();
}
//// [aliasErrors.js]
var foo;
(function (foo) {
var Provide = (function () {
function Provide() {
}
return Provide;
})();
foo.Provide = Provide;
var bar;
(function (bar) {
var baz;
(function (baz) {
var boo = (function () {
function boo() {
}
return boo;
})();
baz.boo = boo;
})(baz = bar.baz || (bar.baz = {}));
})(bar = foo.bar || (foo.bar = {}));
})(foo || (foo = {}));
var provide = foo;
var booz = foo.bar.baz;
var beez = foo.bar;
5;
"s";
null;
var p = new provide.Provide();
function use() {
beez.baz.boo;
var p1;
var p2;
var p3;
var p22 = new provide.Provide();
}
@@ -0,0 +1,33 @@
//// [tests/cases/conformance/ambient/ambientDeclarationsExternal.ts] ////
//// [decls.ts]
// Ambient external module with export assignment
declare module 'equ' {
var x;
export = x;
}
declare module 'equ2' {
var x: number;
}
// Ambient external import declaration referencing ambient external module using top level module name
//// [consumer.ts]
/// <reference path="decls.ts" />
import imp1 = require('equ');
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
import imp3 = require('equ2');
var n = imp3.x;
var n: number;
//// [decls.js]
// Ambient external import declaration referencing ambient external module using top level module name
//// [consumer.js]
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
var imp3 = require('equ2');
var n = imp3.x;
var n;
+11
View File
@@ -0,0 +1,11 @@
//// [ambientEnum1.ts]
declare enum E1 {
y = 4.23
}
// Ambient enum with computer member
declare enum E2 {
x = 'foo'.length
}
//// [ambientEnum1.js]
@@ -0,0 +1,6 @@
//// [ambientEnumElementInitializer3.ts]
declare enum E {
e = 3.3 // Decimal
}
//// [ambientEnumElementInitializer3.js]
@@ -0,0 +1,63 @@
//// [ambientErrors.ts]
// Ambient variable with an initializer
declare var x = 4;
// Ambient functions with invalid overloads
declare function fn(x: number): string;
declare function fn(x: 'foo'): number;
// Ambient functions with duplicate signatures
declare function fn1(x: number): string;
declare function fn1(x: number): string;
// Ambient function overloads that differ only by return type
declare function fn2(x: number): string;
declare function fn2(x: number): number;
// Ambient function with default parameter values
declare function fn3(x = 3);
// Ambient function with function body
declare function fn4() { };
// Ambient enum with non - integer literal constant member
declare enum E1 {
y = 4.23
}
// Ambient enum with computer member
declare enum E2 {
x = 'foo'.length
}
// Ambient module with initializers for values, bodies for functions / classes
declare module M1 {
var x = 3;
function fn() { }
class C {
static x = 3;
y = 4;
constructor() { }
fn() { }
static sfn() { }
}
}
// Ambient external module not in the global module
module M2 {
declare module 'nope' { }
}
// Ambient external module with a string literal name that isn't a top level external module name
declare module '../foo' { }
// Ambient external module with export assignment and other exported members
declare module 'bar' {
var n;
export var q;
export = n;
}
//// [ambientErrors.js]
;
@@ -0,0 +1,4 @@
//// [ambientErrors1.ts]
declare var x = 4;
//// [ambientErrors1.js]
@@ -0,0 +1,11 @@
//// [ambientGetters.ts]
declare class A {
get length() : number;
}
declare class B {
get length() { return 0; }
}
//// [ambientGetters.js]

Some files were not shown because too many files have changed in this diff Show More