From: fennecdjay Date: Tue, 11 Jun 2019 20:44:51 +0000 (+0200) Subject: :art: Set Class Flag sooner X-Git-Tag: nightly~2442^2~6 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=1513a79b7b12c2cecbca995707af621329818078;p=gwion.git :art: Set Class Flag sooner --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 0497ef8f..7b29d53c 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1773,7 +1773,7 @@ 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; - return scanx_parent(parent, emit_parent_inner, emit); + return !GET_FLAG(parent, emit) ? GW_OK : scanx_parent(parent, emit_parent_inner, emit); } ANN static inline m_bool emit_cdef(const Emitter emit, const Class_Def cdef) { @@ -1782,10 +1782,11 @@ ANN static inline m_bool emit_cdef(const Emitter emit, const Class_Def cdef) { } ANN static m_bool emit_class_def(const Emitter emit, const Class_Def cdef) { - const Type type = cdef->base.type; - const Nspc nspc = type->nspc; 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)) nspc_allocdata(emit->gwion->mp, nspc); diff --git a/src/parse/check.c b/src/parse/check.c index 511e6f6d..3e0cfa2a 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -103,7 +103,8 @@ ANN Type check_exp_decl(const Env env, const Exp_Decl* decl) { if(!decl->type) // TODO: remove when scan passes are complete ERR_O(td_pos(decl->td), "can't infer type."); if(GET_FLAG(decl->type , template)) { - if(!GET_FLAG(decl->type, check)) + /*if(!GET_FLAG(decl->type, checked))*/ + if(!GET_FLAG(decl->type, scan2)) CHECK_BO(traverse_cdef(env, decl->type->e->def)) } const m_bool global = GET_FLAG(decl->td, global); @@ -1200,6 +1201,7 @@ ANN m_bool check_class_def(const Env env, const Class_Def cdef) { if(tmpl_base(cdef->base.tmpl)) return GW_OK; const Type type = cdef->base.type; + SET_FLAG(type, check); if(type->e->parent == t_undefined) { type->e->parent = check_td(env, cdef->base.ext); return traverse_cdef(env, cdef); @@ -1211,7 +1213,7 @@ ANN m_bool check_class_def(const Env env, const Class_Def cdef) { inherit(type); if(cdef->body) CHECK_BB(env_body(env, cdef, check_section)) - SET_FLAG(type, checked | ae_flag_check); + SET_FLAG(type, checked); return GW_OK; } diff --git a/src/parse/scan0.c b/src/parse/scan0.c index eb89ff2d..1684e2d2 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -244,6 +244,7 @@ ANN static m_bool scan0_section(const Env env, const Section* section) { ANN m_bool scan0_class_def(const Env env, const Class_Def cdef) { CHECK_BB(scan0_class_def_pre(env, cdef)) CHECK_OB((cdef->base.type = scan0_class_def_init(env, cdef))) + SET_FLAG(cdef->base.type, scan0); if(cdef->body) { int call = cdef->base.tmpl && !cdef->base.tmpl->call; if(call)cdef->base.tmpl->call = (Type_List)1; @@ -253,7 +254,6 @@ ANN m_bool scan0_class_def(const Env env, const Class_Def cdef) { (void)mk_class(env, cdef->base.type); if(GET_FLAG(cdef, global)) env->curr = (Nspc)vector_pop(&env->scope->nspc_stack); - SET_FLAG(cdef->base.type, scan0); return GW_OK; } diff --git a/src/parse/scan1.c b/src/parse/scan1.c index cbe60e52..7dbcd6d9 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -353,11 +353,11 @@ ANN m_bool scan1_class_def(const Env env, const Class_Def cdef) { CHECK_BB(scan0_class_def(env, cdef)) if(tmpl_base(cdef->base.tmpl)) return GW_OK; + SET_FLAG(cdef->base.type, scan1); if(cdef->base.ext) CHECK_BB(env_ext(env, cdef, scan1_parent)) if(cdef->body) CHECK_BB(env_body(env, cdef, scan1_section)) - SET_FLAG(cdef->base.type, scan1); return GW_OK; } diff --git a/src/parse/scan2.c b/src/parse/scan2.c index b5b6e890..8d51208f 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -558,11 +558,11 @@ ANN static m_bool scan2_class_parent(const Env env, const Class_Def cdef) { ANN m_bool scan2_class_def(const Env env, const Class_Def cdef) { if(tmpl_base(cdef->base.tmpl)) return GW_OK; + SET_FLAG(cdef->base.type, scan2); if(cdef->base.ext) CHECK_BB(env_ext(env, cdef, scan2_class_parent)) if(cdef->body) CHECK_BB(env_body(env, cdef, scan2_section)) - SET_FLAG(cdef->base.type, scan2); return GW_OK; }