patch 8.2.3702: first key in dict is seen as curly expression and fails
Problem: First key in dict is seen as curly expression and fails. Solution: Ignore failure of curly expression. (closes #9247)
This commit is contained in:
14
src/dict.c
14
src/dict.c
@ -891,7 +891,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
|
||||
typval_T tv;
|
||||
char_u *key = NULL;
|
||||
dictitem_T *item;
|
||||
char_u *start = skipwhite(*arg + 1);
|
||||
char_u *curly_expr = skipwhite(*arg + 1);
|
||||
char_u buf[NUMBUFLEN];
|
||||
int vim9script = in_vim9script();
|
||||
int had_comma;
|
||||
@ -903,13 +903,11 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
|
||||
* first item.
|
||||
* But {} is an empty Dictionary.
|
||||
*/
|
||||
if (!vim9script && *start != '}')
|
||||
{
|
||||
if (eval1(&start, &tv, NULL) == FAIL) // recursive!
|
||||
return FAIL;
|
||||
if (*skipwhite(start) == '}')
|
||||
return NOTDONE;
|
||||
}
|
||||
if (!vim9script
|
||||
&& *curly_expr != '}'
|
||||
&& eval1(&curly_expr, &tv, NULL) == OK
|
||||
&& *skipwhite(curly_expr) == '}')
|
||||
return NOTDONE;
|
||||
|
||||
if (evaluate)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user