diff src/sign.c @ 25384:e8e2c4d33b9b v8.2.3229

patch 8.2.3229: Vim9: runtime and compile time type checks are not the same Commit: https://github.com/vim/vim/commit/4490ec4e839e45a2e6923c265c7e9e64c240b805 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue Jul 27 22:00:44 2021 +0200 patch 8.2.3229: Vim9: runtime and compile time type checks are not the same Problem: Vim9: runtime and compile time type checks are not the same. Solution: Add more runtime type checks for builtin functions. (Yegappan Lakshmanan, closes #8646)
author Bram Moolenaar <Bram@vim.org>
date Tue, 27 Jul 2021 22:15:06 +0200
parents e2be9f3c5907
children 42723b535ab3
line wrap: on
line diff
--- a/src/sign.c
+++ b/src/sign.c
@@ -2278,6 +2278,9 @@ f_sign_getdefined(typval_T *argvars, typ
     if (rettv_list_alloc_id(rettv, aid_sign_getdefined) != OK)
 	return;
 
+    if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
+	return;
+
     if (argvars[0].v_type != VAR_UNKNOWN)
     {
 	if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
@@ -2573,6 +2576,9 @@ f_sign_placelist(typval_T *argvars, typv
     if (rettv_list_alloc(rettv) != OK)
 	return;
 
+    if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
+	return;
+
     if (argvars[0].v_type != VAR_LIST)
     {
 	emsg(_(e_listreq));
@@ -2620,6 +2626,10 @@ f_sign_undefine(typval_T *argvars, typva
 {
     char_u *name;
 
+    if (in_vim9script()
+	    && check_for_opt_string_or_list_arg(argvars, 0) == FAIL)
+	return;
+
     if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
     {
 	// Undefine multiple signs
@@ -2761,6 +2771,11 @@ f_sign_unplace(typval_T *argvars, typval
 
     rettv->vval.v_number = -1;
 
+    if (in_vim9script()
+	    && (check_for_string_arg(argvars, 0) == FAIL
+		|| check_for_opt_dict_arg(argvars, 1) == FAIL))
+	return;
+
     if (argvars[0].v_type != VAR_STRING)
     {
 	emsg(_(e_invarg));
@@ -2792,6 +2807,9 @@ f_sign_unplacelist(typval_T *argvars, ty
     if (rettv_list_alloc(rettv) != OK)
 	return;
 
+    if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
+	return;
+
     if (argvars[0].v_type != VAR_LIST)
     {
 	emsg(_(e_listreq));