diff options
author | Ernie Rael <errael@raelity.com> | 2024-01-13 11:47:33 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-01-13 11:47:33 +0100 |
commit | e79e2077607e8f829ba823308c91104a795736ba (patch) | |
tree | e3e126ee9503e37e90e83868aa1c0ac42e359ccb /src/dict.c | |
parent | d8cb1ddab7b8cb19267a8877d62bbe3a06626fa2 (diff) |
patch 9.1.0027: Vim is missing a foreach() funcv9.1.0027
Problem: Vim is missing a foreach() func
Solution: Implement foreach({expr1}, {expr2}) function,
which applies {expr2} for each item in {expr1}
without changing it (Ernie Rael)
closes: #12166
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/dict.c')
-rw-r--r-- | src/dict.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/dict.c b/src/dict.c index cb22b42c91..508d00cdf7 100644 --- a/src/dict.c +++ b/src/dict.c @@ -1329,8 +1329,8 @@ dict_extend_func( } /* - * Implementation of map() and filter() for a Dict. Apply "expr" to every - * item in Dict "d" and return the result in "rettv". + * Implementation of map(), filter(), foreach() for a Dict. Apply "expr" to + * every item in Dict "d" and return the result in "rettv". */ void dict_filter_map( @@ -1392,7 +1392,6 @@ dict_filter_map( arg_errmsg, TRUE))) break; set_vim_var_string(VV_KEY, di->di_key, -1); - newtv.v_type = VAR_UNKNOWN; r = filter_map_one(&di->di_tv, expr, filtermap, fc, &newtv, &rem); clear_tv(get_vim_var_tv(VV_KEY)); if (r == FAIL || did_emsg) |