vim-patch:8.2.2920: still a way to shadow a builtin function

Problem:    Still a way to shadow a builtin function. (Yasuhiro Matsumoto)
Solution:   Check the key when using extend(). (issue vim/vim#8302)

6f1d2aa437

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2022-10-28 11:56:29 +08:00
parent 7683199a9b
commit 6b3db3f929
3 changed files with 24 additions and 5 deletions

View File

@@ -1760,11 +1760,7 @@ void set_var_lval(lval_T *lp, char *endp, typval_T *rettv, int copy, const bool
semsg(_(e_dictkey), lp->ll_newkey);
return;
}
if ((lp->ll_tv->vval.v_dict == &globvardict
// || lp->ll_tv->vval.v_dict == &SCRIPT_ITEM(current_sctx.sc_sid)->sn_vars->sv_dict
)
&& (rettv->v_type == VAR_FUNC || rettv->v_type == VAR_PARTIAL)
&& var_wrong_func_name(lp->ll_newkey, true)) {
if (tv_dict_wrong_func_name(lp->ll_tv->vval.v_dict, rettv, lp->ll_newkey)) {
return;
}