1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-25 07:50:27 +00:00

Fix yields inside nested fibers.

This commit is contained in:
Calvin Rose 2023-05-23 20:08:57 -05:00
parent 71bde11e95
commit 909c906080
2 changed files with 8 additions and 0 deletions

View File

@ -1423,6 +1423,7 @@ static JanetSignal janet_continue_no_check(JanetFiber *fiber, Janet in, Janet *o
if (sig != JANET_SIGNAL_OK && !(child->flags & (1 << sig))) {
*out = in;
janet_fiber_set_status(fiber, sig);
fiber->last_value = child->last_value;
return sig;
}
/* Check if we need any special handling for certain opcodes */

View File

@ -360,4 +360,11 @@
(assert (= (or 1) 1) "or 1")
(assert (= (or) nil) "or with no arguments")
(def yielder
(coro
(defer (yield :end)
(repeat 5 (yield :item)))))
(def items (seq [x :in yielder] x))
(assert (deep= @[:item :item :item :item :item :end] items) "yield within nested fibers")
(end-suite)