From: fennecdjay Date: Tue, 1 Oct 2019 23:37:22 +0000 (+0200) Subject: :art: Improve cond_type X-Git-Tag: nightly~2198^2~183 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=4a2ae5924c461d6fc03f3859490a530f0d951c25;p=gwion.git :art: Improve cond_type --- diff --git a/src/parse/check.c b/src/parse/check.c index 50c22a09..d6e94243 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -58,7 +58,9 @@ ANN m_bool check_subscripts(Env env, const Array_Sub array) { CHECK_OB(check_exp(env, array->exp)) m_uint depth = 0; Exp e = array->exp; - do if(isa(e->type, env->gwion->type[et_int]) < 0) + // TODO: use check_internal @access + const Type t_int = env->gwion->type[et_int]; + do if(isa(e->type, t_int) < 0) ERR_B(e->pos, _("array index %i must be of type 'int', not '%s'"), depth, e->type->name) while(++(depth) && (e = e->next)); @@ -1039,7 +1041,9 @@ ANN static m_bool do_stmt_auto(const Env env, const Stmt_Auto stmt) { } ANN static inline m_bool cond_type(const Env env, const Exp e) { - return _check_implicit(env, "@repeat", e, env->gwion->type[et_int]); + const m_str str = "@repeat"; + const Type t_int = env->gwion->type[et_int]; + return _check_implicit(env, str, e, t_int); } #define stmt_func_xxx(name, type, prolog, exp) describe_stmt_func(check, name, type, prolog, exp)