summaryrefslogtreecommitdiff
path: root/src/parser/parser_stmt.c
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-17 15:33:18 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-17 15:33:18 +0000
commitb885629239d04d2860a8853799a3d335d8bec154 (patch)
tree98ee21d5e7ef791948456da4f23e6b5bb496de7f /src/parser/parser_stmt.c
parente0cf5aca2a17fae1f89860d5106aa901dde32782 (diff)
Add support for mixin method dispatch.
Diffstat (limited to 'src/parser/parser_stmt.c')
-rw-r--r--src/parser/parser_stmt.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c
index c9b144d..ca8cd8f 100644
--- a/src/parser/parser_stmt.c
+++ b/src/parser/parser_stmt.c
@@ -3268,6 +3268,10 @@ ASTNode *parse_struct(ParserContext *ctx, Lexer *l, int is_union)
lexer_next(l); // eat {
ASTNode *h = 0, *tl = 0;
+ // Temp storage for used structs
+ char **temp_used_structs = NULL;
+ int temp_used_count = 0;
+
while (1)
{
skip_comments(l);
@@ -3308,6 +3312,12 @@ ASTNode *parse_struct(ParserContext *ctx, Lexer *l, int is_union)
if (def && def->type == NODE_STRUCT)
{
+ if (!temp_used_structs)
+ {
+ temp_used_structs = xmalloc(sizeof(char *) * 8);
+ }
+ temp_used_structs[temp_used_count++] = xstrdup(use_name);
+
ASTNode *f = def->strct.fields;
while (f)
{
@@ -3410,6 +3420,8 @@ ASTNode *parse_struct(ParserContext *ctx, Lexer *l, int is_union)
node->strct.generic_params = gps;
node->strct.generic_param_count = gp_count;
node->strct.is_union = is_union;
+ node->strct.used_structs = temp_used_structs;
+ node->strct.used_struct_count = temp_used_count;
if (gp_count > 0)
{