From ca7c5b8b10d28e1351598e24567e990e3e1564f2 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Thu, 26 Nov 2020 21:13:41 -0600 Subject: [PATCH] ev/call uses current env as prototype of environment. --- src/core/ev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ev.c b/src/core/ev.c index 9d7d7d8c..70a5f254 100644 --- a/src/core/ev.c +++ b/src/core/ev.c @@ -1684,7 +1684,8 @@ static Janet cfun_ev_call(int32_t argc, Janet *argv) { janet_arity(argc, 1, -1); JanetFunction *fn = janet_getfunction(argv, 0); JanetFiber *fiber = janet_fiber(fn, 64, argc - 1, argv + 1); - fiber->env = janet_current_fiber()->env; + fiber->env = janet_table(0); + fiber->env->proto = janet_current_fiber()->env; if (NULL == fiber) janet_panicf("invalid arity to function %v", argv[0]); janet_schedule(fiber, janet_wrap_nil()); return janet_wrap_fiber(fiber);