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.
This commit is contained in:
Sean Dewar
2021-08-27 21:09:37 +01:00
parent 6110480c29
commit 3137c7d635
13 changed files with 107 additions and 44 deletions

View File

@@ -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;
}