From: Jérémie Astor Date: Sat, 9 May 2020 21:04:19 +0000 (+0200) Subject: :art: Rename checked flag to valid X-Git-Tag: nightly~1600 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=e1497cc3ecc75deee0249162b7393ade98980ce7;p=gwion.git :art: Rename checked flag to valid --- diff --git a/src/env/env.c b/src/env/env.c index 40065470..305544c8 100644 --- a/src/env/env.c +++ b/src/env/env.c @@ -85,7 +85,7 @@ ANN void env_add_type(const Env env, const Type type) { const Symbol sym = insert_symbol(type->name); nspc_add_type_front(env->curr, sym, type); const Value v = new_value(env->gwion->mp, v_type, s_name(sym)); - SET_FLAG(v, checked | ae_flag_const | ae_flag_global | ae_flag_builtin); + SET_FLAG(v, valid | ae_flag_const | ae_flag_global | ae_flag_builtin); nspc_add_value(env->curr, insert_symbol(type->name), v); v->from->owner = type->e->owner = env->curr; v->from->owner_class = type->e->owner_class = env->class_def; // t owner_class ? diff --git a/src/env/env_utils.c b/src/env/env_utils.c index 8ee41815..2c64ecae 100644 --- a/src/env/env_utils.c +++ b/src/env/env_utils.c @@ -88,7 +88,7 @@ ANN Value mk_class(const Env env, const Type base) { const Symbol sym = insert_symbol(base->name); const Value v = new_value(env->gwion->mp, t, s_name(sym)); valuefrom(env, v->from); - SET_FLAG(v, const | ae_flag_checked); + SET_FLAG(v, const | ae_flag_valid); nspc_add_value_front(base->e->owner, sym, v); return v; } diff --git a/src/env/type.c b/src/env/type.c index 3b28a68d..2597dd5c 100644 --- a/src/env/type.c +++ b/src/env/type.c @@ -112,7 +112,7 @@ ANN Type array_type(const Env env, const Type src, const m_uint depth) { t->e->d.base_type = array_base(src) ?: src; t->e->owner = src->e->owner; ADD_REF((t->nspc = env->gwion->type[et_array]->nspc)) - SET_FLAG(t, checked); + SET_FLAG(t, valid); mk_class(env, t); nspc_add_type_front(src->e->owner, sym, t); return t; diff --git a/src/import/cdef.c b/src/import/cdef.c index 8ba8d81b..01927fee 100644 --- a/src/import/cdef.c +++ b/src/import/cdef.c @@ -28,7 +28,7 @@ ANN static m_bool mk_xtor(MemPool p, const Type type, const m_uint d, const ae_f ANN2(1,2) static inline m_bool class_parent(const Env env, const Type t) { Type parent = t->e->parent; - while(parent && !GET_FLAG(parent, checked)) { + while(parent && !GET_FLAG(parent, valid)) { if(t->e->def) CHECK_BB(traverse_class_def(env, t->e->def)) parent = parent->e->parent; @@ -52,7 +52,7 @@ ANN2(1,2) static void import_class_ini(const Env env, const Type t) { inherit(t); t->e->owner = env->curr; t->e->owner_class = env->class_def; - SET_FLAG(t, checked); + SET_FLAG(t, valid); env_push_type(env, t); } diff --git a/src/lib/object.c b/src/lib/object.c index 8d958d49..4590ec5f 100644 --- a/src/lib/object.c +++ b/src/lib/object.c @@ -135,7 +135,7 @@ GWION_IMPORT(object) { const Type t_object = gwi_mk_type(gwi, "Object", SZ_INT, NULL); gwi_add_type(gwi, t_object); GWI_BB(gwi_gack(gwi, t_object, gack_object)) - SET_FLAG(t_object, checked); // should be set by gwi_add_type + SET_FLAG(t_object, valid); // should be set by gwi_add_type gwi->gwion->type[et_object] = t_object; // struct SpecialId_ spid = { .ck=check_this, .exec=RegPushMem, .is_const=1 }; struct SpecialId_ spid = { .ck=opck_this, .em=opem_this, .is_const=1 }; diff --git a/src/parse/check.c b/src/parse/check.c index 8c29c346..da30da9a 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -140,7 +140,7 @@ ANN static m_bool check_decl(const Env env, const Exp_Decl *decl) { CHECK_BB(check_var_td(env, var, decl->td)) if(is_fptr(env->gwion, decl->type)) CHECK_BB(check_fptr_decl(env, var)) - SET_FLAG(var->value, checked | ae_flag_used); + SET_FLAG(var->value, valid | ae_flag_used); nspc_add_value(env->curr, var->xid, var->value); } while((list = list->next)); return GW_OK; @@ -276,7 +276,7 @@ static inline Nspc value_owner(const Value v) { ANN static Type prim_id_non_res(const Env env, const Symbol *data) { const Symbol var = *data; const Value v = check_non_res_value(env, data); - if(!v || !GET_FLAG(v, checked) || (v->from->ctx && v->from->ctx->error)) { + if(!v || !GET_FLAG(v, valid) || (v->from->ctx && v->from->ctx->error)) { env_err(env, prim_pos(data), _("variable %s not legit at this point."), s_name(var)); did_you_mean_nspc(value_owner(v) ?: env->curr, s_name(var)); @@ -473,7 +473,7 @@ ANN static inline Value template_get_ready(const Env env, const Value v, const m } static Func ensure_tmpl(const Env env, const Func_Def fdef, const Exp_Call *exp) { - const m_bool ret = GET_FLAG(fdef, checked) || traverse_func_def(env, fdef) > 0; + const m_bool ret = GET_FLAG(fdef, valid) || traverse_func_def(env, fdef) > 0; if(ret) { const Func f = fdef->base->func; const Func next = f->next; @@ -481,7 +481,7 @@ static Func ensure_tmpl(const Env env, const Func_Def fdef, const Exp_Call *exp) const Func func = find_func_match(env, f, exp->args); f->next = next; if(func) { - SET_FLAG(func, checked | ae_flag_template); + SET_FLAG(func, valid | ae_flag_template); return func; } } @@ -497,7 +497,7 @@ ANN static m_bool check_func_args(const Env env, Arg_List arg_list) { if(isa(v->type, env->gwion->type[et_object]) > 0 || isa(v->type, env->gwion->type[et_function]) > 0) UNSET_FLAG(env->func, pure); CHECK_BB(already_defined(env, decl->xid, decl->pos)) - SET_FLAG(v, checked); + SET_FLAG(v, valid); nspc_add_value(env->curr, decl->xid, v); } while((arg_list = arg_list->next)); return GW_OK; @@ -996,7 +996,7 @@ ANN static m_bool do_stmt_auto(const Env env, const Stmt_Auto stmt) { } t = depth ? array_type(env, ptr, depth) : ptr; stmt->v = new_value(env->gwion->mp, t, s_name(stmt->sym)); - SET_FLAG(stmt->v, checked); + SET_FLAG(stmt->v, valid); nspc_add_value(env->curr, stmt->sym, stmt->v); return check_conts(env, stmt_self(stmt), stmt->body); } @@ -1116,7 +1116,7 @@ ANN m_bool check_union_def(const Env env, const Union_Def udef) { env->class_def->nspc->info->offset = udef->o + udef->s; union_pop(env, udef, scope); union_flag(udef, ae_flag_check); - union_flag(udef, ae_flag_checked); + union_flag(udef, ae_flag_valid); return ret; } @@ -1128,7 +1128,7 @@ ANN static Value match_value(const Env env, const Exp_Primary* prim, const m_uin const Symbol sym = prim->d.var; const Value v = new_value(env->gwion->mp, ((Exp)VKEY(&env->scope->match->map, i))->info->type, s_name(sym)); - SET_FLAG(v, checked); + SET_FLAG(v, valid); nspc_add_value(env->curr, sym, v); VVAL(&env->scope->match->map, i) = (vtype)v; return v; @@ -1336,7 +1336,7 @@ ANN m_bool check_func_def(const Env env, const Func_Def f) { --env->scope->depth; env->func = former; if(ret > 0) - SET_FLAG(fdef, checked); + SET_FLAG(fdef, valid); if(GET_FLAG(fdef, global)) env_pop(env,scope); return ret; @@ -1380,7 +1380,7 @@ ANN m_bool check_class_def(const Env env, const Class_Def cdef) { inherit(t); if(cdef->body) CHECK_BB(env_body(env, cdef, check_section)) - SET_FLAG(t, checked); + SET_FLAG(t, valid); return GW_OK; } diff --git a/src/parse/scan0.c b/src/parse/scan0.c index 564f4561..a4ba6276 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -145,7 +145,7 @@ ANN static void typedef_simple(const Env env, const Type_Def tdef, const Type ba tdef->type = t; if(base->nspc) ADD_REF((t->nspc = base->nspc)); - t->flag = tdef->ext->flag | ae_flag_checked; + t->flag = tdef->ext->flag | ae_flag_valid; scan0_implicit_similar(env, t, base); if(tdef->ext->array && !tdef->ext->array->exp) SET_FLAG(t, empty); @@ -259,7 +259,7 @@ ANN static Value union_value(const Env env, const Type t, const Symbol sym) { const Value v = new_value(env->gwion->mp, t, s_name(sym)); valuefrom(env, v->from); nspc_add_value(env->curr, sym, v); - SET_FLAG(v, checked | ae_flag_pure); + SET_FLAG(v, valid | ae_flag_pure); return v; } @@ -284,7 +284,7 @@ ANN m_bool scan0_union_def(const Env env, const Union_Def udef) { CHECK_BB(scan0_defined(env, udef->type_xid, udef->pos)) udef->type = union_type(env, udef->type_xid, 1); SET_ACCESS(udef, udef->type); - SET_FLAG(udef->type, checked); + SET_FLAG(udef->type, valid); } else { const Symbol sym = scan0_sym(env, "union", udef->pos); CHECK_BB(scan0_defined(env, sym, udef->pos)) diff --git a/src/parse/scan1.c b/src/parse/scan1.c index a298f271..76bae39e 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -281,7 +281,7 @@ ANN m_bool scan1_enum_def(const Env env, const Enum_Def edef) { SET_ACCESS(edef, v) SET_ACCESS(edef, edef->t) } - SET_FLAG(v, const | ae_flag_enum | ae_flag_checked); + SET_FLAG(v, const | ae_flag_enum | ae_flag_valid); nspc_add_value(edef->t->e->owner, list->xid, v); vector_add(&edef->values, (vtype)v); } while((list = list->next)); @@ -333,7 +333,7 @@ ANN m_bool scan1_type_def(const Env env, const Type_Def tdef) { ANN m_bool scan1_union_def_action(const Env env, const Union_Def udef, const Decl_List l) { const Exp_Decl decl = l->self->d.exp_decl; - SET_FLAG(decl.td, checked | udef->flag); + SET_FLAG(decl.td, valid | udef->flag); const m_bool global = GET_FLAG(udef, global); if(global) UNSET_FLAG(decl.td, global); diff --git a/src/parse/scan2.c b/src/parse/scan2.c index 74e0031d..c045374a 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -357,7 +357,7 @@ ANN2(1, 2) static m_bool scan2_fdef_tmpl(const Env env, const Func_Def f, const const m_str name = s_name(f->base->xid); const Func func = scan_new_func(env, f, name); const Value value = func_value(env, func, overload); - SET_FLAG(value, checked | ae_flag_template); + SET_FLAG(value, valid | ae_flag_template); SET_FLAG(value->type, func); // the only types with func flag, name could be better Type type = env->class_def; Nspc nspc = env->curr; @@ -499,7 +499,7 @@ ANN2(1,2) m_bool scan2_fdef_std(const Env env, const Func_Def f, const Value ove if(!base) { if(GET_FLAG(f, op)) CHECK_BB(scan2_func_def_op(env, f)) - SET_FLAG(f->base->func->value_ref, checked); + SET_FLAG(f->base->func->value_ref, valid); } return GW_OK; } diff --git a/src/parse/traverse.c b/src/parse/traverse.c index a21df7ba..deac0f86 100644 --- a/src/parse/traverse.c +++ b/src/parse/traverse.c @@ -62,7 +62,7 @@ ANN m_bool traverse_class_def(const Env env, const Class_Def def) { CHECK_BB(scan1_class_def(env, def)) if(!GET_FLAG(t, scan2)) CHECK_BB(scan2_class_def(env, def)) - if(!GET_FLAG(t, checked)) + if(!GET_FLAG(t, valid)) return check_class_def(env, def); return GW_OK; } diff --git a/util b/util index 3765afd5..10ae3a6a 160000 --- a/util +++ b/util @@ -1 +1 @@ -Subproject commit 3765afd505c6da83445f07552e471bf4cc180a4c +Subproject commit 10ae3a6aa18006fb407519e057ef0ed7ad8232ea