From: fennecdjay Date: Fri, 4 Oct 2019 10:55:16 +0000 (+0200) Subject: :art: Improve check_stmt_auto X-Git-Tag: nightly~2198^2~158 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=45f143f9b7f54fc19dd30eb55e76a97803bf6d40;p=gwion.git :art: Improve check_stmt_auto --- diff --git a/src/parse/check.c b/src/parse/check.c index 03d6ac04..425aa35d 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1004,10 +1004,10 @@ ANN static inline m_bool for_empty(const Env env, const Stmt_For stmt) { ANN static m_bool do_stmt_auto(const Env env, const Stmt_Auto stmt) { DECL_OB(Type, t, = check_exp(env, stmt->exp)) + while(GET_FLAG(t, typedef)) + t = t->e->parent; Type ptr = array_base(t); const m_uint depth = t->array_depth - 1; - if(GET_FLAG(t, typedef)) - t = t->e->parent; if(!ptr || isa(t, env->gwion->type[et_array]) < 0) ERR_B(stmt_self(stmt)->pos, _("type '%s' is not array.\n" " This is not allowed in auto loop"), stmt->exp->type->name) @@ -1033,8 +1033,9 @@ ANN static m_bool do_stmt_auto(const Env env, const Stmt_Auto stmt) { td.array = &array; } ptr = known_type(env, &td); + assert(ptr); if(!GET_FLAG(ptr, checked)) - check_class_def(env, ptr->e->def); + CHECK_BB(check_class_def(env, ptr->e->def)) // traverse_class_def(env, ptr->e->def); } t = depth ? array_type(env, ptr, depth) : ptr;