From: fennecdjay Date: Tue, 1 Oct 2019 22:47:45 +0000 (+0200) Subject: :art: Use t_int X-Git-Tag: nightly~2198^2~188 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=b50b4fb7df6d751be5aa6794af3a06bce46dace7;p=gwion.git :art: Use t_int --- diff --git a/src/parse/check.c b/src/parse/check.c index 11799a3d..530e7377 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -56,7 +56,8 @@ ANN static inline m_bool check_implicit(const Env env, const Exp e, const Type t ANN m_bool check_exp_array_subscripts(Env env, Exp exp) { CHECK_OB(check_exp(env, exp)) - do if(isa(exp->type, env->gwion->type[et_int]) < 0) + const Type t_int = env->gwion->type[et_int]; + do if(isa(exp->type, t_int) < 0) ERR_B(exp->pos, _("incompatible array subscript type '%s' ..."), exp->type->name) while((exp = exp->next)); return GW_OK; @@ -419,7 +420,8 @@ ANN static Type at_depth(const Env env, const Array_Sub array) { static inline m_bool index_is_int(const Env env, Exp e, m_uint *depth) { // TODO: use "@access" - do if(isa(e->type, env->gwion->type[et_int]) < 0) + 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)); @@ -1055,7 +1057,8 @@ 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 Type t_int = env->gwion->type[et_int]; + return _check_implicit(env, "@repeat", e, t_int); } #define stmt_func_xxx(name, type, prolog, exp) describe_stmt_func(check, name, type, prolog, exp)