diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-16 13:09:15 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-16 13:09:15 +0000 |
commit | fe8e9f674036f3206b0080f4a931c991cf142f8b (patch) | |
tree | 164fd1908cb9969743eac38bf927584b13acc8da /src/eval.c | |
parent | 9323ca51c2b1522f26907a7b8879067245ebd1be (diff) |
patch 8.2.4578: no warning when autoload script for completion has an errorv8.2.4578
Problem: No warning when an autoload script for completion function has an
error.
Solution: Do not ignore errors when a function name is given with a dot or
'#' character. (closes #9958)
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c index b55ae1a20c..62266f884b 100644 --- a/src/eval.c +++ b/src/eval.c @@ -695,6 +695,7 @@ call_vim_function( char_u *arg; char_u *name; char_u *tofree = NULL; + int ignore_errors; rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this CLEAR_FIELD(funcexe); @@ -702,11 +703,18 @@ call_vim_function( funcexe.fe_lastline = curwin->w_cursor.lnum; funcexe.fe_evaluate = TRUE; - // The name might be "import.Func" or "Funcref". + // The name might be "import.Func" or "Funcref". We don't know, we need to + // ignore errors for an undefined name. But we do want errors when an + // autoload script has errors. Guess that when there is a dot or '#' in + // the name showing errors is the right choice. + ignore_errors = vim_strchr(func, '.') == NULL + && vim_strchr(func, AUTOLOAD_CHAR) == NULL; arg = func; - ++emsg_off; + if (ignore_errors) + ++emsg_off; name = deref_function_name(&arg, &tofree, &EVALARG_EVALUATE, FALSE); - --emsg_off; + if (ignore_errors) + --emsg_off; if (name == NULL) name = func; |