diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2021-07-24 21:33:26 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-24 21:33:26 +0200 |
commit | 5bca906b307728fa74a112914dc55b424d512d39 (patch) | |
tree | 46c144eecea8b23bf66138a46029afa6f275bf85 /src/filepath.c | |
parent | 7d60384a00755e5c0112cebeb5e232fc133c9eca (diff) |
patch 8.2.3215: Vim9: argument types are not checked at compile timev8.2.3215
Problem: Vim9: argument types are not checked at compile time.
Solution: Add several more type checks. Sort the argument lists.
(Yegappan Lakshmanan, closes #8626)
Diffstat (limited to 'src/filepath.c')
-rw-r--r-- | src/filepath.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/filepath.c b/src/filepath.c index 900c5bd69c..989f56e537 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -1602,6 +1602,13 @@ f_readdir(typval_T *argvars, typval_T *rettv) 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 *rettv) 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]; |