From 5f422b00065cf82b30998aa75eecb373cc90b6e4 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Fri, 6 Sep 2019 09:21:34 +0200 Subject: [PATCH] :bug: Again with an AFL session --- src/lib/tuple.c | 4 ++-- src/parse/check.c | 8 +++++--- src/parse/scan1.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/tuple.c b/src/lib/tuple.c index 1eb9158d..54f5417a 100644 --- a/src/lib/tuple.c +++ b/src/lib/tuple.c @@ -141,8 +141,8 @@ static OP_CHECK(opck_at_tuple) { int i = 0; do { if(e->exp_type == ae_exp_decl) { - e->d.exp_decl.td->xid->xid = insert_symbol(//could be better - ((Type)VPTR(&bin->lhs->type->e->tuple->types, i))->name); + DECL_OO(const Type, t, = (Type)VPTR(&bin->lhs->type->e->tuple->types, i)) + e->d.exp_decl.td->xid->xid = insert_symbol(t->name); CHECK_BO(traverse_decl(env, &e->d.exp_decl)) } ++i; diff --git a/src/parse/check.c b/src/parse/check.c index 56585ad5..f71804c3 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -516,7 +516,9 @@ ANN static m_bool check_call(const Env env, const Exp_Call* exp) { if(et != ae_exp_primary && et != ae_exp_dot && et != ae_exp_cast) ERR_B(exp->func->pos, _("invalid expression for function call.")) CHECK_OB(check_exp(env, exp->func)) - return exp->args ? !!check_exp(env, exp->args) : GW_OK; + if(exp->args) + CHECK_OB(check_exp(env, exp->args)) + return GW_OK; } ANN static inline Value template_get_ready(const Env env, const Value v, const m_str tmpl, const m_uint i) { @@ -835,9 +837,9 @@ ANN static Type check_exp_call(const Env env, Exp_Call* exp) { const Type t = actual_type(exp->func->type); const Value v = nspc_lookup_value1(t->e->owner, insert_symbol(t->name)); assert(v); - if(!GET_FLAG(v, func) && !GET_FLAG(exp->func->type, func)) + if(!GET_FLAG(v, func) && !GET_FLAG(exp->func->type, func) ) ERR_O(exp_self(exp)->pos, _("template call of non-function value.")) - if(!v->d.func_ref->def->base->tmpl) + if(!v->d.func_ref || !v->d.func_ref->def->base->tmpl) ERR_O(exp_self(exp)->pos, _("template call of non-template function.")) if(t->e->d.func->def->base->tmpl->call) { if(env->func == t->e->d.func) { diff --git a/src/parse/scan1.c b/src/parse/scan1.c index ea0d4c51..fcb5c35c 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -150,7 +150,7 @@ ANN static m_bool scan1_exp_call(const Env env, const Exp_Call* exp_call) { return GW_OK; CHECK_BB(scan1_exp(env, exp_call->func)) const Exp args = exp_call->args; - return args ? scan1_exp(env, args) : 1; + return args ? scan1_exp(env, args) : GW_OK; } ANN static inline m_bool scan1_exp_dot(const Env env, const Exp_Dot* member) { -- 2.43.0