diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-01-11 16:30:39 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-01-11 16:30:39 +0200 |
| commit | 45b3531e29c1b596f1be123de94b7c618c92bf8a (patch) | |
| tree | 6fe6c326df6d8c8875a3ece1db17e9766030d579 /src/actualize.c | |
| parent | 47f1d503ec663f967302b3071177c40c431b3fdb (diff) | |
| download | ek-45b3531e29c1b596f1be123de94b7c618c92bf8a.tar.gz ek-45b3531e29c1b596f1be123de94b7c618c92bf8a.zip | |
multiple import stuff
Diffstat (limited to 'src/actualize.c')
| -rw-r--r-- | src/actualize.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/actualize.c b/src/actualize.c index 7f590c3..e17305c 100644 --- a/src/actualize.c +++ b/src/actualize.c @@ -343,9 +343,17 @@ static int analyze_visibility(struct scope *scope, struct ast *node) case AST_IMPORT: { const char *file = import_file(node); - return process_file(&scope, + int ret = process_file(&scope, (int)ast_flags(node, AST_FLAG_PUBLIC), file); + + if (ret == 0) + return 0; + + /** @todo should maybe make this some other type of error, kind + * of too busy atm */ + semantic_info(scope->fctx, node, "imported here"); + return ret; } case AST_IF: { @@ -823,6 +831,26 @@ static int expand_chain(struct ast *expd, struct ast *params, return expand_type(expd, params, types); } +static struct ast *chain_graft(struct ast *exists, struct ast *def, + struct ast *params, struct type *types) +{ + if (same_src(exists, def)) + return exists; + + assert(def->chain); + struct ast *graft = chain_graft(exists, def->chain, params, types); + if (!graft) + return NULL; + + struct ast *new = clone_ast(def); + new->chain = graft; + + if (expand_type(new, params, types)) + return NULL; + + return new; +} + static struct ast *maybe_expand_struct_cont(struct scope *scope, struct ast *def, struct src_loc loc, @@ -842,7 +870,7 @@ static struct ast *maybe_expand_struct_cont(struct scope *scope, struct ast *exists = file_scope_find_expd_struct(scope, base, args); if (exists) - return exists; + return chain_graft(exists, def, struct_params(base), args); if (!should_implement_list(scope, struct_params(base), loc, args)) return NULL; |
