about summary refs log tree commit diff
path: root/boot/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'boot/parse.c')
-rw-r--r--boot/parse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/boot/parse.c b/boot/parse.c
index 2b5d859..1cf08fd 100644
--- a/boot/parse.c
+++ b/boot/parse.c
@@ -407,6 +407,7 @@ parser_function_header_node(struct Parser* p, struct Parser_Error* error)
         CHECK_RETURN(parser_need(p, TOKEN_ROUND_OPEN, error), struct Tree_Function_Header);
 
     struct Tree_Function_Header header = { 0 };
+    struct Tree_Type* tail = nil;
     while (!parser_probe(p, TOKEN_ROUND_CLOSE)) {
         // TODO: correctly output parameter spans
         bool variadic = false;
@@ -432,7 +433,8 @@ parser_function_header_node(struct Parser* p, struct Parser_Error* error)
         if (!header.parameters_type_and_name)
             header.parameters_type_and_name = type;
         else
-            header.parameters_type_and_name->next = type;
+            tail->next = type;
+        tail = type;
 
         if (parser_probe(p, TOKEN_COMMA)) parser_next(p);
     }