diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-06 18:58:27 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-12 22:35:21 +0100 |
commit | d41b87e070037786bf2cc4486b1839169805ee21 (patch) | |
tree | 7a0a68bd5fea74a8a3604efe2cf281c5c679d113 /src/nvim/eval/userfunc.c | |
parent | 8d1ca37d1f413b08f5ff9ceb502fa35ffd6034c7 (diff) | |
download | rneovim-d41b87e070037786bf2cc4486b1839169805ee21.tar.gz rneovim-d41b87e070037786bf2cc4486b1839169805ee21.tar.bz2 rneovim-d41b87e070037786bf2cc4486b1839169805ee21.zip |
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.
https://github.com/vim/vim/commit/761fdf01c6e307c448cec2684f8b315ba6d1f454
Diffstat (limited to 'src/nvim/eval/userfunc.c')
-rw-r--r-- | src/nvim/eval/userfunc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 3c0c0091f2..9ecde327de 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -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); |