From: Jérémie Astor Date: Wed, 15 Jul 2020 21:37:18 +0000 (+0200) Subject: :art: Improve pattern match scoping X-Git-Tag: nightly~1434 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=5584d032c84db39b92936c814e61475311866d09;p=gwion.git :art: Improve pattern match scoping --- diff --git a/src/parse/check.c b/src/parse/check.c index 40506c40..e904d781 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1246,8 +1246,6 @@ ANN static m_bool case_loop(const Env env, const Stmt_Match stmt) { } ANN static m_bool _check_stmt_match(const Env env, const Stmt_Match stmt) { - if(stmt->where) - CHECK_BB(check_stmt(env, stmt->where)) CHECK_OB(check_exp(env, stmt->cond)) MATCH_INI(env->scope) const m_bool ret = case_loop(env, stmt); @@ -1255,10 +1253,16 @@ ANN static m_bool _check_stmt_match(const Env env, const Stmt_Match stmt) { return ret; } -ANN static m_bool check_stmt_match(const Env env, const Stmt_Match stmt) { +ANN static inline m_bool handle_where(const Env env, const Stmt_Match stmt) { + if(stmt->where) + CHECK_BB(check_stmt(env, stmt->where)) RET_NSPC(_check_stmt_match(env, stmt)) } +ANN static m_bool check_stmt_match(const Env env, const Stmt_Match stmt) { + RET_NSPC(handle_where(env, stmt)) +} + #define check_stmt_while check_stmt_flow #define check_stmt_until check_stmt_flow #define check_stmt_pp dummy_func