From 3704ce90083862680f7768916e1a40ddb85e833d Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sat, 17 Jan 2026 10:53:58 +0000 Subject: Fix for #59 --- src/codegen/codegen.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/codegen') diff --git a/src/codegen/codegen.c b/src/codegen/codegen.c index 9e85464..370bcec 100644 --- a/src/codegen/codegen.c +++ b/src/codegen/codegen.c @@ -1066,7 +1066,28 @@ void codegen_expression(ParserContext *ctx, ASTNode *node, FILE *out) { struct_name = g_current_impl_type; } - fprintf(out, "(struct %s){", struct_name); + + int is_zen_struct = 0; + StructRef *sr = ctx->parsed_structs_list; + while (sr) + { + if (sr->node && sr->node->type == NODE_STRUCT && + strcmp(sr->node->strct.name, struct_name) == 0) + { + is_zen_struct = 1; + break; + } + sr = sr->next; + } + + if (is_zen_struct) + { + fprintf(out, "(struct %s){", struct_name); + } + else + { + fprintf(out, "(%s){", struct_name); + } ASTNode *f = node->struct_init.fields; while (f) { -- cgit v1.2.3