Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
15761:e2d967c0caf5 | 15762:dff66c4670b1 |
---|---|
770 /* Set l:self to "selfdict". Use "name" to avoid a warning from | 770 /* Set l:self to "selfdict". Use "name" to avoid a warning from |
771 * some compiler that checks the destination size. */ | 771 * some compiler that checks the destination size. */ |
772 v = &fc->fixvar[fixvar_idx++].var; | 772 v = &fc->fixvar[fixvar_idx++].var; |
773 name = v->di_key; | 773 name = v->di_key; |
774 STRCPY(name, "self"); | 774 STRCPY(name, "self"); |
775 v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX; | 775 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; |
776 hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); | 776 hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v)); |
777 v->di_tv.v_type = VAR_DICT; | 777 v->di_tv.v_type = VAR_DICT; |
778 v->di_tv.v_lock = 0; | 778 v->di_tv.v_lock = 0; |
779 v->di_tv.vval.v_dict = selfdict; | 779 v->di_tv.vval.v_dict = selfdict; |
780 ++selfdict->dv_refcount; | 780 ++selfdict->dv_refcount; |
786 * Set a:000 to a list with room for the "..." arguments. | 786 * Set a:000 to a list with room for the "..." arguments. |
787 */ | 787 */ |
788 init_var_dict(&fc->l_avars, &fc->l_avars_var, VAR_SCOPE); | 788 init_var_dict(&fc->l_avars, &fc->l_avars_var, VAR_SCOPE); |
789 add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0", | 789 add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0", |
790 (varnumber_T)(argcount - fp->uf_args.ga_len)); | 790 (varnumber_T)(argcount - fp->uf_args.ga_len)); |
791 fc->l_avars.dv_lock = VAR_FIXED; | |
791 /* Use "name" to avoid a warning from some compiler that checks the | 792 /* Use "name" to avoid a warning from some compiler that checks the |
792 * destination size. */ | 793 * destination size. */ |
793 v = &fc->fixvar[fixvar_idx++].var; | 794 v = &fc->fixvar[fixvar_idx++].var; |
794 name = v->di_key; | 795 name = v->di_key; |
795 STRCPY(name, "000"); | 796 STRCPY(name, "000"); |