# HG changeset patch # User Bram Moolenaar # Date 1608414303 -3600 # Node ID a789a688e37d661c30a482c783bf8749c890dd4c # Parent 5945735ad4afea8e42fc9e9ab50f222b5039198c patch 8.2.2165: Vim9: assignment to dict member does not work Commit: https://github.com/vim/vim/commit/8f22f5c3aa0aa96e3843a57f29405625d8514c74 Author: Bram Moolenaar Date: Sat Dec 19 22:10:13 2020 +0100 patch 8.2.2165: Vim9: assignment to dict member does not work Problem: Vim9: assignment to dict member does not work. Solution: Fix recognizing dict member. (closes https://github.com/vim/vim/issues/7484) diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -874,6 +874,13 @@ get_lval( if (v == NULL) return NULL; + if (in_vim9script() && (flags & GLV_NO_DECL) == 0) + { + if (!quiet) + semsg(_(e_variable_already_declared), lp->ll_name); + return NULL; + } + /* * Loop until no more [idx] or .key is following. */ diff --git a/src/evalvars.c b/src/evalvars.c --- a/src/evalvars.c +++ b/src/evalvars.c @@ -1464,7 +1464,8 @@ ex_let_one( { lval_T lv; - p = get_lval(arg, tv, &lv, FALSE, FALSE, 0, FNE_CHECK_START); + p = get_lval(arg, tv, &lv, FALSE, FALSE, + (flags & ASSIGN_NO_DECL) ? GLV_NO_DECL : 0, FNE_CHECK_START); if (p != NULL && lv.ll_name != NULL) { if (endchars != NULL && vim_strchr(endchars, diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -3332,6 +3332,8 @@ find_ex_command( // When followed by "=" or "+=" then it is an assignment. ++emsg_silent; + if (*after == '.') + after = skipwhite(after + 1); if (skip_expr(&after, NULL) == OK) after = skipwhite(after); else diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2165, +/**/ 2164, /**/ 2163, diff --git a/src/vim.h b/src/vim.h --- a/src/vim.h +++ b/src/vim.h @@ -2536,16 +2536,18 @@ typedef enum { #define COPYID_MASK (~0x1) // Values for trans_function_name() argument: -#define TFN_INT 1 // internal function name OK -#define TFN_QUIET 2 // no error messages -#define TFN_NO_AUTOLOAD 4 // do not use script autoloading -#define TFN_NO_DEREF 8 // do not dereference a Funcref -#define TFN_READ_ONLY 16 // will not change the var +#define TFN_INT 0x01 // internal function name OK +#define TFN_QUIET 0x02 // no error messages +#define TFN_NO_AUTOLOAD 0x04 // do not use script autoloading +#define TFN_NO_DEREF 0x08 // do not dereference a Funcref +#define TFN_READ_ONLY 0x10 // will not change the var +#define TFN_NO_DECL 0x20 // only used for GLV_NO_DECL // Values for get_lval() flags argument: #define GLV_QUIET TFN_QUIET // no error messages #define GLV_NO_AUTOLOAD TFN_NO_AUTOLOAD // do not use script autoloading #define GLV_READ_ONLY TFN_READ_ONLY // will not change the var +#define GLV_NO_DECL TFN_NO_DECL // assignment without :var or :let #define DO_NOT_FREE_CNT 99999 // refcount for dict or list that should not // be freed.