patch 8.2.0528: Vim9: function arguments insufficiently tested
Problem: Vim9: function arguments insufficiently tested.
Solution: Check types. Add more tests. Fix function with varargs only.
diff --git a/src/userfunc.c b/src/userfunc.c
index f93c149..69a57c2 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3020,7 +3020,7 @@
if (eap->cmdidx == CMD_def)
{
- int lnum_save = SOURCING_LNUM;
+ int lnum_save = SOURCING_LNUM;
// error messages are for the first function line
SOURCING_LNUM = sourcing_lnum_top;
@@ -3034,7 +3034,8 @@
// and uf_va_type.
int len = argtypes.ga_len - (varargs ? 1 : 0);
- fp->uf_arg_types = ALLOC_CLEAR_MULT(type_T *, len);
+ if (len > 0)
+ fp->uf_arg_types = ALLOC_CLEAR_MULT(type_T *, len);
if (fp->uf_arg_types != NULL)
{
int i;