From: fennecdjay Date: Wed, 16 Nov 2022 18:32:10 +0000 (+0100) Subject: :bug: improve scan1 X-Git-Tag: nightly~207^2~87 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=477d82495794043bd5f5c42b0c9030c31a745f42;p=gwion.git :bug: improve scan1 --- diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 1d034d2a..2d7e9685 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -456,6 +456,8 @@ ANN m_bool scan1_fptr_def(const Env env, const Fptr_Def fptr) { ANN m_bool scan1_type_def(const Env env, const Type_Def tdef) { if (tdef->when) CHECK_BB(scan1_exp(env, tdef->when)); + if(tflag(tdef->type->info->parent, tflag_ref)) + ERR_B(tdef->pos, "can't typedef a reference type"); if (tflag(tdef->type, tflag_cdef)) return scan1_class_def(env, tdef->type->info->cdef); return tdef->type->info->cdef ? scan1_cdef(env, tdef->type) : GW_OK; @@ -512,7 +514,7 @@ ANN static m_bool scan1_stmt_return(const Env env, const Stmt_Exp stmt) { ERR_B(stmt_self(stmt)->pos, _("'return' statement found outside function definition")) if (env->scope->depth == 1) env->func->memoize = 1; - if(stmt->val) scan1_exp(env, stmt->val); + if(stmt->val) CHECK_BB(scan1_exp(env, stmt->val)); return GW_OK; }