mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Fork grammar message into two messages
This commit is contained in:
parent
8d0829594c
commit
cc81a670ac
@ -10764,8 +10764,10 @@ module ts {
|
||||
var variableList = <VariableDeclarationList>forInOrOfStatement.initializer;
|
||||
if (!checkGrammarVariableDeclarationList(variableList)) {
|
||||
if (variableList.declarations.length > 1) {
|
||||
var keywordText = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? "in" : "of";
|
||||
return grammarErrorOnFirstToken(variableList.declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_0_statement, keywordText);
|
||||
var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ?
|
||||
Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement :
|
||||
Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
|
||||
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ module ts {
|
||||
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_0_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...{0}' statement." },
|
||||
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." },
|
||||
@ -147,6 +147,7 @@ module ts {
|
||||
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." },
|
||||
A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." },
|
||||
Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...of' statement." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
|
||||
@ -211,7 +211,7 @@
|
||||
"category": "Error",
|
||||
"code": 1090
|
||||
},
|
||||
"Only a single variable declaration is allowed in a 'for...{0}' statement.": {
|
||||
"Only a single variable declaration is allowed in a 'for...in' statement.": {
|
||||
"category": "Error",
|
||||
"code": 1091
|
||||
},
|
||||
@ -579,6 +579,10 @@
|
||||
"category": "Error",
|
||||
"code": 1187
|
||||
},
|
||||
"Only a single variable declaration is allowed in a 'for...of' statement.": {
|
||||
"category": "Error",
|
||||
"code": 1188
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,13): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ====
|
||||
for (var a, b of X) {
|
||||
~
|
||||
!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,17): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ====
|
||||
for (var a = 1, b = 2 of X) {
|
||||
~
|
||||
!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ====
|
||||
for (var a: number = 1, b: string = "" of X) {
|
||||
~
|
||||
!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,13): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts (1 errors) ====
|
||||
for (var a, b of X) {
|
||||
~
|
||||
!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,17): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts (1 errors) ====
|
||||
for (var a = 1, b = 2 of X) {
|
||||
~
|
||||
!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts (1 errors) ====
|
||||
for (var a: number = 1, b: string = "" of X) {
|
||||
~
|
||||
!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user