From 3137c7d63574a86ddc44f11c839e8e58c2994bf9 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Fri, 27 Aug 2021 21:09:37 +0100 Subject: 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. --- src/nvim/eval/funcs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/nvim/eval') 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; } -- cgit