2014-07-24 21:36:10 +02:00
|
|
|
==== tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts (6 errors) ====
|
2014-07-23 01:36:53 +02:00
|
|
|
// All errors
|
|
|
|
|
|
|
|
// naked continue not allowed
|
|
|
|
continue;
|
2014-07-24 21:36:10 +02:00
|
|
|
~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement.
|
2014-07-23 01:36:53 +02:00
|
|
|
|
|
|
|
// non-existent label
|
|
|
|
ONE:
|
|
|
|
for (var x in {}) continue TWO;
|
2014-07-24 21:36:10 +02:00
|
|
|
~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement.
|
2014-07-23 01:36:53 +02:00
|
|
|
|
|
|
|
// continue from inside function
|
|
|
|
TWO:
|
|
|
|
for (var x in {}) {
|
|
|
|
var fn = () => {
|
|
|
|
continue TWO;
|
2014-07-24 21:36:10 +02:00
|
|
|
~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1107: Jump target cannot cross function boundary.
|
2014-07-23 01:36:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
THREE:
|
|
|
|
for (var x in {}) {
|
|
|
|
var fn = function () {
|
|
|
|
continue THREE;
|
2014-07-24 21:36:10 +02:00
|
|
|
~~~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1107: Jump target cannot cross function boundary.
|
2014-07-23 01:36:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// continue forward
|
|
|
|
for (var x in {}) {
|
|
|
|
continue FIVE;
|
2014-07-24 21:36:10 +02:00
|
|
|
~~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement.
|
2014-07-23 01:36:53 +02:00
|
|
|
FIVE:
|
|
|
|
for (var x in {}) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
// label on non-loop statement
|
|
|
|
NINE:
|
|
|
|
var y = 12;
|
|
|
|
|
|
|
|
for (var x in {}) {
|
|
|
|
continue NINE;
|
2014-07-24 21:36:10 +02:00
|
|
|
~~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement.
|
2014-07-23 01:36:53 +02:00
|
|
|
}
|