Remove error disallowing for...of loops

This commit is contained in:
Jason Freeman 2015-02-19 16:36:48 -08:00
parent 7b22880ba3
commit b6a4987103
39 changed files with 59 additions and 145 deletions

View File

@ -11246,8 +11246,6 @@ module ts {
}
function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean {
// Temporarily disallow for-of statements until type check work is complete.
return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_not_currently_supported);
if (languageVersion < ScriptTarget.ES6) {
return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher);
}

View File

@ -471,6 +471,5 @@ module ts {
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." },
for_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'for...of' statements are not currently supported." },
};
}

View File

@ -1877,9 +1877,5 @@
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
"category": "Error",
"code": 9002
},
"'for...of' statements are not currently supported.": {
"category": "Error",
"code": 9003
}
}

View File

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

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (1 errors) ====
for (const v of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

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

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (1 errors) ====
for (const {a, b} of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (1 errors) ====
for (let {a, b} of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts (1 errors) ====
for (var of of of) { }
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (1 errors) ====
for (var of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

@ -1,7 +1,7 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (1 errors) ====
for (var of of) { }
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.

View File

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

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ====
for (var a = 1 of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ====
for (var a: number of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ====
for (var a = 1, b = 2 of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ====
for (var a: number = 1, b: string = "" of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts (1 errors) ====
for (var v of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts (1 errors) ====
for (let v of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts (1 errors) ====
for (var i of e) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS1036: Statements are not allowed in ambient contexts.
}

View File

@ -1,8 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts (1 errors) ====
for (const v of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
}

View File

@ -1,8 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts (1 errors) ====
for (const [a, b] of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
}

View File

@ -1,8 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts (1 errors) ====
for (const {a, b} of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
}

View File

@ -1,8 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts (1 errors) ====
for (let {a, b} of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
}

View File

@ -1,8 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts (1 errors) ====
for (let [a, b] of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
}

View File

@ -1,8 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts (1 errors) ====
for (var [a, b] of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
}

View File

@ -1,8 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts (1 errors) ====
for (var {a, b} of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
}

View File

@ -1,7 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts (1 errors) ====
for (var of of of) { }
~~~
!!! error TS9003: 'for...of' statements are not currently supported.

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,9): error TS1123: Variable declaration list cannot be empty.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts (1 errors) ====
for (var of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS1123: Variable declaration list cannot be empty.
}

View File

@ -1,7 +1,7 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,9): error TS1123: Variable declaration list cannot be empty.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts (1 errors) ====
for (var of of) { }
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
!!! error TS1123: Variable declaration list cannot be empty.

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
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 TS9003: 'for...of' statements are not currently supported.
~
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts (1 errors) ====
for (var a = 1 of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
~
!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts (1 errors) ====
for (var a: number of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
~
!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
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 TS9003: 'for...of' statements are not currently supported.
~
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
}

View File

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
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 TS9003: 'for...of' statements are not currently supported.
~
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
}

View File

@ -1,8 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts (1 errors) ====
for (var v of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
}

View File

@ -1,8 +0,0 @@
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported.
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts (1 errors) ====
for (let v of X) {
~~~
!!! error TS9003: 'for...of' statements are not currently supported.
}