From 68a12d1d17550716ca7b5b4876a27d6cbbd4caa3 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Fri, 3 Jul 2020 20:41:55 -0500 Subject: [PATCH] Minor fixes for meson minimum build. Also, fix regression that looses function name information. --- src/core/compile.c | 6 +++--- src/core/specials.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/compile.c b/src/core/compile.c index f7f8bfa0..57c9cbe2 100644 --- a/src/core/compile.c +++ b/src/core/compile.c @@ -722,6 +722,8 @@ void janet_def_addflags(JanetFuncDef *def) { } /* Compile a funcdef */ +/* Once the various other settings of the FuncDef have been tweaked, + * call janet_def_addflags to set the proper flags for the funcdef */ JanetFuncDef *janetc_pop_funcdef(JanetCompiler *c) { JanetScope *scope = c->scope; JanetFuncDef *def = janet_funcdef_alloc(); @@ -789,9 +791,6 @@ JanetFuncDef *janetc_pop_funcdef(JanetCompiler *c) { /* Pop the scope */ janetc_popscope(c); - /* Finalize some flags */ - janet_def_addflags(def); - return def; } @@ -843,6 +842,7 @@ JanetCompileResult janet_compile(Janet source, JanetTable *env, const uint8_t *w if (c.result.status == JANET_COMPILE_OK) { JanetFuncDef *def = janetc_pop_funcdef(&c); def->name = janet_cstring("_thunk"); + janet_def_addflags(def); c.result.funcdef = def; } else { c.result.error_mapping = c.current_mapping; diff --git a/src/core/specials.c b/src/core/specials.c index 56b3ae17..d2940dcf 100644 --- a/src/core/specials.c +++ b/src/core/specials.c @@ -649,6 +649,7 @@ static JanetSlot janetc_while(JanetFopts opts, int32_t argn, const Janet *argv) /* Compile function */ JanetFuncDef *def = janetc_pop_funcdef(c); def->name = janet_cstring("_while"); + janet_def_addflags(def); int32_t defindex = janetc_addfuncdef(c, def); /* And then load the closure and call it. */ int32_t cloreg = janetc_regalloc_temp(&c->scope->ra, JANETC_REGTEMP_0); @@ -823,6 +824,7 @@ static JanetSlot janetc_fn(JanetFopts opts, int32_t argn, const Janet *argv) { if (structarg) def->flags |= JANET_FUNCDEF_FLAG_STRUCTARG; if (selfref) def->name = janet_unwrap_symbol(head); + janet_def_addflags(def); defindex = janetc_addfuncdef(c, def); /* Ensure enough slots for vararg function. */