Mercurial > vim
diff src/filepath.c @ 25356:1cde96e768e4 v8.2.3215
patch 8.2.3215: Vim9: argument types are not checked at compile time
Commit: https://github.com/vim/vim/commit/5bca906b307728fa74a112914dc55b424d512d39
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Jul 24 21:33:26 2021 +0200
patch 8.2.3215: Vim9: argument types are not checked at compile time
Problem: Vim9: argument types are not checked at compile time.
Solution: Add several more type checks. Sort the argument lists.
(Yegappan Lakshmanan, closes #8626)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Jul 2021 21:45:04 +0200 |
parents | e2be9f3c5907 |
children | e8e2c4d33b9b |
line wrap: on
line diff
--- a/src/filepath.c +++ b/src/filepath.c @@ -1602,6 +1602,13 @@ f_readdir(typval_T *argvars, typval_T *r if (rettv_list_alloc(rettv) == FAIL) return; + + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_dict_arg(argvars, 2) == FAIL))) + return; + path = tv_get_string(&argvars[0]); expr = &argvars[1]; @@ -1648,6 +1655,13 @@ f_readdirex(typval_T *argvars, typval_T if (rettv_list_alloc(rettv) == FAIL) return; + + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_dict_arg(argvars, 2) == FAIL))) + return; + path = tv_get_string(&argvars[0]); expr = &argvars[1];