From: fennecdjay Date: Tue, 1 Oct 2019 22:31:58 +0000 (+0200) Subject: Revert ":art: check_internal repeat" X-Git-Tag: nightly~2198^2~190 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=3db390cf965b7ce6f120acb81e4eb6dd02294099;p=gwion.git Revert ":art: check_internal repeat" This reverts commit 07824ba2f051d93e7f6ccbb68b3e8bee529766d1. --- diff --git a/src/parse/check.c b/src/parse/check.c index bcdb1451..eecbe7c2 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -28,6 +28,16 @@ ANN static Type check_exp(const Env env, Exp exp); ANN static m_bool check_stmt_list(const Env env, Stmt_List list); ANN m_bool check_class_def(const Env env, const Class_Def class_def); +ANN static m_bool _check_implicit(const Env env, const m_str str, + const Exp e, const Type t) { + struct Implicit imp = { .e=e, .t=t, .pos=e->pos }; + struct Op_Import opi = { .op=insert_symbol(str), .lhs=e->type, + .rhs=t, .data=(uintptr_t)&imp, .pos=e->pos }; + CHECK_OB(op_check(env, &opi)) + e->nspc = env->curr; + return GW_OK; +} + ANN static m_bool check_internal(const Env env, const Symbol sym, const Exp e, const Type t) { struct Implicit imp = { .e=e, .t=t, .pos=e->pos }; @@ -1045,8 +1055,7 @@ 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) { - const Symbol sym = insert_symbol("@repeat"); - return check_internal(env, sym, e, env->gwion->type[et_int]); + return _check_implicit(env, "@repeat", e, env->gwion->type[et_int]); } #define stmt_func_xxx(name, type, prolog, exp) describe_stmt_func(check, name, type, prolog, exp)