Mercurial > vim
comparison src/vim9execute.c @ 21574:b8b15e8cbf5f v8.2.1337
patch 8.2.1337: Vim9: cannot use empty key in dict assignment
Commit: https://github.com/vim/vim/commit/586268721dd5d6e50903a8a457f02e0dda901856
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 1 14:06:38 2020 +0200
patch 8.2.1337: Vim9: cannot use empty key in dict assignment
Problem: Vim9: cannot use empty key in dict assignment.
Solution: Allow empty key. (closes https://github.com/vim/vim/issues/6591)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Aug 2020 14:15:03 +0200 |
parents | 1c4d4aa22b37 |
children | f4252efe370e |
comparison
equal
deleted
inserted
replaced
21573:56e2dfbce89f | 21574:b8b15e8cbf5f |
---|---|
1420 char_u *key = tv_key->vval.v_string; | 1420 char_u *key = tv_key->vval.v_string; |
1421 typval_T *tv_dict = STACK_TV_BOT(-1); | 1421 typval_T *tv_dict = STACK_TV_BOT(-1); |
1422 dict_T *dict = tv_dict->vval.v_dict; | 1422 dict_T *dict = tv_dict->vval.v_dict; |
1423 dictitem_T *di; | 1423 dictitem_T *di; |
1424 | 1424 |
1425 if (key == NULL || *key == NUL) | 1425 if (key == NULL) |
1426 { | 1426 key = (char_u *)""; |
1427 emsg(_(e_emptykey)); | |
1428 goto on_error; | |
1429 } | |
1430 tv = STACK_TV_BOT(-3); | 1427 tv = STACK_TV_BOT(-3); |
1431 di = dict_find(dict, key, -1); | 1428 di = dict_find(dict, key, -1); |
1432 if (di != NULL) | 1429 if (di != NULL) |
1433 { | 1430 { |
1434 // overwrite existing value | 1431 // overwrite existing value |