diff src/vim9execute.c @ 23691:0d56d4f107d8 v8.2.2387

patch 8.2.2387: runtime type check does not mention argument index Commit: https://github.com/vim/vim/commit/e32e516dfa46e9c5965d278f96aaf57573de8ac4 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 21 20:21:29 2021 +0100 patch 8.2.2387: runtime type check does not mention argument index Problem: Runtime type check does not mention argument index. Solution: Add ct_arg_idx. (closes https://github.com/vim/vim/issues/7720)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 Jan 2021 20:30:04 +0100
parents e7f5931b46ca
children e3d77689d356
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -3242,7 +3242,8 @@ call_def_function(
 
 		    tv = STACK_TV_BOT(ct->ct_off);
 		    SOURCING_LNUM = iptr->isn_lnum;
-		    if (check_typval_type(ct->ct_type, tv, 0) == FAIL)
+		    if (check_typval_type(ct->ct_type, tv, ct->ct_arg_idx)
+								       == FAIL)
 			goto on_error;
 
 		    // number 0 is FALSE, number 1 is TRUE
@@ -4235,11 +4236,18 @@ ex_disassemble(exarg_T *eap)
 	    case ISN_CHECKNR: smsg("%4d CHECKNR", current); break;
 	    case ISN_CHECKTYPE:
 		  {
+		      checktype_T *ct = &iptr->isn_arg.type;
 		      char *tofree;
 
-		      smsg("%4d CHECKTYPE %s stack[%d]", current,
-			      type_name(iptr->isn_arg.type.ct_type, &tofree),
-			      iptr->isn_arg.type.ct_off);
+		      if (ct->ct_arg_idx == 0)
+			  smsg("%4d CHECKTYPE %s stack[%d]", current,
+					  type_name(ct->ct_type, &tofree),
+					  (int)ct->ct_off);
+		      else
+			  smsg("%4d CHECKTYPE %s stack[%d] arg %d", current,
+					  type_name(ct->ct_type, &tofree),
+					  (int)ct->ct_off,
+					  (int)ct->ct_arg_idx);
 		      vim_free(tofree);
 		      break;
 		  }