Mercurial > vim
comparison src/list.c @ 26935:ccb9be1cdd71 v8.2.3996
patch 8.2.3996: Vim9: type checking lacks information about declared type
Commit: https://github.com/vim/vim/commit/078a46161e8b1b30bf306d6c1f4f0af7c616a989
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 4 15:17:03 2022 +0000
patch 8.2.3996: Vim9: type checking lacks information about declared type
Problem: Vim9: type checking for list and dict lacks information about
declared type.
Solution: Add dv_decl_type and lv_decl_type. Refactor the type stack to
store two types in each entry.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 04 Jan 2022 16:30:06 +0100 |
parents | 6cdf92e77a91 |
children | 7045e9308ca3 |
comparison
equal
deleted
inserted
replaced
26934:2d3dd8065e25 | 26935:ccb9be1cdd71 |
---|---|
269 l->lv_used_prev->lv_used_next = l->lv_used_next; | 269 l->lv_used_prev->lv_used_next = l->lv_used_next; |
270 if (l->lv_used_next != NULL) | 270 if (l->lv_used_next != NULL) |
271 l->lv_used_next->lv_used_prev = l->lv_used_prev; | 271 l->lv_used_next->lv_used_prev = l->lv_used_prev; |
272 | 272 |
273 free_type(l->lv_type); | 273 free_type(l->lv_type); |
274 free_type(l->lv_decl_type); | |
274 vim_free(l); | 275 vim_free(l); |
275 } | 276 } |
276 | 277 |
277 void | 278 void |
278 list_free_items(int copyID) | 279 list_free_items(int copyID) |
1023 if (l == NULL) | 1024 if (l == NULL) |
1024 return; | 1025 return; |
1025 // The type will change. | 1026 // The type will change. |
1026 free_type(l->lv_type); | 1027 free_type(l->lv_type); |
1027 l->lv_type = NULL; | 1028 l->lv_type = NULL; |
1029 free_type(l->lv_decl_type); | |
1030 l->lv_decl_type = NULL; | |
1028 } | 1031 } |
1029 else | 1032 else |
1030 { | 1033 { |
1031 if (value_check_lock(l->lv_lock, | 1034 if (value_check_lock(l->lv_lock, |
1032 (char_u *)N_("flatten() argument"), TRUE)) | 1035 (char_u *)N_("flatten() argument"), TRUE)) |
1218 | 1221 |
1219 copy = list_alloc(); | 1222 copy = list_alloc(); |
1220 if (copy != NULL) | 1223 if (copy != NULL) |
1221 { | 1224 { |
1222 copy->lv_type = alloc_type(orig->lv_type); | 1225 copy->lv_type = alloc_type(orig->lv_type); |
1226 copy->lv_decl_type = alloc_type(orig->lv_decl_type); | |
1223 if (copyID != 0) | 1227 if (copyID != 0) |
1224 { | 1228 { |
1225 // Do this before adding the items, because one of the items may | 1229 // Do this before adding the items, because one of the items may |
1226 // refer back to this list. | 1230 // refer back to this list. |
1227 orig->lv_copyID = copyID; | 1231 orig->lv_copyID = copyID; |