1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 07:33:01 +00:00

Allow yielding by transfering to nil

This commit is contained in:
Calvin Rose
2017-07-01 11:22:10 -04:00
parent 957a513fd6
commit 171c0ce49e
2 changed files with 12 additions and 0 deletions

View File

@@ -359,6 +359,9 @@ int gst_continue(Gst *vm) {
v1 = stack[pc[3]]; /* The value to pass in */
if (temp.type != GST_THREAD && temp.type != GST_NIL)
gst_error(vm, "expected thread");
if (temp.type == GST_NIL && vm->thread->parent) {
temp = gst_wrap_thread(vm->thread->parent);
}
if (temp.type == GST_THREAD) {
if (temp.data.thread->status == GST_THREAD_DEAD ||
temp.data.thread->status == GST_THREAD_ERROR)