commit 85af47577722edada7a86ec0e9485a47c15379e8
parent 2f5917555ce38030b15a566afa7e5124fb07a70a
Author: Eyal Sawady <ecs@d2evs.net>
Date: Tue, 23 Feb 2021 20:04:05 -0500
Actually fix enum access for member import
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -2632,10 +2632,13 @@ load_import(struct ast_imports *import,
member; member = member->next) {
struct identifier name = {
.name = member->ident.name,
+ .ns = NULL,
+ };
+ struct identifier ident = {
+ .name = member->ident.name,
.ns = &import->ident,
};
- const struct scope_object *obj = scope_lookup(mod, &name);
- name.ns = NULL;
+ const struct scope_object *obj = scope_lookup(mod, &ident);
scope_insert(scope, obj->otype, &obj->ident,
&name, obj->type, obj->value);
if (type_dealias(obj->type)->storage != STORAGE_ENUM
@@ -2644,7 +2647,7 @@ load_import(struct ast_imports *import,
};
for (struct scope_object *o = mod->objects;
o; o = o->next) {
- if (!identifier_eq(o->name.ns, &o->name)) {
+ if (!identifier_eq(o->name.ns, &ident)) {
continue;
};
struct identifier n = {