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

patch 8.2.1650: Vim9: result of && and || expression is not bool in script

Problem:    Vim9: result of && and || expression cannot be assigned to a bool
            at the script level.
Solution:   Add the VAR_BOOL_OK flag.  Convert to bool when needed.
This commit is contained in:
Bram Moolenaar
2020-09-09 22:27:58 +02:00
parent 3e4cc9671c
commit c1ec0422e4
8 changed files with 92 additions and 29 deletions

View File

@@ -2356,6 +2356,9 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
clear_evalarg(&local_evalarg, NULL);
else
evalarg->eval_flags = orig_flags;
// Resulting value can be assigned to a bool.
rettv->v_lock |= VAR_BOOL_OK;
}
return OK;
@@ -2451,6 +2454,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
*arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
evalarg_used->eval_flags = result ? orig_flags
: orig_flags & ~EVAL_EVALUATE;
CLEAR_FIELD(var2);
if (eval4(arg, &var2, evalarg_used) == FAIL)
return FAIL;
@@ -2487,6 +2491,9 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
clear_evalarg(&local_evalarg, NULL);
else
evalarg->eval_flags = orig_flags;
// Resulting value can be assigned to a bool.
rettv->v_lock |= VAR_BOOL_OK;
}
return OK;