summaryrefslogtreecommitdiff
path: root/src/dict.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-11-30 11:56:22 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-30 11:56:22 +0000
commit98cb90ef865089a5ddd20bc0303d449fb7d97fb2 (patch)
tree34a47025742f1c635e583c5aeced5f0fe7e92476 /src/dict.c
parentc750d91a07ace532e993349aa5c13dda5c888cc0 (diff)
downloadvim-git-98cb90ef865089a5ddd20bc0303d449fb7d97fb2.tar.gz
patch 8.2.3702: first key in dict is seen as curly expression and failsv8.2.3702
Problem: First key in dict is seen as curly expression and fails. Solution: Ignore failure of curly expression. (closes #9247)
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/dict.c b/src/dict.c
index 032c1b5a8..98be26310 100644
--- a/src/dict.c
+++ b/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)
{