0
0
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:
Yegappan Lakshmanan
2021-07-15 12:49:58 +02:00
committed by Bram Moolenaar
parent c816a2c226
commit 1a71d31bf3
22 changed files with 780 additions and 269 deletions

View File

@@ -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.
*/