wip: working on generator

- Feat: add typedefs' branches
This commit is contained in:
samsonium
2026-11-04 19:33:17 +03:00
parent 731b662cfc
commit 7fe3fe3ff3
7 changed files with 228 additions and 4 deletions
+30
View File
@@ -0,0 +1,30 @@
#include <common/fzl_types.h>
#include <compiler/internals/gen.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
// Type aliasing
bool gen_alias(fzl_gen_t *gen, fzl_node_t *node)
{
if (!gen || !node)
return false;
fzl_type_t type;
char typecn[256];
memset(typecn, 0, sizeof(typecn));
bool resolved = gen_resolve_type(gen, node->token, &type, typecn);
if (!resolved)
return false;
ssize_t slot = gen_resolve_extern_type(gen, typecn);
if (slot == -1)
type_buf.alias_target =
(fzl_extern_type_ref_t){.is_primitive = true, .primitive = type};
else
type_buf.alias_target =
(fzl_extern_type_ref_t){.is_primitive = false, .type_slot = slot};
return true;
}