summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 11a698f..b56895a 100644
--- a/parse.c
+++ b/parse.c
@@ -822,12 +822,21 @@ static bool parse_fn_expr(Parser *p, FnExpr *f) {
} else {
if (!parse_decl_list(p, &f->params, DECL_END_RPAREN_COMMA))
return false;
+ Declaration *new_params = NULL;
arr_foreach(f->params, Declaration, param) {
if (param->type.kind == TYPE_TUPLE) {
err_print(param->where, "Functions can't have tuple parameters.");
return false;
}
+ /* whenever there's (x, y: int), turn it into (x: int, y: int) */
+ arr_foreach(param->idents, Identifier, ident) {
+ Declaration *new_param = parser_arr_add(p, &new_params);
+ *new_param = *param;
+ new_param->idents = NULL;
+ *(Identifier *)parser_arr_add(p, &new_param->idents) = *ident;
+ }
}
+ f->params = new_params;
arr_foreach(f->params, Declaration, param)
param->flags |= DECL_IS_PARAM;
}