From: fennecdjay Date: Wed, 12 Jun 2019 11:55:39 +0000 (+0200) Subject: :art: Improve parent checking X-Git-Tag: nightly~2442^2~5 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=313cd06d3445b2223122c42d78471195b847d0d0;p=gwion.git :art: Improve parent checking --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 7b29d53c..5b91666d 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1773,6 +1773,9 @@ ANN inline void emit_class_finish(const Emitter emit, const Nspc nspc) { ANN static m_bool emit_parent(const Emitter emit, const Class_Def cdef) { const Type parent = cdef->base.type->e->parent; + const Type base = parent->e->d.base_type; + if(base && !GET_FLAG(base, emit)) + CHECK_BB(scanx_parent(base, emit_parent_inner, emit)) return !GET_FLAG(parent, emit) ? GW_OK : scanx_parent(parent, emit_parent_inner, emit); } @@ -1785,10 +1788,10 @@ ANN static m_bool emit_class_def(const Emitter emit, const Class_Def cdef) { if(tmpl_base(cdef->base.tmpl)) return GW_OK; const Type type = cdef->base.type; - SET_FLAG(type, emit); const Nspc nspc = type->nspc; if(cdef->base.ext && cdef->base.ext->types) CHECK_BB(scanx_ext(emit->env, cdef, emit_parent, emit)) + SET_FLAG(type, emit); nspc_allocdata(emit->gwion->mp, nspc); emit_class_code(emit, type->name); if(cdef->base.ext && cdef->base.ext->array)