diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-17 10:53:58 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-17 10:53:58 +0000 |
| commit | 3704ce90083862680f7768916e1a40ddb85e833d (patch) | |
| tree | c3ba73a759f4357ec0a722114f5a0aa0bc06a14b /src/codegen | |
| parent | 42d955d21eb9a809bcdac6d7e8d27566b2b49da7 (diff) | |
Fix for #59
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/codegen.c | 23 |
1 files changed, 22 insertions, 1 deletions
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) { |
