0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.1541: Vim9: cannot find function reference for s:Func

Problem:    Vim9: cannot find function reference for s:Func.
Solution:   Recognize <SNR> prefix. (closes #6805)
This commit is contained in:
Bram Moolenaar
2020-08-29 17:47:08 +02:00
parent 98945560c1
commit 95006e3dca
4 changed files with 31 additions and 4 deletions

View File

@@ -614,6 +614,7 @@ call_partial(typval_T *tv, int argcount_arg, ectx_T *ectx)
int argcount = argcount_arg;
char_u *name = NULL;
int called_emsg_before = called_emsg;
int res;
if (tv->v_type == VAR_PARTIAL)
{
@@ -650,7 +651,23 @@ call_partial(typval_T *tv, int argcount_arg, ectx_T *ectx)
}
else if (tv->v_type == VAR_FUNC)
name = tv->vval.v_string;
if (name == NULL || call_by_name(name, argcount, ectx, NULL) == FAIL)
if (name != NULL)
{
char_u fname_buf[FLEN_FIXED + 1];
char_u *tofree = NULL;
int error = FCERR_NONE;
char_u *fname;
// May need to translate <SNR>123_ to K_SNR.
fname = fname_trans_sid(name, fname_buf, &tofree, &error);
if (error != FCERR_NONE)
res = FAIL;
else
res = call_by_name(fname, argcount, ectx, NULL);
vim_free(tofree);
}
if (name == NULL || res == FAIL)
{
if (called_emsg == called_emsg_before)
semsg(_(e_unknownfunc),