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
function f() { const b = 0; switch (1) { case b = 0: } } var err; try { f(); } catch(e) { err = e; } assertEq(err.name, "TypeError"); function g() { const z = 0; while (z = 1) {} } err = null; try { g(); } catch(e) { err = e; } assertEq(err.name, "TypeError");