From: Jérémie Astor Date: Mon, 9 Dec 2019 21:07:36 +0000 (+0100) Subject: :art: Improve free_type() logic X-Git-Tag: nightly~2000 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=120f367426b33dfb31c7cdcba69dd6ec071912f5;p=gwion.git :art: Improve free_type() logic --- diff --git a/src/oo/type.c b/src/oo/type.c index 900bd2b2..8f47596f 100644 --- a/src/oo/type.c +++ b/src/oo/type.c @@ -7,8 +7,13 @@ #include "gwion.h" #include "tuple.h" +ANN static inline m_bool freeable(const Type t) { + return !GET_FLAG(a, nonnull) && + GET_FLAG(a, template) || GET_FLAG(a, global); +} + ANN static void free_type(Type a, Gwion gwion) { - if(GET_FLAG(a, template) || GET_FLAG(a, global)) { + if(freeable(a)) if(GET_FLAG(a, union)) { if(a->e->def->union_def) { if(!GET_FLAG(a, pure)) { // <=> decl_list