diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-18 05:09:24 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-08-18 05:29:05 +0800 |
commit | bb29ef40084e1cea1f35cbbcbac794f41f46d5f8 (patch) | |
tree | 4d6b898cb67d3d1aec5d3cd49acdb0be7be07ada /src/nvim/eval/funcs.c | |
parent | ffb87f4dd992ff23ff66f888dbe1bcc54bd0b012 (diff) | |
download | rneovim-bb29ef40084e1cea1f35cbbcbac794f41f46d5f8.tar.gz rneovim-bb29ef40084e1cea1f35cbbcbac794f41f46d5f8.tar.bz2 rneovim-bb29ef40084e1cea1f35cbbcbac794f41f46d5f8.zip |
vim-patch:9.0.1723: Fix regression in {func} argument of reduce()
Problem: Fix regression in {func} argument of reduce()
Solution: pass function name as string again
Before patch 9.0.0548, passing a string as {func} argument of reduce()
is treated as a function name, but after patch 9.0.0548 it is treated as
an expression instead, which is useless as reduce() doesn't set any v:
variables. This PR restores the behavior of {func} before that patch.
Also correct an emsg() call, as e_string_list_or_blob_required doesn't
contain format specifiers.
closes: vim/vim#12824
https://github.com/vim/vim/commit/ad0c442f1fcc6fe9c433777ee3e5b9e6addc6d69
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index a9f87b5008..e8224671dc 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -2953,7 +2953,7 @@ static void f_wait(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) const int called_emsg_before = called_emsg; LOOP_PROCESS_EVENTS_UNTIL(&main_loop, main_loop.events, timeout, - eval_expr_typval(&expr, &argv, 0, &exprval) != OK + eval_expr_typval(&expr, false, &argv, 0, &exprval) != OK || tv_get_number_chk(&exprval, &error) || called_emsg > called_emsg_before || error || got_int); @@ -3515,7 +3515,7 @@ static varnumber_T indexof_eval_expr(typval_T *expr) typval_T newtv; newtv.v_type = VAR_UNKNOWN; - if (eval_expr_typval(expr, argv, 2, &newtv) == FAIL) { + if (eval_expr_typval(expr, false, argv, 2, &newtv) == FAIL) { return false; } @@ -5537,7 +5537,7 @@ static varnumber_T readdir_checkitem(void *context, const char *name) argv[0].vval.v_string = (char *)name; typval_T rettv; - if (eval_expr_typval(expr, argv, 1, &rettv) == FAIL) { + if (eval_expr_typval(expr, false, argv, 1, &rettv) == FAIL) { goto theend; } @@ -6259,7 +6259,7 @@ static void reduce_list(typval_T *argvars, typval_T *expr, typval_T *rettv) argv[1] = *TV_LIST_ITEM_TV(li); rettv->v_type = VAR_UNKNOWN; - const int r = eval_expr_typval(expr, argv, 2, rettv); + const int r = eval_expr_typval(expr, true, argv, 2, rettv); tv_clear(&argv[0]); if (r == FAIL || called_emsg != called_emsg_start) { @@ -6306,7 +6306,7 @@ static void reduce_string(typval_T *argvars, typval_T *expr, typval_T *rettv) .vval.v_string = xstrnsave(p, (size_t)len), }; - const int r = eval_expr_typval(expr, argv, 2, rettv); + const int r = eval_expr_typval(expr, true, argv, 2, rettv); tv_clear(&argv[0]); tv_clear(&argv[1]); @@ -6354,7 +6354,7 @@ static void reduce_blob(typval_T *argvars, typval_T *expr, typval_T *rettv) .vval.v_number = tv_blob_get(b, i), }; - const int r = eval_expr_typval(expr, argv, 2, rettv); + const int r = eval_expr_typval(expr, true, argv, 2, rettv); if (r == FAIL || called_emsg != called_emsg_start) { return; |