From 40b978b0b3dbeee08ae25404f597b11323e581b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Thu, 7 May 2020 18:55:24 +0200 Subject: [PATCH] :art: make envset/push static --- src/env/envset.c | 2 +- src/lib/object_op.c | 1 - src/parse/check.c | 14 ++++++++------ src/parse/scan0.c | 3 ++- src/parse/scan1.c | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/env/envset.c b/src/env/envset.c index a523d77a..3ff71a90 100644 --- a/src/env/envset.c +++ b/src/env/envset.c @@ -17,7 +17,7 @@ ANN static void check(struct EnvSet *es, const Type t) { } } -ANN m_bool push(struct EnvSet *es, const Type t) { +ANN static m_bool push(struct EnvSet *es, const Type t) { if(t->e->owner_class) CHECK_BB(push(es, t->e->owner_class)) if(!(t->flag & es->flag)) diff --git a/src/lib/object_op.c b/src/lib/object_op.c index 15114751..a900ad8d 100644 --- a/src/lib/object_op.c +++ b/src/lib/object_op.c @@ -399,7 +399,6 @@ ANN static Type scan_class(const Env env, const Type t, const Type_Decl* td) { SET_FLAG(a->base.type, template); if(GET_FLAG(t, builtin)) SET_FLAG(a->base.type, builtin); - CHECK_BO(scan1_cdef(env, a)) return a->base.type; } diff --git a/src/parse/check.c b/src/parse/check.c index ce74ee24..93bc1244 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1094,15 +1094,17 @@ ANN void check_udef(const Env env, const Union_Def udef) { if(udef->xid) { if(env->class_def) (!GET_FLAG(udef, static) ? decl_member : decl_static)(env, udef->value); - } else if(env->class_def) { - if(!GET_FLAG(udef, static)) - udef->o = env->class_def->nspc->info->offset; - else { - udef->o = env->class_def->nspc->info->class_data_size; - env->class_def->nspc->info->class_data_size += SZ_INT; + else if(env->class_def) { + if(!GET_FLAG(udef, static)) + udef->o = env->class_def->nspc->info->offset; + else { + udef->o = env->class_def->nspc->info->class_data_size; + env->class_def->nspc->info->class_data_size += SZ_INT; + } } } } + ANN m_bool check_union_def(const Env env, const Union_Def udef) { if(tmpl_base(udef->tmpl)) // there's a func for this return GW_OK; diff --git a/src/parse/scan0.c b/src/parse/scan0.c index 7e5adef3..1cc3d60e 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -234,7 +234,7 @@ ANN static Type union_type(const Env env, const Symbol s, const m_bool add) { if(add) { mk_class(env, t); } - SET_FLAG(t, union); + SET_FLAG(t, union | ae_flag_scan0); return t; } @@ -374,6 +374,7 @@ ANN m_bool scan0_class_def(const Env env, const Class_Def c) { CHECK_BB(ret) if(GET_FLAG(cdef, global) || (cdef->base.tmpl && !cdef->base.tmpl->call)) c->base.type = cdef->base.type; + SET_FLAG(cdef->base.type, scan0); return GW_OK; } diff --git a/src/parse/scan1.c b/src/parse/scan1.c index f7bbf02c..2cef2840 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -325,9 +325,9 @@ ANN m_bool scan1_union_def_action(const Env env, const Union_Def udef, SET_FLAG(decl.td, member); else if(GET_FLAG(udef, static)) SET_FLAG(decl.td, static); - if(udef->tmpl && udef->tmpl->call) CHECK_BB(template_push_types(env, udef->tmpl)) + SET_FLAG(decl.td, ref); const m_bool ret = scan1_exp(env, l->self); if(udef->tmpl && udef->tmpl->call) nspc_pop_type(env->gwion->mp, env->curr); -- 2.43.0