diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-06-05 18:49:38 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-06-05 18:49:38 +0200 |
commit | c6d71532dda0b3a244907bb5d1826f9340f7571d (patch) | |
tree | c7c2d985bdb43c3c36dc28422464a3ca71c79dc5 /src/vim9execute.c | |
parent | 8da6d6db340069b3307e6bce3cdd40441197efce (diff) |
patch 8.2.2943: Vim9: check for argument count ignores default valuesv8.2.2943
Problem: Vim9: check for argument count ignores default values.
Solution: Take default argument values into account.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r-- | src/vim9execute.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c index c2a7de50d6..455a205070 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -4234,7 +4234,8 @@ call_def_function( semsg(_(e_nr_arguments_too_many), idx); goto failed_early; } - else if (idx < 0) + idx = argc - ufunc->uf_args.ga_len + ufunc->uf_def_args.ga_len; + if (idx < 0) { if (idx == -1) emsg(_(e_one_argument_too_few)); |