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:
17
src/typval.c
17
src/typval.c
@@ -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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user