1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement.
tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(8,4): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary.
tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary.
tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(37,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
==== tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts (6 errors) ====
// All errors
// naked break not allowed
break;
~~~~~~
!!! error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement.
// non-existent label
ONE:
do break TWO; while (true)
~~~~~~~~~~
!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
// break from inside function
TWO:
do {
var x = () => {
break TWO;
~~~~~~~~~~
!!! error TS1107: Jump target cannot cross function boundary.
}
}while (true)
THREE:
do {
var fn = function () {
break THREE;
~~~~~~~~~~~~
!!! error TS1107: Jump target cannot cross function boundary.
}
}while (true)
// break forward
do {
break FIVE;
~~~~~~~~~~~
!!! error TS1116: 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;
~~~~~~~~~~~
!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
}while (true)
|