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

patch 8.2.3783: confusing error for using a variable as a function

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)
This commit is contained in:
Bram Moolenaar
2021-12-11 16:14:07 +00:00
parent 052ff291d7
commit 2ef9156b42
9 changed files with 51 additions and 19 deletions

View File

@@ -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);