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.
29 lines
480 B
29 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);
|
|
}
|
|
|