comparison src/list.c @ 27531:4ca0ee7b4f86 v8.2.4293

patch 8.2.4293: Vim9: when copying a list it gets type list<any> Commit: https://github.com/vim/vim/commit/7676c158798a7c90f500cab2c12af0d47bad6026 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 3 21:47:34 2022 +0000 patch 8.2.4293: Vim9: when copying a list it gets type list<any> Problem: Vim9: when copying a list it gets type list<any> even when the original list did not have a type. Solution: Only set the type when the original list has a type. (closes #9692)
author Bram Moolenaar <Bram@vim.org>
date Thu, 03 Feb 2022 23:00:05 +0100
parents f00a7a2bee21
children e2bb28237695
comparison
equal deleted inserted replaced
27530:763d0c455b72 27531:4ca0ee7b4f86
1214 return NULL; 1214 return NULL;
1215 1215
1216 copy = list_alloc(); 1216 copy = list_alloc();
1217 if (copy != NULL) 1217 if (copy != NULL)
1218 { 1218 {
1219 copy->lv_type = alloc_type(top || deep ? &t_list_any: orig->lv_type); 1219 if (orig->lv_type == NULL)
1220 copy->lv_type = NULL;
1221 else
1222 copy->lv_type = alloc_type(top || deep
1223 ? &t_list_any: orig->lv_type);
1220 if (copyID != 0) 1224 if (copyID != 0)
1221 { 1225 {
1222 // Do this before adding the items, because one of the items may 1226 // Do this before adding the items, because one of the items may
1223 // refer back to this list. 1227 // refer back to this list.
1224 orig->lv_copyID = copyID; 1228 orig->lv_copyID = copyID;