diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-27 21:09:37 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-10-03 20:06:32 +0100 |
commit | 3137c7d63574a86ddc44f11c839e8e58c2994bf9 (patch) | |
tree | 20bba9c62b55e08793d0d726893cdb2681e98788 /src/nvim/eval/funcs.c | |
parent | 6110480c290011d96af37c0cba1e7309ef645efb (diff) | |
download | rneovim-3137c7d63574a86ddc44f11c839e8e58c2994bf9.tar.gz rneovim-3137c7d63574a86ddc44f11c839e8e58c2994bf9.tar.bz2 rneovim-3137c7d63574a86ddc44f11c839e8e58c2994bf9.zip |
feat(eval/method): partially port v8.1.1925
Adds method call support for all functions in the patch, but it cannot
be fully ported due to missing tests for:
- getcwd(): requires chdir() and Test_chdir_func() from v8.1.1291.
Note that the method call tests for getreg() and getregtype() were
removed in v8.2.1547, which has already been ported, but doesn't seem to
have been replaced with a new test...
This patch also makes getchangelist()'s argument optional (defaults to
the current buffer).
eval.txt includes a typo for gettabwinvar(), which is fixed in
v8.1.1952.
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 5569d74413..b53b50e766 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -3088,10 +3088,16 @@ f_getbufvar_end: static void f_getchangelist(typval_T *argvars, typval_T *rettv, FunPtr fptr) { tv_list_alloc_ret(rettv, 2); - vim_ignored = tv_get_number(&argvars[0]); // issue errmsg if type error - emsg_off++; - const buf_T *const buf = tv_get_buf(&argvars[0], false); - emsg_off--; + + const buf_T *buf; + if (argvars[0].v_type == VAR_UNKNOWN) { + buf = curbuf; + } else { + vim_ignored = tv_get_number(&argvars[0]); // issue errmsg if type error + emsg_off++; + buf = tv_get_buf(&argvars[0], false); + emsg_off--; + } if (buf == NULL) { return; } |