comparison src/vim9expr.c @ 28263:c446812efd60 v8.2.4657

patch 8.2.4657: errors for functions are sometimes hard to read Commit: https://github.com/vim/vim/commit/a6c18d38ca2df0a92403f2265a480d9dba08290f Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 31 20:02:56 2022 +0100 patch 8.2.4657: errors for functions are sometimes hard to read Problem: Errors for functions are sometimes hard to read. Solution: Use printable_func_name() in more places.
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Mar 2022 21:15:03 +0200
parents 20f6b0cdf38c
children c84f4e34ba16
comparison
equal deleted inserted replaced
28262:59a7125e87f4 28263:c446812efd60
696 int argcount_init) 696 int argcount_init)
697 { 697 {
698 char_u *name = *arg; 698 char_u *name = *arg;
699 char_u *p; 699 char_u *p;
700 int argcount = argcount_init; 700 int argcount = argcount_init;
701 char_u namebuf[100]; 701 char_u namebuf[MAX_FUNC_NAME_LEN];
702 char_u fname_buf[FLEN_FIXED + 1]; 702 char_u fname_buf[FLEN_FIXED + 1];
703 char_u *tofree = NULL; 703 char_u *tofree = NULL;
704 int error = FCERR_NONE; 704 int error = FCERR_NONE;
705 ufunc_T *ufunc = NULL; 705 ufunc_T *ufunc = NULL;
706 int res = FAIL; 706 int res = FAIL;
816 816
817 if (idx >= 0) 817 if (idx >= 0)
818 res = generate_BCALL(cctx, idx, argcount, argcount_init == 1); 818 res = generate_BCALL(cctx, idx, argcount, argcount_init == 1);
819 } 819 }
820 else 820 else
821 semsg(_(e_unknown_function_str), namebuf); 821 emsg_funcname(e_unknown_function_str, namebuf);
822 goto theend; 822 goto theend;
823 } 823 }
824 824
825 has_g_namespace = STRNCMP(namebuf, "g:", 2) == 0; 825 has_g_namespace = STRNCMP(namebuf, "g:", 2) == 0;
826 826
841 } 841 }
842 if (!has_g_namespace 842 if (!has_g_namespace
843 && vim_strchr(ufunc->uf_name, AUTOLOAD_CHAR) == NULL) 843 && vim_strchr(ufunc->uf_name, AUTOLOAD_CHAR) == NULL)
844 { 844 {
845 // A function name without g: prefix must be found locally. 845 // A function name without g: prefix must be found locally.
846 semsg(_(e_unknown_function_str), namebuf); 846 emsg_funcname(e_unknown_function_str, namebuf);
847 goto theend; 847 goto theend;
848 } 848 }
849 } 849 }
850 } 850 }
851 851
872 // A global function may be defined only later. Need to figure out at 872 // A global function may be defined only later. Need to figure out at
873 // runtime. Also handles a FuncRef at runtime. 873 // runtime. Also handles a FuncRef at runtime.
874 if (has_g_namespace || is_autoload) 874 if (has_g_namespace || is_autoload)
875 res = generate_UCALL(cctx, name, argcount); 875 res = generate_UCALL(cctx, name, argcount);
876 else 876 else
877 semsg(_(e_unknown_function_str), namebuf); 877 emsg_funcname(e_unknown_function_str, namebuf);
878 878
879 theend: 879 theend:
880 vim_free(tofree); 880 vim_free(tofree);
881 return res; 881 return res;
882 } 882 }