58 lines
No EOL
2.3 KiB
Text
58 lines
No EOL
2.3 KiB
Text
tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement.
|
|
tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(8,9): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
|
tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary.
|
|
tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary.
|
|
tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
|
tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(36,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
|
|
|
|
|
==== tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.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:
|
|
for(;;) break TWO;
|
|
~~~~~~~~~~
|
|
!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
|
|
|
// break from inside function
|
|
TWO:
|
|
for(;;) {
|
|
var x = () => {
|
|
break TWO;
|
|
~~~~~~~~~~
|
|
!!! error TS1107: Jump target cannot cross function boundary.
|
|
}
|
|
}
|
|
|
|
THREE:
|
|
for(;;) {
|
|
var fn = function () {
|
|
break THREE;
|
|
~~~~~~~~~~~~
|
|
!!! error TS1107: Jump target cannot cross function boundary.
|
|
}
|
|
}
|
|
|
|
// break forward
|
|
for(;;) {
|
|
break FIVE;
|
|
~~~~~~~~~~~
|
|
!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
|
FIVE:
|
|
for (; ;) { }
|
|
}
|
|
// label on non-loop statement
|
|
NINE:
|
|
var y = 12;
|
|
|
|
for(;;) {
|
|
break NINE;
|
|
~~~~~~~~~~~
|
|
!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
|
} |