diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-04-03 22:44:36 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-04-03 22:44:36 +0200 |
commit | 0921ecff1c5a74541bad6c073e8ade32247403d8 (patch) | |
tree | b35a348a88d035fbb75131cbfee3bdcb7809ac40 /src/eval.c | |
parent | e185c1efba3cb2611ac303c39a08e908497cbac4 (diff) | |
download | vim-0921ecff1c5a74541bad6c073e8ade32247403d8.zip |
patch 7.4.1707
Problem: Cannot use empty dictionary key, even though it can be useful.
Solution: Allow using an empty dictionary key.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/eval.c b/src/eval.c index ab006b113..070485f19 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2782,11 +2782,9 @@ get_lval( if (len == -1) { /* "[key]": get key from "var1" */ - key = get_tv_string(&var1); /* is number or string */ - if (*key == NUL) + key = get_tv_string_chk(&var1); /* is number or string */ + if (key == NULL) { - if (!quiet) - EMSG(_(e_emptykey)); clear_tv(&var1); return NULL; } @@ -5623,11 +5621,9 @@ eval_index( if (len == -1) { - key = get_tv_string(&var1); - if (*key == NUL) + key = get_tv_string_chk(&var1); + if (key == NULL) { - if (verbose) - EMSG(_(e_emptykey)); clear_tv(&var1); return FAIL; } @@ -7754,11 +7750,9 @@ get_dict_tv(char_u **arg, typval_T *rettv, int evaluate) if (evaluate) { key = get_tv_string_buf_chk(&tvkey, buf); - if (key == NULL || *key == NUL) + if (key == NULL) { /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ - if (key != NULL) - EMSG(_(e_emptykey)); clear_tv(&tvkey); goto failret; } |