From b885629239d04d2860a8853799a3d335d8bec154 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sat, 17 Jan 2026 15:33:18 +0000 Subject: Add support for mixin method dispatch. --- src/parser/parser_stmt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/parser/parser_stmt.c') 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) { -- cgit v1.2.3