From b98ccbf17d18eb9521b50495556980909b6ae3da Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Fri, 17 May 2019 15:25:06 +0200 Subject: [PATCH] :art: Few fixes --- src/parse/scanx.c | 15 ++++++++++----- src/parse/template.c | 3 --- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/parse/scanx.c b/src/parse/scanx.c index 5762760b..6d127b10 100644 --- a/src/parse/scanx.c +++ b/src/parse/scanx.c @@ -15,10 +15,14 @@ ANN static inline m_bool _body(const Env e, Class_Body b, const _exp_func f) { return GW_OK; } -ANN static inline m_uint _push(const Env e, const Class_Def c) { - const m_uint scope = env_push_type(e, c->base.type); - if(c->tmpl) - template_push_types(e, c->tmpl->list.list, c->tmpl->base); +ANN static inline m_int _push(const Env env, const Class_Def c) { + const m_uint scope = env_push_type(env, c->base.type); + if(c->tmpl) { + if(!c->tmpl->base) + ERR_B(c->pos, + "you must provide template types for type '%s'", s_name(c->base.xid)) + CHECK_BB(template_push_types(env, c->tmpl->list.list, c->tmpl->base)) + } return scope; } @@ -30,7 +34,8 @@ ANN static inline void _pop(const Env e, const Class_Def c, const m_uint s) { ANN m_bool scanx_body(const Env e, const Class_Def c, const _exp_func f, void* d) { - const m_uint scope = _push(e, c); + const m_int scope = _push(e, c); + CHECK_BB(scope) const m_bool ret = _body(d, c->body, f); _pop(e, c, scope); return ret; diff --git a/src/parse/template.c b/src/parse/template.c index 5c2206d0..c9e75c26 100644 --- a/src/parse/template.c +++ b/src/parse/template.c @@ -146,9 +146,6 @@ ANN Type scan_type(const Env env, const Type t, const Type_Decl* type) { if(GET_FLAG(t, template)) { if(GET_FLAG(t, ref)) return t; - if(!type->types) - ERR_O(type->xid->pos, - "you must provide template types for type '%s'", t->name) if(template_match(t->e->def->tmpl->list.list, type->types) < 0) ERR_O(type->xid->pos, "invalid template types number") const Class_Def a = template_class(env, t->e->def, type->types); -- 2.43.0