Mercurial > vim
comparison src/eval.c @ 28107:710a509be2cd v8.2.4578
patch 8.2.4578: no warning when autoload script for completion has an error
Commit: https://github.com/vim/vim/commit/fe8e9f674036f3206b0080f4a931c991cf142f8b
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 16 13:09:15 2022 +0000
patch 8.2.4578: no warning when autoload script for completion has an error
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Mar 2022 14:15:03 +0100 |
parents | 3bc0a639dfb0 |
children | 62a57c60edc1 |
comparison
equal
deleted
inserted
replaced
28106:4c7aa481d798 | 28107:710a509be2cd |
---|---|
693 int ret; | 693 int ret; |
694 funcexe_T funcexe; | 694 funcexe_T funcexe; |
695 char_u *arg; | 695 char_u *arg; |
696 char_u *name; | 696 char_u *name; |
697 char_u *tofree = NULL; | 697 char_u *tofree = NULL; |
698 int ignore_errors; | |
698 | 699 |
699 rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this | 700 rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this |
700 CLEAR_FIELD(funcexe); | 701 CLEAR_FIELD(funcexe); |
701 funcexe.fe_firstline = curwin->w_cursor.lnum; | 702 funcexe.fe_firstline = curwin->w_cursor.lnum; |
702 funcexe.fe_lastline = curwin->w_cursor.lnum; | 703 funcexe.fe_lastline = curwin->w_cursor.lnum; |
703 funcexe.fe_evaluate = TRUE; | 704 funcexe.fe_evaluate = TRUE; |
704 | 705 |
705 // The name might be "import.Func" or "Funcref". | 706 // The name might be "import.Func" or "Funcref". We don't know, we need to |
707 // ignore errors for an undefined name. But we do want errors when an | |
708 // autoload script has errors. Guess that when there is a dot or '#' in | |
709 // the name showing errors is the right choice. | |
710 ignore_errors = vim_strchr(func, '.') == NULL | |
711 && vim_strchr(func, AUTOLOAD_CHAR) == NULL; | |
706 arg = func; | 712 arg = func; |
707 ++emsg_off; | 713 if (ignore_errors) |
714 ++emsg_off; | |
708 name = deref_function_name(&arg, &tofree, &EVALARG_EVALUATE, FALSE); | 715 name = deref_function_name(&arg, &tofree, &EVALARG_EVALUATE, FALSE); |
709 --emsg_off; | 716 if (ignore_errors) |
717 --emsg_off; | |
710 if (name == NULL) | 718 if (name == NULL) |
711 name = func; | 719 name = func; |
712 | 720 |
713 ret = call_func(name, -1, rettv, argc, argv, &funcexe); | 721 ret = call_func(name, -1, rettv, argc, argv, &funcexe); |
714 | 722 |