diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-06-26 15:00:59 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-06-26 15:00:59 +0200 |
commit | 3a3b10e87a10dd0bc355618dbfc4a0a6c828aad7 (patch) | |
tree | e74e88f7d0cbf28ff9d9af3ae9a371348656cdfa /src/eval.c | |
parent | 4d5dfe20839e9d13c95eaf4254467f952653b042 (diff) |
patch 8.2.3055: strange error for assigning to "x.key" on non-dictionaryv8.2.3055
Problem: Strange error for assigning to "x.key" on non-dictionary.
Solution: Add a specific error message. (closes #8451)
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c index 33ea8504a2..7704d46e98 100644 --- a/src/eval.c +++ b/src/eval.c @@ -924,8 +924,14 @@ get_lval( lp->ll_tv = &v->di_tv; var1.v_type = VAR_UNKNOWN; var2.v_type = VAR_UNKNOWN; - while (*p == '[' || (*p == '.' && lp->ll_tv->v_type == VAR_DICT)) + while (*p == '[' || (*p == '.' && p[1] != '=' && p[1] != '.')) { + if (*p == '.' && lp->ll_tv->v_type != VAR_DICT) + { + if (!quiet) + semsg(_(e_dot_can_only_be_used_on_dictionary_str), name); + return NULL; + } if (!(lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list != NULL) && !(lp->ll_tv->v_type == VAR_DICT) && !(lp->ll_tv->v_type == VAR_BLOB |