summaryrefslogtreecommitdiff
path: root/src/textprop.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-08-30 19:48:24 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-30 19:48:24 +0100
commit04c4c5746e15884768d2cb41370c3276a196cd4c (patch)
tree1e629820796635bd332b2066c03d548fad527f89 /src/textprop.c
parentf240395fca63d4b330112a4b81e94b05b50de1aa (diff)
downloadvim-git-04c4c5746e15884768d2cb41370c3276a196cd4c.tar.gz
patch 9.0.0335: checks for Dictionary argument often give a vague errorv9.0.0335
Problem: Checks for Dictionary argument often give a vague error message. Solution: Give a useful error message. (Yegappan Lakshmanan, closes #11009)
Diffstat (limited to 'src/textprop.c')
-rw-r--r--src/textprop.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/textprop.c b/src/textprop.c
index 0ba5c20b3..de3344f89 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -149,11 +149,8 @@ f_prop_add(typval_T *argvars, typval_T *rettv)
start_lnum = tv_get_number(&argvars[0]);
start_col = tv_get_number(&argvars[1]);
- if (argvars[2].v_type != VAR_DICT)
- {
- emsg(_(e_dictionary_required));
+ if (check_for_dict_arg(argvars, 2) == FAIL)
return;
- }
rettv->vval.v_number = prop_add_common(start_lnum, start_col,
argvars[2].vval.v_dict, curbuf, &argvars[2]);
@@ -1045,11 +1042,8 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
|| check_for_opt_string_arg(argvars, 1) == FAIL))
return;
- if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL)
- {
- emsg(_(e_dictionary_required));
+ if (check_for_nonnull_dict_arg(argvars, 0) == FAIL)
return;
- }
dict = argvars[0].vval.v_dict;
if (get_bufnr_from_arg(&argvars[0], &buf) == FAIL)
@@ -1396,11 +1390,8 @@ f_prop_list(typval_T *argvars, typval_T *rettv)
{
dict_T *d;
- if (argvars[1].v_type != VAR_DICT)
- {
- emsg(_(e_dictionary_required));
+ if (check_for_dict_arg(argvars, 1) == FAIL)
return;
- }
d = argvars[1].vval.v_dict;
if (get_bufnr_from_arg(&argvars[1], &buf) == FAIL)
@@ -1499,11 +1490,8 @@ f_prop_remove(typval_T *argvars, typval_T *rettv)
&& check_for_opt_number_arg(argvars, 2) == FAIL)))
return;
- if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL)
- {
- emsg(_(e_invalid_argument));
+ if (check_for_nonnull_dict_arg(argvars, 0) == FAIL)
return;
- }
if (argvars[1].v_type != VAR_UNKNOWN)
{