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.

30 lines
480 B

/*
* Constructor calls currently prevent a yield.
*/
/*===
coroutine start
123
TypeError
===*/
var thr;
function Foo() {
Duktape.Thread.yield(123);
}
function coroutine() {
print('coroutine start');
Foo(); // works, not a constructor call
new Foo(); // not allowed currently -> TypeError
}
try {
thr = new Duktape.Thread(coroutine);
print(Duktape.Thread.resume(thr));
print(Duktape.Thread.resume(thr));
} catch (e) {
print(e.name);
}