0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.0625: Vim9: confusing error when calling unknown function

Problem:    Vim9: confusing error when calling unknown function.
Solution:   Give error while compiling.
This commit is contained in:
Bram Moolenaar
2020-04-23 18:13:23 +02:00
parent a72cfb80cd
commit 1df8b3fb04
4 changed files with 40 additions and 18 deletions

View File

@@ -460,13 +460,20 @@ call_eval_func(char_u *name, int argcount, ectx_T *ectx, isn_T *iptr)
if (call_by_name(name, argcount, ectx, iptr) == FAIL
&& called_emsg == called_emsg_before)
{
// "name" may be a variable that is a funcref or partial
// if find variable
// call_partial()
// else
// semsg(_(e_unknownfunc), name);
emsg("call_eval_func(partial) not implemented yet");
return FAIL;
dictitem_T *v;
v = find_var(name, NULL, FALSE);
if (v == NULL)
{
semsg(_(e_unknownfunc), name);
return FAIL;
}
if (v->di_tv.v_type != VAR_PARTIAL && v->di_tv.v_type != VAR_FUNC)
{
semsg(_(e_unknownfunc), name);
return FAIL;
}
return call_partial(&v->di_tv, argcount, ectx);
}
return OK;
}