Mercurial > vim
diff src/userfunc.c @ 15762:dff66c4670b1 v8.1.0888
patch 8.1.0888: the a: dict is not immutable as documented
commit https://github.com/vim/vim/commit/31b816042fca879b11965ddd75287732563ba698
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 10 22:14:27 2019 +0100
patch 8.1.0888: the a: dict is not immutable as documented
Problem: The a: dict is not immutable as documented.
Solution: Make the a:dict immutable, add a test. (Ozaki Kiichi, Yasuhiro
Matsumoto, closes #3929)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 10 Feb 2019 22:15:05 +0100 |
parents | e84eb23f4670 |
children | 5b6c3c7feba8 |
line wrap: on
line diff
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -772,7 +772,7 @@ call_user_func( v = &fc->fixvar[fixvar_idx++].var; name = v->di_key; STRCPY(name, "self"); - v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX; + v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); v->di_tv.v_type = VAR_DICT; v->di_tv.v_lock = 0; @@ -788,6 +788,7 @@ call_user_func( init_var_dict(&fc->l_avars, &fc->l_avars_var, VAR_SCOPE); add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0", (varnumber_T)(argcount - fp->uf_args.ga_len)); + fc->l_avars.dv_lock = VAR_FIXED; /* Use "name" to avoid a warning from some compiler that checks the * destination size. */ v = &fc->fixvar[fixvar_idx++].var;