51 lines
No EOL
1.3 KiB
Text
51 lines
No EOL
1.3 KiB
Text
==== tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts (6 errors) ====
|
|
// All errors
|
|
|
|
// naked break not allowed
|
|
break;
|
|
~~~~~~
|
|
!!! A 'break' statement can only be used within an enclosing iteration or switch statement.
|
|
|
|
// non-existent label
|
|
ONE:
|
|
do break TWO; while (true)
|
|
~~~~~~~~~~
|
|
!!! A 'break' statement can only jump to a label of an enclosing statement.
|
|
|
|
// break from inside function
|
|
TWO:
|
|
do {
|
|
var x = () => {
|
|
break TWO;
|
|
~~~~~~~~~~
|
|
!!! Jump target cannot cross function boundary.
|
|
}
|
|
}while (true)
|
|
|
|
THREE:
|
|
do {
|
|
var fn = function () {
|
|
break THREE;
|
|
~~~~~~~~~~~~
|
|
!!! Jump target cannot cross function boundary.
|
|
}
|
|
}while (true)
|
|
|
|
// break forward
|
|
do {
|
|
break FIVE;
|
|
~~~~~~~~~~~
|
|
!!! A 'break' statement can only jump to a label of an enclosing statement.
|
|
FIVE:
|
|
do { } while (true)
|
|
}while (true)
|
|
|
|
// label on non-loop statement
|
|
NINE:
|
|
var y = 12;
|
|
|
|
do {
|
|
break NINE;
|
|
~~~~~~~~~~~
|
|
!!! A 'break' statement can only jump to a label of an enclosing statement.
|
|
}while (true) |