aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-16 08:54:07 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-16 10:15:15 +0800
commit68ca16c376bd8786ffc0c7ce7619b9a0ce5657e8 (patch)
treec3519829e3131749ba72f3a3a567b1cf4f4a307a /src/nvim/eval.c
parent2e8cec5f2bf2dd1209052e870d9713a932dc7bfa (diff)
downloadrneovim-68ca16c376bd8786ffc0c7ce7619b9a0ce5657e8.tar.gz
rneovim-68ca16c376bd8786ffc0c7ce7619b9a0ce5657e8.tar.bz2
rneovim-68ca16c376bd8786ffc0c7ce7619b9a0ce5657e8.zip
vim-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 vim/vim#9310) https://github.com/vim/vim/commit/2ef9156b4284e4a52613c36e3d4667245273a28d Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 1d9061186a..b8daa78c79 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -2220,6 +2220,7 @@ static int eval_func(char **const arg, evalarg_T *const evalarg, char *const nam
const bool evaluate = flags & EVAL_EVALUATE;
char *s = name;
int len = name_len;
+ bool found_var = false;
if (!evaluate) {
check_vars(s, (size_t)len);
@@ -2228,7 +2229,7 @@ static int eval_func(char **const arg, evalarg_T *const evalarg, char *const nam
// If "s" is the name of a variable of type VAR_FUNC
// use its contents.
partial_T *partial;
- s = deref_func_name(s, &len, &partial, !evaluate);
+ s = deref_func_name(s, &len, &partial, !evaluate, &found_var);
// Need to make a copy, in case evaluating the arguments makes
// the name invalid.
@@ -2241,6 +2242,7 @@ static int eval_func(char **const arg, evalarg_T *const evalarg, char *const nam
funcexe.fe_evaluate = evaluate;
funcexe.fe_partial = partial;
funcexe.fe_basetv = basetv;
+ funcexe.fe_found_var = found_var;
int ret = get_func_tv(s, len, rettv, arg, evalarg, &funcexe);
xfree(s);