summaryrefslogtreecommitdiff
path: root/src/typval.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-07-24 16:16:15 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-24 16:16:15 +0200
commit7973de35ba6840b7e106e2e8a8912522e9a2a960 (patch)
tree8e8a1848f52a82af0a31111a0846c319a9544dd7 /src/typval.c
parentdd0b287c1ec8314034a2dbb14c4267994c47520c (diff)
downloadvim-git-7973de35ba6840b7e106e2e8a8912522e9a2a960.tar.gz
patch 8.2.3211: Vim9: argument types are not checked at compile timev8.2.3211
Problem: Vim9: argument types are not checked at compile time. Solution: Add several more type checks. Fix type check for matchaddpos(). (Yegappan Lakshmanan, closes #8619)
Diffstat (limited to 'src/typval.c')
-rw-r--r--src/typval.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/typval.c b/src/typval.c
index e22dd3bbe..61f8eb55b 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -523,6 +523,17 @@ check_for_chan_or_job_arg(typval_T *args, int idx)
}
/*
+ * Give an error and return FAIL unless "args[idx]" is an optional channel or a
+ * job.
+ */
+ int
+check_for_opt_chan_or_job_arg(typval_T *args, int idx)
+{
+ return (args[idx].v_type == VAR_UNKNOWN
+ || check_for_chan_or_job_arg(args, idx) != FAIL);
+}
+
+/*
* Give an error and return FAIL unless "args[idx]" is a job.
*/
int