0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.4487: Vim9: cannot compare with v:null

Problem:    Vim9: cannot compare with v:null.
Solution:   Allow comparing anything with v:null. (closes #9866)
This commit is contained in:
Bram Moolenaar
2022-03-01 19:23:24 +00:00
parent f01af9c4e6
commit 7a22224875
9 changed files with 188 additions and 19 deletions

View File

@@ -2816,29 +2816,33 @@ eval_variable(
}
// If a list or dict variable wasn't initialized, do it now.
if (tv->v_type == VAR_DICT && tv->vval.v_dict == NULL)
// Not for global variables, they are not declared.
if (ht != &globvarht)
{
tv->vval.v_dict = dict_alloc();
if (tv->vval.v_dict != NULL)
if (tv->v_type == VAR_DICT && tv->vval.v_dict == NULL)
{
++tv->vval.v_dict->dv_refcount;
tv->vval.v_dict->dv_type = alloc_type(type);
tv->vval.v_dict = dict_alloc();
if (tv->vval.v_dict != NULL)
{
++tv->vval.v_dict->dv_refcount;
tv->vval.v_dict->dv_type = alloc_type(type);
}
}
}
else if (tv->v_type == VAR_LIST && tv->vval.v_list == NULL)
{
tv->vval.v_list = list_alloc();
if (tv->vval.v_list != NULL)
else if (tv->v_type == VAR_LIST && tv->vval.v_list == NULL)
{
++tv->vval.v_list->lv_refcount;
tv->vval.v_list->lv_type = alloc_type(type);
tv->vval.v_list = list_alloc();
if (tv->vval.v_list != NULL)
{
++tv->vval.v_list->lv_refcount;
tv->vval.v_list->lv_type = alloc_type(type);
}
}
else if (tv->v_type == VAR_BLOB && tv->vval.v_blob == NULL)
{
tv->vval.v_blob = blob_alloc();
if (tv->vval.v_blob != NULL)
++tv->vval.v_blob->bv_refcount;
}
}
else if (tv->v_type == VAR_BLOB && tv->vval.v_blob == NULL)
{
tv->vval.v_blob = blob_alloc();
if (tv->vval.v_blob != NULL)
++tv->vval.v_blob->bv_refcount;
}
copy_tv(tv, rettv);
}