comparison src/vim9expr.c @ 31010:4b9b76aac30c v9.0.0840

patch 9.0.0840: cannot change a slice of a const list Commit: https://github.com/vim/vim/commit/adbc08fd69433b5216e609a404d674f3e67eea9c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 6 18:27:17 2022 +0000 patch 9.0.0840: cannot change a slice of a const list Problem: Cannot change a slice of a const list. (Takumi KAGIYAMA) Solution: Remove the const flag from the slice type. (closes https://github.com/vim/vim/issues/11490)
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Nov 2022 19:30:08 +0100
parents 360f286b5869
children 307f68a41b03
comparison
equal deleted inserted replaced
31009:5bbf18bfeb96 31010:4b9b76aac30c
183 2) == FAIL) 183 2) == FAIL)
184 return FAIL; 184 return FAIL;
185 // a copy is made so the member type is no longer declared 185 // a copy is made so the member type is no longer declared
186 if (typep->type_decl->tt_type == VAR_LIST) 186 if (typep->type_decl->tt_type == VAR_LIST)
187 typep->type_decl = &t_list_any; 187 typep->type_decl = &t_list_any;
188
189 // a copy is made, the composite is no longer "const"
190 if (typep->type_curr->tt_flags & TTFLAG_CONST)
191 {
192 type_T *type = copy_type(typep->type_curr, cctx->ctx_type_list);
193
194 if (type != typep->type_curr) // did get a copy
195 {
196 type->tt_flags &= ~(TTFLAG_CONST | TTFLAG_STATIC);
197 typep->type_curr = type;
198 }
199 }
188 } 200 }
189 else 201 else
190 { 202 {
191 if (typep->type_curr->tt_type == VAR_LIST) 203 if (typep->type_curr->tt_type == VAR_LIST)
192 { 204 {