summaryrefslogtreecommitdiff
path: root/src/parser/parser_expr.c
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-17 00:10:30 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-17 00:10:30 +0000
commitea160abc678e9578b5e140121a6d7c59a3b9dd06 (patch)
tree0ae4d0ed1449f74d6cc361a5f8787892c0789168 /src/parser/parser_expr.c
parenta5d5a97818fb4fbd26c4fb25a5c410b1a60a1b18 (diff)
Improved struct pointer codegen, template instantiation and docs...
Diffstat (limited to 'src/parser/parser_expr.c')
-rw-r--r--src/parser/parser_expr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/parser/parser_expr.c b/src/parser/parser_expr.c
index d0f3337..975d237 100644
--- a/src/parser/parser_expr.c
+++ b/src/parser/parser_expr.c
@@ -1464,7 +1464,10 @@ ASTNode *parse_primary(ParserContext *ctx, Lexer *l)
if (lexer_peek(&lookahead).type == TOK_RANGLE)
{
lexer_next(l);
- char *concrete_type = parse_type(ctx, l);
+ Type *formal_type = parse_type_formal(ctx, l);
+ char *concrete_type = type_to_string(formal_type); // mangled for naming
+ char *unmangled_type =
+ type_to_c_string(formal_type); // C-compatible for substitution
lexer_next(l);
int is_struct = 0;
@@ -1485,7 +1488,7 @@ ASTNode *parse_primary(ParserContext *ctx, Lexer *l)
if (is_struct)
{
- instantiate_generic(ctx, acc, concrete_type, t);
+ instantiate_generic(ctx, acc, concrete_type, unmangled_type, t);
char *clean_type = sanitize_mangled_name(concrete_type);
@@ -1498,7 +1501,8 @@ ASTNode *parse_primary(ParserContext *ctx, Lexer *l)
}
else
{
- char *m = instantiate_function_template(ctx, acc, concrete_type);
+ char *m =
+ instantiate_function_template(ctx, acc, concrete_type, unmangled_type);
if (m)
{
free(acc);