Mercurial > vim
diff src/userfunc.c @ 19912:d4fa9db88d16 v8.2.0512
patch 8.2.0512: Vim9: no optional arguments in func type
Commit: https://github.com/vim/vim/commit/5deeb3f1f9db4eabd36e99cbf857fe376eb37e10
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 5 17:08:17 2020 +0200
patch 8.2.0512: Vim9: no optional arguments in func type
Problem: Vim9: no optional arguments in func type.
Solution: Check for question mark after type. Find function reference
without function().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 05 Apr 2020 17:15:25 +0200 |
parents | ff89394116ea |
children | 3ff714d765ba |
line wrap: on
line diff
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -951,6 +951,9 @@ func_clear_items(ufunc_T *fp) VIM_CLEAR(fp->uf_arg_types); VIM_CLEAR(fp->uf_def_arg_idx); VIM_CLEAR(fp->uf_va_name); + while (fp->uf_type_list.ga_len > 0) + vim_free(((type_T **)fp->uf_type_list.ga_data) + [--fp->uf_type_list.ga_len]); ga_clear(&fp->uf_type_list); #ifdef FEAT_PROFILE VIM_CLEAR(fp->uf_tml_count); @@ -3013,6 +3016,7 @@ ex_function(exarg_T *eap) fp->uf_args = newargs; fp->uf_def_args = default_args; fp->uf_ret_type = &t_any; + fp->uf_func_type = &t_func_any; if (eap->cmdidx == CMD_def) { @@ -3022,7 +3026,7 @@ ex_function(exarg_T *eap) SOURCING_LNUM = sourcing_lnum_top; // parse the argument types - ga_init2(&fp->uf_type_list, sizeof(type_T), 5); + ga_init2(&fp->uf_type_list, sizeof(type_T *), 10); if (argtypes.ga_len > 0) {