summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-11 16:14:07 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-11 16:14:07 +0000
commit2ef9156b4284e4a52613c36e3d4667245273a28d (patch)
treebb591edc76e6f750ba20acf4c6dd13164e175afe /src/eval.c
parent052ff291d72bc9c176f9562f021d7e8e030e74c0 (diff)
patch 8.2.3783: confusing error for using a variable as a functionv8.2.3783
Problem: Confusing error for using a variable as a function. Solution: If a function is not found but there is a variable, give a more useful error. (issue #9310)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c
index 821d0c1dc8..e2aa41b34f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1988,6 +1988,7 @@ eval_func(
partial_T *partial;
int ret = OK;
type_T *type = NULL;
+ int found_var = FALSE;
if (!evaluate)
check_vars(s, len);
@@ -1995,7 +1996,7 @@ eval_func(
// If "s" is the name of a variable of type VAR_FUNC
// use its contents.
s = deref_func_name(s, &len, &partial,
- in_vim9script() ? &type : NULL, !evaluate);
+ in_vim9script() ? &type : NULL, !evaluate, &found_var);
// Need to make a copy, in case evaluating the arguments makes
// the name invalid.
@@ -2014,6 +2015,7 @@ eval_func(
funcexe.partial = partial;
funcexe.basetv = basetv;
funcexe.check_type = type;
+ funcexe.fe_found_var = found_var;
ret = get_func_tv(s, len, rettv, arg, evalarg, &funcexe);
}
vim_free(s);