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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user