commit cf8784d820bc8b8b97fc1a6eee4e93d37c512833
parent 3c083f52bc45cf51e3bdf943585ac8ce412ec3d6
Author: Armin Weigl <tb46305@gmail.com>
Date: Tue, 23 Feb 2021 19:13:51 +0100
fix enum access for alias import
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -2601,10 +2601,18 @@ load_import(struct ast_imports *import,
case AST_IMPORT_ALIAS:
for (struct scope_object *obj = mod->objects;
obj; obj = obj->next) {
+ struct identifier ns = {
+ .name = obj->name.ns->name,
+ .ns = import->alias,
+ };
struct identifier name = {
.name = obj->name.name,
.ns = import->alias,
};
+ if (type_dealias(obj->type)->storage == STORAGE_ENUM
+ && obj->otype == O_CONST) {
+ name.ns = &ns;
+ };
scope_insert(scope, obj->otype, &obj->ident,
&name, obj->type, obj->value);
}