From: Jérémie Astor Date: Mon, 13 Apr 2020 16:42:49 +0000 (+0200) Subject: :art: Copy Global class defs X-Git-Tag: nightly~1703 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=c0e53efb673d916b1fce1a3f131b52d585f07ce2;p=gwion.git :art: Copy Global class defs --- 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;