mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.1949: Vim9: using extend() on null dict is silently ignored
Problem: Vim9: using extend() on null dict is silently ignored. Solution: Give an error message. Initialize a dict variable with an empty dictionary. (closes #7251)
This commit is contained in:
@@ -2553,7 +2553,22 @@ eval_variable(
|
||||
ret = FAIL;
|
||||
}
|
||||
else if (rettv != NULL)
|
||||
{
|
||||
// If a list or dict variable wasn't initialized, do it now.
|
||||
if (tv->v_type == VAR_DICT && tv->vval.v_dict == NULL)
|
||||
{
|
||||
tv->vval.v_dict = dict_alloc();
|
||||
if (tv->vval.v_dict != NULL)
|
||||
++tv->vval.v_dict->dv_refcount;
|
||||
}
|
||||
else if (tv->v_type == VAR_LIST && tv->vval.v_list == NULL)
|
||||
{
|
||||
tv->vval.v_list = list_alloc();
|
||||
if (tv->vval.v_list != NULL)
|
||||
++tv->vval.v_list->lv_refcount;
|
||||
}
|
||||
copy_tv(tv, rettv);
|
||||
}
|
||||
}
|
||||
|
||||
name[len] = cc;
|
||||
|
Reference in New Issue
Block a user