0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.3229: Vim9: runtime and compile time type checks are not the same

Problem:    Vim9: runtime and compile time type checks are not the same.
Solution:   Add more runtime type checks for builtin functions. (Yegappan
            Lakshmanan, closes #8646)
This commit is contained in:
Yegappan Lakshmanan
2021-07-27 22:00:44 +02:00
committed by Bram Moolenaar
parent 5d7c2df536
commit 4490ec4e83
55 changed files with 1710 additions and 630 deletions

View File

@@ -545,6 +545,12 @@ f_histadd(typval_T *argvars UNUSED, typval_T *rettv)
rettv->vval.v_number = FALSE;
if (check_secure())
return;
if (in_vim9script()
&& (check_for_string_arg(argvars, 0) == FAIL
|| check_for_string_arg(argvars, 1) == FAIL))
return;
str = tv_get_string_chk(&argvars[0]); // NULL on type error
histype = str != NULL ? get_histtype(str) : -1;
if (histype >= 0)
@@ -630,9 +636,12 @@ f_histget(typval_T *argvars UNUSED, typval_T *rettv)
f_histnr(typval_T *argvars UNUSED, typval_T *rettv)
{
int i;
char_u *histname;
char_u *histname = tv_get_string_chk(&argvars[0]);
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
histname = tv_get_string_chk(&argvars[0]);
i = histname == NULL ? HIST_CMD - 1 : get_histtype(histname);
if (i >= HIST_CMD && i < HIST_COUNT)
i = get_history_idx(i);