From: Jérémie Astor Date: Sat, 9 May 2020 19:31:04 +0000 (+0200) Subject: :art: Allow per nspc operator X-Git-Tag: nightly~1610 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=97efe195d7dfe4d011707e25d3896aaa72e1e44c;p=gwion.git :art: Allow per nspc operator --- 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);