From a0bb3a3d17defd244b880997249817803db32f84 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Thu, 12 Mar 2020 19:31:52 +0100 Subject: [PATCH] :bug: Few fixes --- src/parse/scan1.c | 9 ++++++--- src/parse/scan2.c | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 7b4c8ab8..2dd7e817 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -272,13 +272,16 @@ ANN m_bool scan1_enum_def(const Env env, const Enum_Def edef) { return GW_OK; } -ANN static Value arg_value(MemPool p, const Arg_List list) { +ANN static Value arg_value(const Env env, const Arg_List list) { const Var_Decl var = list->var_decl; - const Value v = new_value(p, list->type, var->xid ? s_name(var->xid) : (m_str)__func__); + const Value v = new_value(env->gwion->mp, list->type, var->xid ? s_name(var->xid) : (m_str)__func__); + if(var->array) + v->type = /*list->type = */array_type(env, list->type, var->array->depth); if(list->td) v->flag = list->td->flag | ae_flag_arg; return v; } + ANN static m_bool scan1_args(const Env env, Arg_List list) { do { const Var_Decl var = list->var_decl; @@ -286,7 +289,7 @@ ANN static m_bool scan1_args(const Env env, Arg_List list) { CHECK_BB(isres(env, var->xid, var->pos)) if(list->td) CHECK_OB((list->type = void_type(env, list->td))) - var->value = arg_value(env->gwion->mp, list); + var->value = arg_value(env, list); nspc_add_value(env->curr, var->xid, var->value); } while((list = list->next)); return GW_OK; diff --git a/src/parse/scan2.c b/src/parse/scan2.c index ec8b2f5e..c692a813 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -42,8 +42,9 @@ ANN static m_bool scan2_args(const Env env, const Func_Def f) { Arg_List list = f->base->args; do { const Var_Decl var = list->var_decl; - if(var->array) - list->type = array_type(env, list->type, var->array->depth); + if(var->array) { + var->value->type = list->type = array_type(env, list->type, var->array->depth); + } var->value->from->offset = f->stack_depth; f->stack_depth += list->type->size; } while((list = list->next)); -- 2.43.0