summaryrefslogtreecommitdiffstats
path: root/src/dict.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-02 11:49:23 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-02 11:49:23 +0200
commitb54abeeafb074248597878a874fed9a66b114c06 (patch)
tree23767345ef1431fb9291acd6ad65ae52dabcc789 /src/dict.c
parent6f1d2aa437744a7cb0206fdaa543a788c5a56c79 (diff)
patch 8.2.2921: E704 for script local variable is not backwards compatiblev8.2.2921
Problem: E704 for script local variable is not backwards compatible. (Yasuhiro Matsumoto) Solution: Only give the error in Vim9 script. Also check for function-local variable.
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dict.c b/src/dict.c
index 876eeea492..f0f045b272 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -352,8 +352,9 @@ dict_copy(dict_T *orig, int deep, int copyID)
dict_wrong_func_name(dict_T *d, typval_T *tv, char_u *name)
{
return (d == get_globvar_dict()
- || (SCRIPT_ID_VALID(current_sctx.sc_sid)
- && d == &SCRIPT_ITEM(current_sctx.sc_sid)->sn_vars->sv_dict))
+ || (in_vim9script() && SCRIPT_ID_VALID(current_sctx.sc_sid)
+ && d == &SCRIPT_ITEM(current_sctx.sc_sid)->sn_vars->sv_dict)
+ || &d->dv_hashtab == get_funccal_local_ht())
&& (tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL)
&& var_wrong_func_name(name, TRUE);
}