0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -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

@@ -1193,6 +1193,11 @@ f_test_scrollbar(typval_T *argvars, typval_T *rettv UNUSED)
int dragging;
scrollbar_T *sb = NULL;
if (check_for_string_arg(argvars, 0) == FAIL
|| check_for_number_arg(argvars, 1) == FAIL
|| check_for_number_arg(argvars, 2) == FAIL)
return;
if (argvars[0].v_type != VAR_STRING
|| (argvars[1].v_type) != VAR_NUMBER
|| (argvars[2].v_type) != VAR_NUMBER)
@@ -1281,14 +1286,11 @@ f_test_gui_drop_files(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
list_T *l;
listitem_T *li;
if (argvars[0].v_type != VAR_LIST
|| (argvars[1].v_type) != VAR_NUMBER
|| (argvars[2].v_type) != VAR_NUMBER
|| (argvars[3].v_type) != VAR_NUMBER)
{
emsg(_(e_invarg));
if (check_for_list_arg(argvars, 0) == FAIL
|| check_for_number_arg(argvars, 1) == FAIL
|| check_for_number_arg(argvars, 2) == FAIL
|| check_for_number_arg(argvars, 3) == FAIL)
return;
}
row = tv_get_number(&argvars[1]);
col = tv_get_number(&argvars[2]);