summaryrefslogtreecommitdiffstats
path: root/src/typval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-01 12:22:46 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-01 12:22:46 +0100
commitd83392a43a48c566c0f3b76382a3648584dae32b (patch)
treeba5c2d376a386d524190fd0f7565c3af1b624701 /src/typval.c
parente42c8dae32f3575557b83a371c4be66c09afbf7f (diff)
patch 9.0.0345: error message for list argument could be clearerv9.0.0345
Problem: Error message for list argument could be clearer. Solution: Include the argument number. (Yegappan Lakshmanan, closes #11027)
Diffstat (limited to 'src/typval.c')
-rw-r--r--src/typval.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/typval.c b/src/typval.c
index 101f48f34a..12a741ec22 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -509,6 +509,23 @@ check_for_list_arg(typval_T *args, int idx)
}
/*
+ * Give an error and return FAIL unless "args[idx]" is a non-NULL list.
+ */
+ int
+check_for_nonnull_list_arg(typval_T *args, int idx)
+{
+ if (check_for_list_arg(args, idx) == FAIL)
+ return FAIL;
+
+ if (args[idx].vval.v_list == NULL)
+ {
+ semsg(_(e_non_null_list_required_for_argument_nr), idx + 1);
+ return FAIL;
+ }
+ return OK;
+}
+
+/*
* Check for an optional list argument at 'idx'
*/
int