From 120f367426b33dfb31c7cdcba69dd6ec071912f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 9 Dec 2019 22:07:36 +0100 Subject: [PATCH] :art: Improve free_type() logic --- src/oo/type.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.43.0