mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Problem: Vim9: constant list and dict get a declaration type other than "any". Solution: A constant list and dict have a declared member type "any". (closes #9701)
This commit is contained in:
@@ -1359,7 +1359,6 @@ get_decl_type_on_stack(cctx_T *cctx, int offset)
|
||||
get_member_type_from_stack(
|
||||
int count,
|
||||
int skip,
|
||||
type_T **decl_type,
|
||||
cctx_T *cctx)
|
||||
{
|
||||
garray_T *stack = &cctx->ctx_type_stack;
|
||||
@@ -1367,32 +1366,24 @@ get_member_type_from_stack(
|
||||
garray_T *type_gap = cctx->ctx_type_list;
|
||||
int i;
|
||||
type_T *result;
|
||||
type_T *decl_result;
|
||||
type_T *type;
|
||||
|
||||
// Use "unknown" for an empty list or dict.
|
||||
if (count == 0)
|
||||
{
|
||||
*decl_type = &t_unknown;
|
||||
return &t_unknown;
|
||||
}
|
||||
|
||||
// Use the first value type for the list member type, then find the common
|
||||
// type from following items.
|
||||
typep = ((type2_T *)stack->ga_data) + stack->ga_len;
|
||||
result = (typep -(count * skip) + skip - 1)->type_curr;
|
||||
decl_result = (typep -(count * skip) + skip - 1)->type_decl;
|
||||
for (i = 1; i < count; ++i)
|
||||
{
|
||||
if (result == &t_any)
|
||||
break; // won't get more common
|
||||
type = (typep -((count - i) * skip) + skip - 1)->type_curr;
|
||||
common_type(type, result, &result, type_gap);
|
||||
type = (typep -((count - i) * skip) + skip - 1)->type_decl;
|
||||
common_type(type, decl_result, &decl_result, type_gap);
|
||||
}
|
||||
|
||||
*decl_type = decl_result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user