feat(eval): partially port v8.2.0878

Problem:    No reduce() function.
Solution:   Add a reduce() function. (closes vim/vim#5481)
85629985b7

Needs CHECK_LIST_MATERIALIZE from v8.2.0751 (and range_list_materialize from
8.2.0149).

Move e_reduceempty to funcs.c, as it's only used there. Make it static.
Use tv_blob_len, tv_list_len == 0 for empty checks.
Replace vim_memset(&funcexe, 0, ...) with FUNCEXE_INIT.
Leave li initially undefined (tv_list_first returns NULL if list is NULL).

This patch has a memory leak fixed by v8.2.0882.
This commit is contained in:
Sean Dewar
2021-12-06 20:50:29 +00:00
committed by zeertzjq
parent 2870311a37
commit d746f5aa41
4 changed files with 138 additions and 0 deletions

View File

@@ -276,6 +276,7 @@ return {
range={args={1, 3}, base=1},
readdir={args={1, 2}, base=1},
readfile={args={1, 3}, base=1},
reduce={args={2, 3}, base=1},
reg_executing={},
reg_recording={},
reg_recorded={},