Mercurial > vim
diff src/eval.c @ 22298:07e48ee8c3bb v8.2.1698
patch 8.2.1698: cannot lock a variable in legacy Vim script like in Vim9
Commit: https://github.com/vim/vim/commit/a187c43cfe8863d48b2159d695fedcb71f8525c1
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 16 21:08:28 2020 +0200
patch 8.2.1698: cannot lock a variable in legacy Vim script like in Vim9
Problem: Cannot lock a variable in legacy Vim script like in Vim9.
Solution: Make ":lockvar 0" work.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Sep 2020 21:15:05 +0200 |
parents | eb1f5f618c75 |
children | a4866826cebc |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -1055,7 +1055,8 @@ get_lval( } // existing variable, need to check if it can be changed else if ((flags & GLV_READ_ONLY) == 0 - && var_check_ro(lp->ll_di->di_flags, name, FALSE)) + && (var_check_ro(lp->ll_di->di_flags, name, FALSE) + || var_check_lock(lp->ll_di->di_flags, name, FALSE))) { clear_tv(&var1); return NULL; @@ -1220,7 +1221,7 @@ set_var_lval( semsg(_(e_letwrong), op); return; } - if (var_check_lock(lp->ll_blob->bv_lock, lp->ll_name, FALSE)) + if (value_check_lock(lp->ll_blob->bv_lock, lp->ll_name, FALSE)) return; if (lp->ll_range && rettv->v_type == VAR_BLOB) @@ -1297,7 +1298,7 @@ set_var_lval( } *endp = cc; } - else if (var_check_lock(lp->ll_newkey == NULL + else if (value_check_lock(lp->ll_newkey == NULL ? lp->ll_tv->v_lock : lp->ll_tv->vval.v_dict->dv_lock, lp->ll_name, FALSE)) ; @@ -1317,7 +1318,7 @@ set_var_lval( */ for (ri = rettv->vval.v_list->lv_first; ri != NULL && ll_li != NULL; ) { - if (var_check_lock(ll_li->li_tv.v_lock, lp->ll_name, FALSE)) + if (value_check_lock(ll_li->li_tv.v_lock, lp->ll_name, FALSE)) return; ri = ri->li_next; if (ri == NULL || (!lp->ll_empty2 && lp->ll_n2 == ll_n1))