1
0
forked from aniani/vim

patch 8.2.0753: Vim9: expressions are evaluated in the discovery phase

Problem:    Vim9: expressions are evaluated in the discovery phase.
Solution:   Bail out if an expression is not a constant.  Require a type for
            declared constants.
This commit is contained in:
Bram Moolenaar
2020-05-14 22:41:15 +02:00
parent e06a28f5e3
commit 32e351179e
12 changed files with 214 additions and 131 deletions

View File

@@ -1046,8 +1046,9 @@ f_join(typval_T *argvars, typval_T *rettv)
* Return OK or FAIL.
*/
int
get_list_tv(char_u **arg, typval_T *rettv, int evaluate, int do_error)
get_list_tv(char_u **arg, typval_T *rettv, int flags, int do_error)
{
int evaluate = flags & EVAL_EVALUATE;
list_T *l = NULL;
typval_T tv;
listitem_T *item;
@@ -1062,7 +1063,7 @@ get_list_tv(char_u **arg, typval_T *rettv, int evaluate, int do_error)
*arg = skipwhite(*arg + 1);
while (**arg != ']' && **arg != NUL)
{
if (eval1(arg, &tv, evaluate) == FAIL) // recursive!
if (eval1(arg, &tv, flags) == FAIL) // recursive!
goto failret;
if (evaluate)
{