0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1485: Vim9: readdirex() expression doesn't accept bool

Problem:    Vim9: readdirex() expression doesn't accept bool.
Solution:   Accept both -1 and bool. (closes #6737)
This commit is contained in:
Bram Moolenaar
2020-08-19 13:55:01 +02:00
parent 9b02d64cff
commit af8822ce08
3 changed files with 12 additions and 0 deletions

View File

@@ -1493,6 +1493,12 @@ readdirex_checkitem(void *context, void *item)
if (eval_expr_typval(expr, argv, 1, &rettv) == FAIL)
goto theend;
// We want to use -1, but also true/false should be allowed.
if (rettv.v_type == VAR_SPECIAL || rettv.v_type == VAR_BOOL)
{
rettv.v_type = VAR_NUMBER;
rettv.vval.v_number = rettv.vval.v_number == VVAL_TRUE;
}
retval = tv_get_number_chk(&rettv, &error);
if (error)
retval = -1;