0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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)
This commit is contained in:
Yegappan Lakshmanan
2021-07-24 21:33:26 +02:00
committed by Bram Moolenaar
parent 7d60384a00
commit 5bca906b30
8 changed files with 233 additions and 112 deletions

View File

@@ -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];