Mercurial > vim
diff src/vim9execute.c @ 24808:0bc60e26a2b5 v8.2.2942
patch 8.2.2942: Vim9: error when calling function with too few arguments
Commit: https://github.com/vim/vim/commit/8da6d6db340069b3307e6bce3cdd40441197efce
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 5 18:15:09 2021 +0200
patch 8.2.2942: Vim9: error when calling function with too few arguments
Problem: Vim9: internal error when calling function with too few arguments
Solution: Check for argument count to be too few. (closes https://github.com/vim/vim/issues/8325)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 05 Jun 2021 18:30:03 +0200 |
parents | 28127371aa18 |
children | 30095f94d081 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -4234,6 +4234,14 @@ call_def_function( semsg(_(e_nr_arguments_too_many), idx); goto failed_early; } + else if (idx < 0) + { + if (idx == -1) + emsg(_(e_one_argument_too_few)); + else + semsg(_(e_nr_arguments_too_few), -idx); + goto failed_early; + } // Put arguments on the stack, but no more than what the function expects. // A lambda can be called with more arguments than it uses.