comparison src/eval.c @ 25036:3b8d3b383fd6 v8.2.3055

patch 8.2.3055: strange error for assigning to "x.key" on non-dictionary Commit: https://github.com/vim/vim/commit/3a3b10e87a10dd0bc355618dbfc4a0a6c828aad7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 26 15:00:59 2021 +0200 patch 8.2.3055: strange error for assigning to "x.key" on non-dictionary Problem: Strange error for assigning to "x.key" on non-dictionary. Solution: Add a specific error message. (closes https://github.com/vim/vim/issues/8451)
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Jun 2021 15:15:03 +0200
parents 21ec48d542a8
children 64bef59f11ef
comparison
equal deleted inserted replaced
25035:4a0d69a89bda 25036:3b8d3b383fd6
922 * Loop until no more [idx] or .key is following. 922 * Loop until no more [idx] or .key is following.
923 */ 923 */
924 lp->ll_tv = &v->di_tv; 924 lp->ll_tv = &v->di_tv;
925 var1.v_type = VAR_UNKNOWN; 925 var1.v_type = VAR_UNKNOWN;
926 var2.v_type = VAR_UNKNOWN; 926 var2.v_type = VAR_UNKNOWN;
927 while (*p == '[' || (*p == '.' && lp->ll_tv->v_type == VAR_DICT)) 927 while (*p == '[' || (*p == '.' && p[1] != '=' && p[1] != '.'))
928 { 928 {
929 if (*p == '.' && lp->ll_tv->v_type != VAR_DICT)
930 {
931 if (!quiet)
932 semsg(_(e_dot_can_only_be_used_on_dictionary_str), name);
933 return NULL;
934 }
929 if (!(lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list != NULL) 935 if (!(lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list != NULL)
930 && !(lp->ll_tv->v_type == VAR_DICT) 936 && !(lp->ll_tv->v_type == VAR_DICT)
931 && !(lp->ll_tv->v_type == VAR_BLOB 937 && !(lp->ll_tv->v_type == VAR_BLOB
932 && lp->ll_tv->vval.v_blob != NULL)) 938 && lp->ll_tv->vval.v_blob != NULL))
933 { 939 {