From d2461482caf9e93d6e2bc7ff17567102f635211a Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sun, 11 Jan 2026 17:16:40 +0000 Subject: Fixed some things. Next thing will be tests. --- src/codegen/codegen_utils.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/codegen/codegen_utils.c') diff --git a/src/codegen/codegen_utils.c b/src/codegen/codegen_utils.c index fac6c6d..5dcbf19 100644 --- a/src/codegen/codegen_utils.c +++ b/src/codegen/codegen_utils.c @@ -1,12 +1,12 @@ -#include -#include -#include -#include -#include "codegen.h" -#include "../zprep.h" #include "../ast/ast.h" #include "../parser/parser.h" +#include "../zprep.h" +#include "codegen.h" +#include +#include +#include +#include // Global state ASTNode *global_user_structs = NULL; @@ -44,7 +44,7 @@ ASTNode *find_struct_def_codegen(ParserContext *ctx, const char *name) ASTNode *s = global_user_structs; while (s) { - if (s->type == NODE_STRUCT && strcmp(s->strct.name, name) == 0) + if (s->type == NODE_STRUCT && strcmp(s->strct.name, name) == 0 && !s->strct.is_incomplete) { return s; } @@ -55,7 +55,8 @@ ASTNode *find_struct_def_codegen(ParserContext *ctx, const char *name) StructRef *sr = ctx->parsed_structs_list; while (sr) { - if (sr->node && sr->node->type == NODE_STRUCT && strcmp(sr->node->strct.name, name) == 0) + if (sr->node && sr->node->type == NODE_STRUCT && strcmp(sr->node->strct.name, name) == 0 && + !sr->node->strct.is_incomplete) { return sr->node; } @@ -64,7 +65,7 @@ ASTNode *find_struct_def_codegen(ParserContext *ctx, const char *name) s = ctx->instantiated_structs; while (s) { - if (s->type == NODE_STRUCT && strcmp(s->strct.name, name) == 0) + if (s->type == NODE_STRUCT && strcmp(s->strct.name, name) == 0 && !s->strct.is_incomplete) { return s; } -- cgit v1.2.3