TypeScript/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts
2015-10-13 11:17:10 -07:00

48 lines
605 B
TypeScript

// @allowUnreachableCode: true
function fn(x) {
throw x;
}
<T>(x: T) => { throw x; }
var y: string;
switch (y) {
case 'a':
throw y;
default:
throw y;
}
var z = 0;
while (z < 10) {
throw z;
}
for (var i = 0; ;) { throw i; }
for (var idx in {}) { throw idx; }
do { throw null; }while(true)
var j = 0;
while (j < 0) { throw j; }
class C<T> {
private value: T;
biz() {
throw this.value;
}
constructor() {
throw this;
}
}
var aa = {
id:12,
biz() {
throw this;
}
}