From 45f143f9b7f54fc19dd30eb55e76a97803bf6d40 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Fri, 4 Oct 2019 12:55:16 +0200 Subject: [PATCH] :art: Improve check_stmt_auto --- src/parse/check.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; -- 2.43.0