0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.0335: checks for Dictionary argument often give a vague error

Problem:    Checks for Dictionary argument often give a vague error message.
Solution:   Give a useful error message. (Yegappan Lakshmanan, closes #11009)
This commit is contained in:
Yegappan Lakshmanan
2022-08-30 19:48:24 +01:00
committed by Bram Moolenaar
parent f240395fca
commit 04c4c5746e
32 changed files with 128 additions and 183 deletions

View File

@@ -532,6 +532,23 @@ check_for_dict_arg(typval_T *args, int idx)
return OK;
}
/*
* Give an error and return FAIL unless "args[idx]" is a non-NULL dict.
*/
int
check_for_nonnull_dict_arg(typval_T *args, int idx)
{
if (check_for_dict_arg(args, idx) == FAIL)
return FAIL;
if (args[idx].vval.v_dict == NULL)
{
semsg(_(e_non_null_dict_required_for_argument_nr), idx + 1);
return FAIL;
}
return OK;
}
/*
* Check for an optional dict argument at 'idx'
*/
@@ -1179,7 +1196,7 @@ typval_compare(
if (type_is && tv1->v_type != tv2->v_type)
{
// For "is" a different type always means FALSE, for "notis"
// For "is" a different type always means FALSE, for "isnot"
// it means TRUE.
n1 = (type == EXPR_ISNOT);
}