0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -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

@@ -2278,6 +2278,9 @@ f_sign_getdefined(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc_id(rettv, aid_sign_getdefined) != OK)
return;
if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
return;
if (argvars[0].v_type != VAR_UNKNOWN)
{
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
@@ -2573,6 +2576,9 @@ f_sign_placelist(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
return;
if (argvars[0].v_type != VAR_LIST)
{
emsg(_(e_listreq));
@@ -2620,6 +2626,10 @@ f_sign_undefine(typval_T *argvars, typval_T *rettv)
{
char_u *name;
if (in_vim9script()
&& check_for_opt_string_or_list_arg(argvars, 0) == FAIL)
return;
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
{
// Undefine multiple signs
@@ -2761,6 +2771,11 @@ f_sign_unplace(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = -1;
if (in_vim9script()
&& (check_for_string_arg(argvars, 0) == FAIL
|| check_for_opt_dict_arg(argvars, 1) == FAIL))
return;
if (argvars[0].v_type != VAR_STRING)
{
emsg(_(e_invarg));
@@ -2792,6 +2807,9 @@ f_sign_unplacelist(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
return;
if (argvars[0].v_type != VAR_LIST)
{
emsg(_(e_listreq));