diff src/userfunc.c @ 24272:cabed216cc2f v8.2.2677

patch 8.2.2677: Vim9: cannot use only some of the default arguments Commit: https://github.com/vim/vim/commit/38a3bfa9a2931729a5e0c28dc087f745b68988ef Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 29 22:14:55 2021 +0200 patch 8.2.2677: Vim9: cannot use only some of the default arguments Problem: Vim9: cannot use only some of the default arguments. Solution: Use v:none to use default argument value. Remove uf_def_arg_idx[], use JUMP_IF_ARG_SET. (closes #6504)
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 Mar 2021 22:15:03 +0200
parents 827fcf174f15
children 2b4883926a24
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1914,7 +1914,6 @@ func_clear_items(ufunc_T *fp)
     ga_clear_strings(&(fp->uf_def_args));
     ga_clear_strings(&(fp->uf_lines));
     VIM_CLEAR(fp->uf_arg_types);
-    VIM_CLEAR(fp->uf_def_arg_idx);
     VIM_CLEAR(fp->uf_block_ids);
     VIM_CLEAR(fp->uf_va_name);
     clear_type_list(&fp->uf_type_list);
@@ -2049,14 +2048,6 @@ copy_func(char_u *lambda, char_u *global
 	mch_memmove(fp->uf_arg_types, ufunc->uf_arg_types,
 				    sizeof(type_T *) * fp->uf_args.ga_len);
     }
-    if (ufunc->uf_def_arg_idx != NULL)
-    {
-	fp->uf_def_arg_idx = ALLOC_MULT(int, fp->uf_def_args.ga_len + 1);
-	if (fp->uf_def_arg_idx == NULL)
-	    goto failed;
-	mch_memmove(fp->uf_def_arg_idx, ufunc->uf_def_arg_idx,
-				 sizeof(int) * fp->uf_def_args.ga_len + 1);
-    }
     if (ufunc->uf_va_name != NULL)
     {
 	fp->uf_va_name = vim_strsave(ufunc->uf_va_name);