From: fennecdjay Date: Wed, 8 May 2024 23:07:49 +0000 (+0200) Subject: :art: some clean X-Git-Tag: nightly~14 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=c0f714d4fbb0bcf9b75c32fb5c440b82352d521a;p=gwion.git :art: some clean --- diff --git a/src/parse/check.c b/src/parse/check.c index 93751c43..dd307a03 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -289,18 +289,8 @@ ANN bool not_from_owner_class(const Env env, const Type t, const Value v, ANN static inline Value get_value(const Env env, const Symbol sym) { const Value value = nspc_lookup_value1(env->curr, sym); if(value) { -if(value->from->owner_class && is_func(env->gwion, value->from->owner_class)) { -/* - -set_tflag(value->from->owner_class, tflag_check); -set_tflag(value->from->owner_class, tflag_scan0); -set_tflag(value->from->owner_class, tflag_scan1); -set_tflag(value->from->owner_class, tflag_scan2); -set_tflag(value->from->owner_class, tflag_check); -*/ -return value; -} - + if(value->from->owner_class && is_func(env->gwion, value->from->owner_class)) + return value; if (!value->from->owner_class || isa(env->class_def, value->from->owner_class)) return value; if(env->class_def) { @@ -1263,14 +1253,11 @@ ANN static Type _flow(const Env env, Exp* e, const bool b) { #define check_flow(emit, b) _flow(emit, b, 1) ANN static Type check_exp_if(const Env env, Exp_If *const exp_if) { - if (!exp_if->if_exp) { - Exp* e = exp_if->if_exp = cpy_exp(env->gwion->mp, exp_if->cond); - scan1_exp(env, e); - scan2_exp(env, e); - } - DECL_O(const Type, cond, = check_flow(env, exp_if->cond)); - DECL_O(const Type, if_exp, = check_exp(env, exp_if->if_exp)); - DECL_O(const Type, else_exp, = check_exp(env, exp_if->else_exp)); + const Type cond = check_flow(env, exp_if->cond); + const Type if_exp = check_exp(env, exp_if->if_exp); + const Type else_exp = check_exp(env, exp_if->else_exp); + if(!cond || !if_exp || !else_exp) + return NULL; const uint meta = exp_getmeta(exp_if->if_exp) || exp_getmeta(exp_if->else_exp); diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 7a70b2a1..6f57bdaf 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -223,7 +223,7 @@ ANN static bool scan1_exp_post(const Env env, const Exp_Postfix *post) { } ANN static bool scan1_exp_call(const Env env, const Exp_Call *exp_call) { - if (exp_call->tmpl) return true; +// if (exp_call->tmpl) return true; CHECK_B(scan1_exp(env, exp_call->func)); Exp* args = exp_call->args; return args ? scan1_exp(env, args) : true; diff --git a/src/sema/sema.c b/src/sema/sema.c index 614b9a86..30ae094a 100644 --- a/src/sema/sema.c +++ b/src/sema/sema.c @@ -230,8 +230,11 @@ ANN static bool sema_exp_slice(Sema *a, Exp_Slice *b) { ANN static bool sema_exp_if(Sema *a, Exp_If *b) { bool ok = unique_expression(a, b->cond, "in `if` expression condition"); - if(b->if_exp && !unique_expression(a, b->if_exp, "in `if` expression true branch")) - ok = false; + if(b->if_exp) { + if(!unique_expression(a, b->if_exp, "in `if` expression true branch")) + ok = false; + } else + b->if_exp = cpy_exp(a->mp, b->cond); return unique_expression(a, b->else_exp, "in `in` expression false branch") && ok; }