1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2020-04-07 22:05:08 +02:00
parent ec5929d0fe
commit 0b76b42d0a
4 changed files with 58 additions and 2 deletions

View File

@@ -3020,7 +3020,7 @@ ex_function(exarg_T *eap)
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 @@ ex_function(exarg_T *eap)
// 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;