mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 19:19:53 +00:00
Fix yields inside nested fibers.
This commit is contained in:
parent
71bde11e95
commit
909c906080
@ -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))) {
|
if (sig != JANET_SIGNAL_OK && !(child->flags & (1 << sig))) {
|
||||||
*out = in;
|
*out = in;
|
||||||
janet_fiber_set_status(fiber, sig);
|
janet_fiber_set_status(fiber, sig);
|
||||||
|
fiber->last_value = child->last_value;
|
||||||
return sig;
|
return sig;
|
||||||
}
|
}
|
||||||
/* Check if we need any special handling for certain opcodes */
|
/* Check if we need any special handling for certain opcodes */
|
||||||
|
@ -360,4 +360,11 @@
|
|||||||
(assert (= (or 1) 1) "or 1")
|
(assert (= (or 1) 1) "or 1")
|
||||||
(assert (= (or) nil) "or with no arguments")
|
(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)
|
(end-suite)
|
||||||
|
Loading…
Reference in New Issue
Block a user