support calling gen.run from inside of a running generator

master
Vitaliy Filippov 2016-08-16 17:31:54 +03:00
parent 7912f93f13
commit 1c37869e60
1 changed files with 2 additions and 1 deletions

View File

@ -64,6 +64,7 @@ function callGen(thread, method, arg)
return;
}
var v;
var prev = current;
thread._running = true;
current = thread;
try
@ -86,7 +87,7 @@ function callGen(thread, method, arg)
v = { error: e };
}
thread._running = false;
current = null;
current = prev;
if (v.done || v.error)
{
// generator finished