starlight
starlight copied to clipboard
Support for "unsafe" cases of `finally`
Starlight needs support for code like this:
function foo() {
try {
return 1;
} finally {
return 2;
}
}
Right now it returns 1 but should return 2.
MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch#the_finally-block
Problem with implementing it is we down break and continue to single jumps which means finally can't be executed correctly and return is lowered to OP_RET which instantly returns, there could be one way to just jump to finally block on continue,break and return but this will not work as expected.