From: Jérémie Astor Date: Sat, 19 Jun 2021 19:24:21 +0000 (+0200) Subject: :bug: Fix check_exp_if X-Git-Tag: nightly~583 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=4252e007ebde0e06aa652e9f8aa240f8e2498aea;p=gwion.git :bug: Fix check_exp_if --- diff --git a/src/parse/check.c b/src/parse/check.c index e13cca4f..ab179976 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -951,14 +951,17 @@ ANN static Type _flow(const Env env, const Exp e, const m_bool b) { } #define check_flow(emit, b) _flow(emit, b, 1) -ANN static Type check_exp_if(const Env env, const Exp_If *exp_if) { - const Exp e = exp_if->if_exp ?: exp_if->cond; +ANN static Type check_exp_if(const Env env, Exp_If *const exp_if) { + if(!exp_if->if_exp) { + const Exp e = exp_if->if_exp = cpy_exp(env->gwion->mp, exp_if->cond); + scan1_exp(env, e); + scan2_exp(env, e); + } DECL_OO(const Type, cond, = check_flow(env, exp_if->cond)); - DECL_OO(const Type, if_exp, - = (exp_if->if_exp ? check_exp(env, exp_if->if_exp) : cond)); + DECL_OO(const Type, if_exp, = check_exp(env, exp_if->if_exp)); DECL_OO(const Type, else_exp, = check_exp(env, exp_if->else_exp)); - const uint meta = exp_getmeta(e) || exp_getmeta(exp_if->else_exp); + const uint meta = exp_getmeta(exp_if->if_exp) || exp_getmeta(exp_if->else_exp); exp_setmeta(exp_self(exp_if), meta); const Type ret = find_common_anc(if_exp, else_exp); if (!ret)