Skip to content

Commit 8558d64

Browse files
committed
Temporarily disallow for-of statements
1 parent 7cb2a64 commit 8558d64

49 files changed

Lines changed: 160 additions & 154 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/compiler/checker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10786,6 +10786,8 @@ module ts {
1078610786
}
1078710787

1078810788
function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean {
10789+
// Temporarily disallow for-of statements until type check work is complete.
10790+
return grammarErrorOnFirstToken(forOfStatement, Diagnostics.For_of_statements_are_not_currently_supported);
1078910791
if (checkGrammarForInOrForOfStatement(forOfStatement)) {
1079010792
return true;
1079110793
}

src/compiler/diagnosticInformationMap.generated.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ module ts {
316316
Property_0_does_not_exist_on_const_enum_1: { code: 2475, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." },
317317
let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2476, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." },
318318
Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2477, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." },
319-
For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "For-of statements are only available when targeting ECMAScript 6 or higher" },
319+
For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "For...of statements are only available when targeting ECMAScript 6 or higher." },
320320
The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." },
321321
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
322322
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}'." },
@@ -463,5 +463,6 @@ module ts {
463463
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
464464
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
465465
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." },
466+
For_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "For...of statements are not currently supported." },
466467
};
467468
}

src/compiler/diagnosticMessages.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@
12561256
"category": "Error",
12571257
"code": 2477
12581258
},
1259-
"For-of statements are only available when targeting ECMAScript 6 or higher": {
1259+
"For...of statements are only available when targeting ECMAScript 6 or higher.": {
12601260
"category": "Error",
12611261
"code": 2482
12621262
},
@@ -1845,5 +1845,9 @@
18451845
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
18461846
"category": "Error",
18471847
"code": 9002
1848+
},
1849+
"For...of statements are not currently supported.": {
1850+
"category": "Error",
1851+
"code": 9003
18481852
}
18491853
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts.
1+
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS9003: For...of statements are not currently supported.
22

33

44
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ====
55
for (var i of e) {
66
~~~
7-
!!! error TS1036: Statements are not allowed in ambient contexts.
7+
!!! error TS9003: For...of statements are not currently supported.
88
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
2-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,6): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
1+
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS9003: For...of statements are not currently supported.
32

43

5-
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (2 errors) ====
4+
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (1 errors) ====
65
for (const v of X) {
76
~~~
8-
!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
9-
~~~~~
10-
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
7+
!!! error TS9003: For...of statements are not currently supported.
118
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
2-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,6): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
1+
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS9003: For...of statements are not currently supported.
32

43

5-
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (2 errors) ====
4+
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (1 errors) ====
65
for (const [a, b] of X) {
76
~~~
8-
!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
9-
~~~~~
10-
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
7+
!!! error TS9003: For...of statements are not currently supported.
118
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
2-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,6): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
1+
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS9003: For...of statements are not currently supported.
32

43

5-
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (2 errors) ====
4+
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (1 errors) ====
65
for (const {a, b} of X) {
76
~~~
8-
!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
9-
~~~~~
10-
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
7+
!!! error TS9003: For...of statements are not currently supported.
118
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
2-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,6): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
1+
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS9003: For...of statements are not currently supported.
32

43

5-
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (2 errors) ====
4+
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (1 errors) ====
65
for (let {a, b} of X) {
76
~~~
8-
!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
9-
~~~
10-
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
7+
!!! error TS9003: For...of statements are not currently supported.
118
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
2-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,6): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
1+
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS9003: For...of statements are not currently supported.
32

43

5-
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (2 errors) ====
4+
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (1 errors) ====
65
for (let [a, b] of X) {
76
~~~
8-
!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
9-
~~~
10-
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
7+
!!! error TS9003: For...of statements are not currently supported.
118
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
1+
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS9003: For...of statements are not currently supported.
22

33

44
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts (1 errors) ====
55
for (var [a, b] of X) {
66
~~~
7-
!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
7+
!!! error TS9003: For...of statements are not currently supported.
88
}

0 commit comments

Comments
 (0)