-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow initializers in for-in and for-of loops
- Loading branch information
1 parent
f7a6354
commit 147cc20
Showing
10 changed files
with
45 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
tests/baselines/reference/parserES5ForOfStatement20.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. | ||
|
||
|
||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts (1 errors) ==== | ||
for (var of = 0 in of) { } | ||
~~ | ||
!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. |
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
tests/baselines/reference/parserES5ForOfStatement4.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
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,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. | ||
|
||
|
||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== | ||
for (var a = 1 of X) { | ||
~~~ | ||
!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher | ||
~ | ||
This comment has been minimized.
Sorry, something went wrong. |
||
!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. | ||
tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,19): error TS2304: Cannot find name 'X'. | ||
|
||
|
||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (1 errors) ==== | ||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (2 errors) ==== | ||
for (var a = 1 in X) { | ||
~ | ||
!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. | ||
~ | ||
!!! error TS2304: Cannot find name 'X'. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. | ||
|
||
|
||
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts (1 errors) ==== | ||
for (var of = 0 in of) { } | ||
~~ | ||
!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
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 TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. | ||
} |
align