Fix edge case in cast between fn with varargs

* Prevent the next_param_index to become greater than the param_count
  one as it's expected by every other function.
* Fix a typo in a error message.

Closes #4381
This commit is contained in:
LemonBoy
2020-02-05 20:31:18 +01:00
parent b022db16ec
commit 21932a0ef2
3 changed files with 14 additions and 3 deletions

View File

@@ -806,7 +806,7 @@ static AstNode *ast_parse_fn_proto(ParseContext *pc) {
if (param_decl->data.param_decl.is_var_args)
res->data.fn_proto.is_var_args = true;
if (i != params.length - 1 && res->data.fn_proto.is_var_args)
ast_error(pc, first, "Function prototype have varargs as a none last paramter.");
ast_error(pc, first, "Function prototype have varargs as a none last parameter.");
}
return res;
}