summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-22 14:58:47 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-22 14:58:47 +0200
commit7a3fe3e180bdbce8f193abdf399559c5154bdaae (patch)
tree842eac4734c81db7a49ddaaf20b4fea732bb8162 /src/vim9execute.c
parenta74901929e999a0052c1ce388ab09359c10cbb0d (diff)
downloadvim-git-7a3fe3e180bdbce8f193abdf399559c5154bdaae.tar.gz
patch 8.2.3200: Vim9: hard to guess where a type error is givenv8.2.3200
Problem: Vim9: hard to guess where a type error is given. Solution: Add the function name where possible. (closes #8608)
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 6cc1fc7e9..33ad788a2 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -730,15 +730,18 @@ call_bfunc(int func_idx, int argcount, ectx_T *ectx)
int idx;
int did_emsg_before = did_emsg;
ectx_T *prev_ectx = current_ectx;
+ char *save_func_name = ectx->ec_where.wt_func_name;
if (call_prepare(argcount, argvars, ectx) == FAIL)
return FAIL;
+ ectx->ec_where.wt_func_name = internal_func_name(func_idx);
// Call the builtin function. Set "current_ectx" so that when it
// recursively invokes call_def_function() a closure context can be set.
current_ectx = ectx;
call_internal_func_by_idx(func_idx, argvars, STACK_TV_BOT(-1));
current_ectx = prev_ectx;
+ ectx->ec_where.wt_func_name = save_func_name;
// Clear the arguments.
for (idx = 0; idx < argcount; ++idx)
@@ -907,7 +910,7 @@ call_by_name(
else if (ufunc->uf_va_type != NULL)
type = ufunc->uf_va_type->tt_member;
if (type != NULL && check_typval_arg_type(type,
- &argv[i], i + 1) == FAIL)
+ &argv[i], NULL, i + 1) == FAIL)
return FAIL;
}
}
@@ -4535,7 +4538,8 @@ call_def_function(
{
if (ufunc->uf_arg_types != NULL && idx < ufunc->uf_args.ga_len
&& check_typval_arg_type(
- ufunc->uf_arg_types[idx], &argv[idx], idx + 1) == FAIL)
+ ufunc->uf_arg_types[idx], &argv[idx],
+ NULL, idx + 1) == FAIL)
goto failed_early;
copy_tv(&argv[idx], STACK_TV_BOT(0));
}
@@ -4567,7 +4571,7 @@ call_def_function(
for (idx = 0; idx < vararg_count; ++idx)
{
if (check_typval_arg_type(expected, &li->li_tv,
- argc + idx + 1) == FAIL)
+ NULL, argc + idx + 1) == FAIL)
goto failed_early;
li = li->li_next;
}