Skip to content

Commit b6a4987

Browse files
committed
Remove error disallowing for...of loops
1 parent 7b22880 commit b6a4987

39 files changed

Lines changed: 59 additions & 145 deletions

src/compiler/checker.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11246,8 +11246,6 @@ module ts {
1124611246
}
1124711247

1124811248
function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean {
11249-
// Temporarily disallow for-of statements until type check work is complete.
11250-
return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_not_currently_supported);
1125111249
if (languageVersion < ScriptTarget.ES6) {
1125211250
return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher);
1125311251
}

src/compiler/diagnosticInformationMap.generated.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,5 @@ module ts {
471471
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
472472
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
473473
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." },
474-
for_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'for...of' statements are not currently supported." },
475474
};
476475
}

src/compiler/diagnosticMessages.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,9 +1877,5 @@
18771877
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
18781878
"category": "Error",
18791879
"code": 9002
1880-
},
1881-
"'for...of' statements are not currently supported.": {
1882-
"category": "Error",
1883-
"code": 9003
18841880
}
18851881
}
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 TS9003: 'for...of' statements are not currently supported.
1+
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
22

33

44
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ====
55
for (var i of e) {
66
~~~
7-
!!! error TS9003: 'for...of' statements are not currently supported.
7+
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
88
}
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/parserES5ForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
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.
22

33

44
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (1 errors) ====
55
for (const v of X) {
66
~~~
7-
!!! error TS9003: 'for...of' statements are not currently supported.
7+
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
88
}
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/parserES5ForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
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.
22

33

44
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (1 errors) ====
55
for (const [a, b] of X) {
66
~~~
7-
!!! error TS9003: 'for...of' statements are not currently supported.
7+
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
88
}
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/parserES5ForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
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.
22

33

44
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (1 errors) ====
55
for (const {a, b} of X) {
66
~~~
7-
!!! error TS9003: 'for...of' statements are not currently supported.
7+
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
88
}
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/parserES5ForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
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.
22

33

44
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (1 errors) ====
55
for (let {a, b} of X) {
66
~~~
7-
!!! error TS9003: 'for...of' statements are not currently supported.
7+
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
88
}
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/parserES5ForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
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.
22

33

44
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (1 errors) ====
55
for (let [a, b] of X) {
66
~~~
7-
!!! error TS9003: 'for...of' statements are not currently supported.
7+
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
88
}
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 TS9003: 'for...of' statements are not currently supported.
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.
22

33

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

0 commit comments

Comments
 (0)