diff src/if_cscope.c @ 25348:75031a22be39 v8.2.3211

patch 8.2.3211: Vim9: argument types are not checked at compile time Commit: https://github.com/vim/vim/commit/7973de35ba6840b7e106e2e8a8912522e9a2a960 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Jul 24 16:16:15 2021 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Jul 2021 16:30:03 +0200
parents c4298ed56ffa
children 336e2d9924e6
line wrap: on
line diff
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -2496,6 +2496,14 @@ f_cscope_connection(typval_T *argvars UN
     char_u	*prepend = NULL;
     char_u	buf[NUMBUFLEN];
 
+    if (in_vim9script()
+	    && (check_for_opt_number_arg(argvars, 0) == FAIL
+		|| (argvars[0].v_type != VAR_UNKNOWN
+		    && (check_for_opt_string_arg(argvars, 1) == FAIL
+			|| (argvars[1].v_type != VAR_UNKNOWN
+			    && check_for_opt_string_arg(argvars, 2) == FAIL)))))
+	return;
+
     if (argvars[0].v_type != VAR_UNKNOWN
 	    && argvars[1].v_type != VAR_UNKNOWN)
     {