From f1f98f3a2a022569111f9798e630fce1b2c71e40 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sat, 24 Aug 2019 15:33:51 +0200 Subject: [PATCH] :bug: Fex bug fixes [AFL] --- src/parse/cpy_ast.c | 3 ++- src/parse/scan1.c | 2 +- src/parse/scan2.c | 3 +-- src/parse/type_decl.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parse/cpy_ast.c b/src/parse/cpy_ast.c index c91ee089..84e3e492 100644 --- a/src/parse/cpy_ast.c +++ b/src/parse/cpy_ast.c @@ -70,7 +70,8 @@ ANN static ID_List cpy_id_list(MemPool p, const ID_List src) { a->xid = src->xid; // 1 if(src->next) a->next = cpy_id_list(p, src->next); // 1 - a->pos = loc_cpy(p, src->pos); // 1 + if(src->pos) + a->pos = loc_cpy(p, src->pos); // 1 return a; } diff --git a/src/parse/scan1.c b/src/parse/scan1.c index bf3e6bda..71605cad 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -98,7 +98,7 @@ ANN m_bool scan1_exp_decl(const Env env, const Exp_Decl* decl) { CHECK_BB(scan1_exp(env, var->array->exp)) } t = array_type(env, decl->type, var->array->depth); - } else if(GET_FLAG(t, abstract) && !GET_FLAG(decl->td, ref)) + } else if(GET_FLAG(t, abstract) && !GET_FLAG(decl->td, ref)) ERR_B(exp_self(decl)->pos, _("Type '%s' is abstract, declare as ref. (use @)"), t->name) CHECK_OB(prim_ref(env, t, decl->td)) //assert(!var->value); diff --git a/src/parse/scan2.c b/src/parse/scan2.c index af3dba5d..1a233f7c 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -320,8 +320,7 @@ ANN2(1,2) static Value func_value(const Env env, const Func f, if(!overload) { ADD_REF(v); nspc_add_value(env->curr, f->def->base->xid, v); - } else { - assert(overload->d.func_ref); + } else if(overload->d.func_ref) { f->next = overload->d.func_ref->next; overload->d.func_ref->next = f; } diff --git a/src/parse/type_decl.c b/src/parse/type_decl.c index dc1ce66e..0d21cd66 100644 --- a/src/parse/type_decl.c +++ b/src/parse/type_decl.c @@ -68,7 +68,7 @@ ANN static inline void* type_unknown(const Env env, const ID_List id) { ANN Type prim_ref(const Env env, const Type t, const Type_Decl* td) { if(GET_FLAG(td, ref) && isa(t, t_object) < 0 && isa(t, t_class) < 0) - ERR_O(td->xid->pos, _("primitive types cannot be used as reference (@)...\n")) + ERR_O(td_pos(td), _("primitive types cannot be used as reference (@)...\n")) return t; } -- 2.43.0