From d2873572722fdd67f0d059336abb1b6e93e5326c Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Wed, 2 Oct 2019 10:55:53 +0200 Subject: [PATCH] :art: More work on check_internal --- src/parse/check.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/parse/check.c b/src/parse/check.c index f0942da0..a76ca190 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -28,16 +28,6 @@ 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 }; @@ -58,8 +48,8 @@ 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; - const Type t_int = env->gwion->type[et_int]; - do CHECK_BB(_check_implicit(env, "@access", e, t_int)) + const Symbol sym = insert_symbol("@access"); + do CHECK_BB(check_internal(env, sym, e, env->gwion->type[et_int])) while(++(depth) && (e = e->next)); if(depth != array->depth) ERR_B(array->exp->pos, _("invalid array acces expression.")) @@ -1038,9 +1028,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) { - const m_str str = "@repeat"; + const Symbol sym = insert_symbol("@repeat"); const Type t_int = env->gwion->type[et_int]; - return _check_implicit(env, str, e, t_int); + return check_internal(env, sym, e, t_int); } #define stmt_func_xxx(name, type, prolog, exp) describe_stmt_func(check, name, type, prolog, exp) -- 2.43.0