commit 70a51c87202f7570ec83458c3e72c5532ebd9829
parent db13800de14785bd52b9bed9d665817113e1d0af
Author: Armin Weigl <tb46305@gmail.com>
Date: Tue, 23 Feb 2021 19:13:52 +0100
fix enum access for member import
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -2637,6 +2637,22 @@ load_import(struct ast_imports *import,
name.ns = NULL;
scope_insert(scope, obj->otype, &obj->ident,
&name, obj->type, obj->value);
+ if (type_dealias(obj->type)->storage != STORAGE_ENUM
+ || obj->otype != O_TYPE) {
+ continue;
+ };
+ for (struct scope_object *o = mod->objects;
+ o; o = o->next) {
+ if (!identifier_eq(o->name.ns, &o->name)) {
+ continue;
+ };
+ struct identifier n = {
+ .name = o->name.name,
+ .ns = &name,
+ };
+ scope_insert(scope, o->otype, &o->ident,
+ &n, o->type, o->value);
+ };
}
break;
}