From c0e53efb673d916b1fce1a3f131b52d585f07ce2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 13 Apr 2020 18:42:49 +0200 Subject: [PATCH] :art: Copy Global class defs --- src/env/type.c | 3 ++- src/parse/scan0.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/env/type.c b/src/env/type.c index df582888..1249dd30 100644 --- a/src/env/type.c +++ b/src/env/type.c @@ -7,7 +7,8 @@ #include "gwion.h" ANN static inline m_bool freeable(const Type a) { - return !GET_FLAG(a, nonnull) && GET_FLAG(a, template); + return !GET_FLAG(a, nonnull) && + (GET_FLAG(a, template) || GET_FLAG(a, global)); } ANN static void free_type(Type a, Gwion gwion) { diff --git a/src/parse/scan0.c b/src/parse/scan0.c index 2481ff82..6d4cb056 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -382,7 +382,7 @@ ANN m_bool scan0_class_def(const Env env, const Class_Def cdef) { if(GET_FLAG(cdef, global)) env->curr = (Nspc)vector_pop(&env->scope->nspc_stack); CHECK_BB(ret) - if(cdef->base.tmpl && !cdef->base.tmpl->call) { + if(GET_FLAG(cdef, global) || (cdef->base.tmpl && !cdef->base.tmpl->call)) { const Class_Def c = cpy_class_def(env->gwion->mp, cdef); c->base.type = cdef->base.type; c->base.type->e->def = c; -- 2.43.0