mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
574 B
35 lines
574 B
12 years ago
|
/*===
|
||
|
closure throw
|
||
12 years ago
|
123
|
||
12 years ago
|
closure throw
|
||
12 years ago
|
123
|
||
12 years ago
|
closure throw
|
||
|
===*/
|
||
|
|
||
|
/* This was broken at an early point. Catch binding variable would be mapped
|
||
|
* to a certain register for the duration of the catch clause. A closure
|
||
|
* created from the catch clause would work incorrectly once the original
|
||
|
* invocation exited the catch clause.
|
||
|
*/
|
||
|
|
||
|
function f() {
|
||
|
var e = 123;
|
||
|
var func;
|
||
|
|
||
|
try {
|
||
|
throw 'throw';
|
||
|
} catch (e) {
|
||
|
func = function() { print('closure', e); }
|
||
|
func();
|
||
|
}
|
||
|
|
||
12 years ago
|
print(e);
|
||
12 years ago
|
func();
|
||
12 years ago
|
print(e);
|
||
12 years ago
|
|
||
|
return func;
|
||
|
}
|
||
|
|
||
|
f()();
|
||
|
|