comparison 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
comparison
equal deleted inserted replaced
23690:90a28e0d556f 23691:0d56d4f107d8
3240 { 3240 {
3241 checktype_T *ct = &iptr->isn_arg.type; 3241 checktype_T *ct = &iptr->isn_arg.type;
3242 3242
3243 tv = STACK_TV_BOT(ct->ct_off); 3243 tv = STACK_TV_BOT(ct->ct_off);
3244 SOURCING_LNUM = iptr->isn_lnum; 3244 SOURCING_LNUM = iptr->isn_lnum;
3245 if (check_typval_type(ct->ct_type, tv, 0) == FAIL) 3245 if (check_typval_type(ct->ct_type, tv, ct->ct_arg_idx)
3246 == FAIL)
3246 goto on_error; 3247 goto on_error;
3247 3248
3248 // number 0 is FALSE, number 1 is TRUE 3249 // number 0 is FALSE, number 1 is TRUE
3249 if (tv->v_type == VAR_NUMBER 3250 if (tv->v_type == VAR_NUMBER
3250 && ct->ct_type->tt_type == VAR_BOOL 3251 && ct->ct_type->tt_type == VAR_BOOL
4233 case ISN_NEGATENR: smsg("%4d NEGATENR", current); break; 4234 case ISN_NEGATENR: smsg("%4d NEGATENR", current); break;
4234 4235
4235 case ISN_CHECKNR: smsg("%4d CHECKNR", current); break; 4236 case ISN_CHECKNR: smsg("%4d CHECKNR", current); break;
4236 case ISN_CHECKTYPE: 4237 case ISN_CHECKTYPE:
4237 { 4238 {
4239 checktype_T *ct = &iptr->isn_arg.type;
4238 char *tofree; 4240 char *tofree;
4239 4241
4240 smsg("%4d CHECKTYPE %s stack[%d]", current, 4242 if (ct->ct_arg_idx == 0)
4241 type_name(iptr->isn_arg.type.ct_type, &tofree), 4243 smsg("%4d CHECKTYPE %s stack[%d]", current,
4242 iptr->isn_arg.type.ct_off); 4244 type_name(ct->ct_type, &tofree),
4245 (int)ct->ct_off);
4246 else
4247 smsg("%4d CHECKTYPE %s stack[%d] arg %d", current,
4248 type_name(ct->ct_type, &tofree),
4249 (int)ct->ct_off,
4250 (int)ct->ct_arg_idx);
4243 vim_free(tofree); 4251 vim_free(tofree);
4244 break; 4252 break;
4245 } 4253 }
4246 case ISN_CHECKLEN: smsg("%4d CHECKLEN %s%d", current, 4254 case ISN_CHECKLEN: smsg("%4d CHECKLEN %s%d", current,
4247 iptr->isn_arg.checklen.cl_more_OK ? ">= " : "", 4255 iptr->isn_arg.checklen.cl_more_OK ? ">= " : "",