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

patch 8.2.3894: Vim9: no proper type check for first argument of call()

Problem:    Vim9: no proper type check for first argument of call().
Solution:   Add specific type check.
This commit is contained in:
Bram Moolenaar
2021-12-25 19:29:21 +00:00
parent 5cd647935d
commit 223d0a6bc8
6 changed files with 27 additions and 1 deletions

View File

@@ -756,6 +756,23 @@ check_for_string_or_list_or_dict_arg(typval_T *args, int idx)
return OK;
}
/*
* Give an error and return FAIL unless "args[idx]" is a string
* or a function reference.
*/
int
check_for_string_or_func_arg(typval_T *args, int idx)
{
if (args[idx].v_type != VAR_PARTIAL
&& args[idx].v_type != VAR_FUNC
&& args[idx].v_type != VAR_STRING)
{
semsg(_(e_string_or_function_required_for_argument_nr), idx + 1);
return FAIL;
}
return OK;
}
/*
* Give an error and return FAIL unless "args[idx]" is a list or a blob.
*/