vim-patch:8.1.1820: using expr->FuncRef() does not work

Problem:    Using expr->FuncRef() does not work.
Solution:   Make FuncRef work as a method.
761fdf01c6
This commit is contained in:
Sean Dewar
2021-08-06 18:58:27 +01:00
parent 8d1ca37d1f
commit d41b87e070
3 changed files with 104 additions and 80 deletions

View File

@@ -1450,6 +1450,7 @@ call_func(
typval_T argv[MAX_FUNC_ARGS + 1]; // used when "partial" or
// "funcexe->basetv" is not NULL
int argv_clear = 0;
int argv_base = 0;
partial_T *partial = funcexe->partial;
// Initialize rettv so that it is safe for caller to invoke clear_tv(rettv)
@@ -1550,8 +1551,8 @@ call_func(
memmove(&argv[1], argvars, sizeof(typval_T) * argcount);
argv[0] = *funcexe->basetv;
argcount++;
} else {
memcpy(argv, argvars, sizeof(typval_T) * argcount);
argvars = argv;
argv_base = 1;
}
if (fp->uf_flags & FC_RANGE && funcexe->doesrange != NULL) {
@@ -1565,7 +1566,7 @@ call_func(
error = ERROR_DICT;
} else {
// Call the user function.
call_user_func(fp, argcount, argv, rettv, funcexe->firstline,
call_user_func(fp, argcount, argvars, rettv, funcexe->firstline,
funcexe->lastline,
(fp->uf_flags & FC_DICT) ? selfdict : NULL);
error = ERROR_NONE;
@@ -1602,9 +1603,11 @@ theend:
user_func_error(error, (name != NULL) ? name : funcname);
}
// clear the copies made from the partial
while (argv_clear > 0) {
tv_clear(&argv[--argv_clear]);
tv_clear(&argv[--argv_clear + argv_base]);
}
xfree(tofree);
xfree(name);