From 97efe195d7dfe4d011707e25d3896aaa72e1e44c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sat, 9 May 2020 21:31:04 +0200 Subject: [PATCH] :art: Allow per nspc operator --- src/parse/operator.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/parse/operator.c b/src/parse/operator.c index 15c2bdd7..49c2eba0 100644 --- a/src/parse/operator.c +++ b/src/parse/operator.c @@ -128,14 +128,12 @@ ANN static m_bool op_exist(const struct OpChecker* ock, const Nspc n) { } ANN m_bool add_op(const Gwion gwion, const struct Op_Import* opi) { - Nspc n = gwion->env->curr; - do { - struct OpChecker ock = { gwion->env, &n->info->op_map, opi, 0 }; - CHECK_BB(op_exist(&ock, n)) - } while((n = n->parent)); - if(!gwion->env->curr->info->op_map.ptr) - map_init(&gwion->env->curr->info->op_map); + const Nspc nspc = gwion->env->curr; struct OpChecker ock = { gwion->env, &gwion->env->curr->info->op_map, opi, 0 }; + if(!nspc->info->op_map.ptr) + map_init(&nspc->info->op_map); + else + CHECK_BB(op_exist(&ock, nspc)) const Vector v = op_vector(gwion->mp, &ock); const M_Operator* mo = new_mo(gwion->mp, opi); vector_add(v, (vtype)mo); -- 2.43.0