From a25bcdf21b38780ffe3750882c9810ed7c8130d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sat, 9 May 2020 21:45:53 +0200 Subject: [PATCH] :bug: Fixing union and enum access --- src/parse/scan0.c | 3 +++ src/parse/scan1.c | 1 + 2 files changed, 4 insertions(+) diff --git a/src/parse/scan0.c b/src/parse/scan0.c index f4b6ef9d..564f4561 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -275,6 +275,7 @@ ANN m_bool scan0_union_def(const Env env, const Union_Def udef) { const Type t = union_type(env, sym, !!udef->type_xid); udef->value = union_value(env, t, udef->xid); udef->value->flag |= udef->flag; + SET_ACCESS(udef, t); if(env->class_def && !GET_FLAG(udef, static)) { SET_FLAG(udef->value, member); SET_FLAG(udef, member); @@ -282,11 +283,13 @@ ANN m_bool scan0_union_def(const Env env, const Union_Def udef) { } else if(udef->type_xid) { 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); } else { const Symbol sym = scan0_sym(env, "union", udef->pos); CHECK_BB(scan0_defined(env, sym, udef->pos)) const Type t = union_type(env, sym, 1); + SET_ACCESS(udef, t); udef->value = union_value(env, t, sym); udef->value->flag |= udef->flag; } diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 3a6d978f..a298f271 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -279,6 +279,7 @@ ANN m_bool scan1_enum_def(const Env env, const Enum_Def edef) { if(env->class_def) { SET_FLAG(v, static); SET_ACCESS(edef, v) + SET_ACCESS(edef, edef->t) } SET_FLAG(v, const | ae_flag_enum | ae_flag_checked); nspc_add_value(edef->t->e->owner, list->xid, v); -- 2.43.0