diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-08-16 14:48:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-08-16 14:48:19 +0200 |
commit | 56acb0943ede35cd9d2f6667cde2442819ccbf59 (patch) | |
tree | d35aa5928ec6d46f07ea1ed4f1e5fb2f00bfa7dc /src/list.c | |
parent | 829ac868b7615d73dbfb536f7fcd44fc7c5b7c1d (diff) | |
download | vim-git-56acb0943ede35cd9d2f6667cde2442819ccbf59.tar.gz |
patch 8.2.1465: Vim9: subscript not handled properlyv8.2.1465
Problem: Vim9: subscript not handled properly.
Solution: Adjust error message. Remove dead code. Disallow string to
number conversion in scripts.
Diffstat (limited to 'src/list.c')
-rw-r--r-- | src/list.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/list.c b/src/list.c index 955272c37..b09e87f5f 100644 --- a/src/list.c +++ b/src/list.c @@ -1909,7 +1909,10 @@ filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp) int error = FALSE; // filter(): when expr is zero remove the item - *remp = (tv_get_number_chk(&rettv, &error) == 0); + if (in_vim9script()) + *remp = !tv2bool(&rettv); + else + *remp = (tv_get_number_chk(&rettv, &error) == 0); clear_tv(&rettv); // On type error, nothing has been removed; return FAIL to stop the // loop. The error message was given by tv_get_number_chk(). |