mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.3162: Vim9: argument types are not checked at compile time
Problem: Vim9: argument types are not checked at compile time. Solution: Add more type checks. (Yegappan Lakshmanan, closes #8560)
This commit is contained in:
committed by
Bram Moolenaar
parent
c816a2c226
commit
1a71d31bf3
17
src/typval.c
17
src/typval.c
@@ -384,6 +384,23 @@ check_for_nonempty_string_arg(typval_T *args, int idx)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Give an error and return FAIL unless "tv" is a number.
|
||||
*/
|
||||
int
|
||||
check_for_number_arg(typval_T *args, int idx)
|
||||
{
|
||||
if (args[idx].v_type != VAR_NUMBER)
|
||||
{
|
||||
if (idx >= 0)
|
||||
semsg(_(e_number_required_for_argument_nr), idx + 1);
|
||||
else
|
||||
emsg(_(e_numberreq));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Give an error and return FAIL unless "tv" is a dict.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user