From 7973de35ba6840b7e106e2e8a8912522e9a2a960 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sat, 24 Jul 2021 16:16:15 +0200 Subject: patch 8.2.3211: Vim9: argument types are not checked at compile time 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) --- src/typval.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/typval.c') diff --git a/src/typval.c b/src/typval.c index e22dd3bbe..61f8eb55b 100644 --- a/src/typval.c +++ b/src/typval.c @@ -522,6 +522,17 @@ check_for_chan_or_job_arg(typval_T *args, int idx) return OK; } +/* + * 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. */ -- cgit v1.2.1