summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-23 18:13:23 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-23 18:13:23 +0200
commit1df8b3fb04ce8732a0be680273c95eb4e9f5e85d (patch)
tree7beae0ff7191aac51a9ac83ba04226296f9fb6ec /src/vim9execute.c
parenta72cfb80cd7aa589ad2a4fb8766ed6d30ea8ae33 (diff)
downloadvim-git-1df8b3fb04ce8732a0be680273c95eb4e9f5e85d.tar.gz
patch 8.2.0625: Vim9: confusing error when calling unknown functionv8.2.0625
Problem: Vim9: confusing error when calling unknown function. Solution: Give error while compiling.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 6c8b8c86e..a98e7e326 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -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;
}