commit 3e4e0d29e6182815116c9b0d0f0815e25fcac780
parent 8f49e56a9fabf7baea71baa5f4d6018f7e9a00ee
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 1 Feb 2021 17:26:33 -0500
check: add y::* to scope on import x::y::*
Diffstat:
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -1902,7 +1902,19 @@ load_import(struct ast_imports *import,
for (struct scope_object *obj = mod->objects;
obj; obj = obj->next) {
scope_insert(scope, obj->otype, &obj->ident,
- &obj->name, obj->type, obj->value);
+ &obj->name, obj->type, obj->value);
+ if (obj->ident.ns && obj->ident.ns->ns) {
+ struct identifier ns = {
+ .name = obj->ident.ns->name,
+ .ns = NULL
+ };
+ struct identifier name = {
+ .name = obj->ident.name,
+ .ns = &ns,
+ };
+ scope_insert(scope, obj->otype, &obj->ident,
+ &name, obj->type, obj->value);
+ }
}
break;
case AST_IMPORT_ALIAS:
diff --git a/src/type_store.c b/src/type_store.c
@@ -386,7 +386,7 @@ type_init_from_atype(struct type_store *store,
break;
}
- identifier_dup(&type->alias.ident, ident);
+ identifier_dup(&type->alias.ident, &obj->ident);
type->alias.type = obj->type;
type->size = type->alias.type->size;
type->align = type->alias.type->align;