mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Disallow return expressions in a generator
This commit is contained in:
@@ -9720,6 +9720,9 @@ module ts {
|
||||
if (func.kind === SyntaxKind.SetAccessor) {
|
||||
error(node.expression, Diagnostics.Setters_cannot_return_a_value);
|
||||
}
|
||||
else if (func.asteriskToken) {
|
||||
error(node.expression, Diagnostics.A_return_statement_cannot_specify_a_value_in_a_generator_function);
|
||||
}
|
||||
else {
|
||||
if (func.kind === SyntaxKind.Constructor) {
|
||||
if (!isTypeAssignableTo(exprType, returnType)) {
|
||||
|
||||
@@ -366,6 +366,7 @@ module ts {
|
||||
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
|
||||
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
|
||||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
A_return_statement_cannot_specify_a_value_in_a_generator_function: { code: 2502, category: DiagnosticCategory.Error, key: "A return statement cannot specify a value in a generator function." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
|
||||
@@ -1453,6 +1453,10 @@
|
||||
"category": "Error",
|
||||
"code": 2501
|
||||
},
|
||||
"A return statement cannot specify a value in a generator function.": {
|
||||
"category": "Error",
|
||||
"code": 2502
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
||||
Reference in New Issue
Block a user