1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-27 00:40:26 +00:00

ev/call uses current env as prototype of environment.

This commit is contained in:
Calvin Rose 2020-11-26 21:13:41 -06:00
parent 6c43489fb2
commit ca7c5b8b10

View File

@ -1684,7 +1684,8 @@ static Janet cfun_ev_call(int32_t argc, Janet *argv) {
janet_arity(argc, 1, -1); janet_arity(argc, 1, -1);
JanetFunction *fn = janet_getfunction(argv, 0); JanetFunction *fn = janet_getfunction(argv, 0);
JanetFiber *fiber = janet_fiber(fn, 64, argc - 1, argv + 1); 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]); if (NULL == fiber) janet_panicf("invalid arity to function %v", argv[0]);
janet_schedule(fiber, janet_wrap_nil()); janet_schedule(fiber, janet_wrap_nil());
return janet_wrap_fiber(fiber); return janet_wrap_fiber(fiber);