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

patch 8.2.4526: Vim9: cannot set variables to a null value

Problem:    Vim9: cannot set variables to a null value.
Solution:   Add null_list, null_job, etc.
This commit is contained in:
Bram Moolenaar
2022-03-08 13:18:55 +00:00
parent 08238045e7
commit 8acb9cc620
16 changed files with 346 additions and 51 deletions

View File

@@ -567,22 +567,19 @@ check_typval_type(type_T *expected, typval_T *actual_tv, where_T where)
if (expected == NULL)
return OK; // didn't expect anything.
//
ga_init2(&type_list, sizeof(type_T *), 10);
// For some values there is no type, assume an error will be given later
// for an invalid value.
// A null_function and null_partial are special cases, they can be used to
// clear a variable.
if ((actual_tv->v_type == VAR_FUNC && actual_tv->vval.v_string == NULL)
|| (actual_tv->v_type == VAR_PARTIAL
&& actual_tv->vval.v_partial == NULL))
{
emsg(_(e_function_reference_is_not_set));
return FAIL;
}
ga_init2(&type_list, sizeof(type_T *), 10);
// When the actual type is list<any> or dict<any> go through the values to
// possibly get a more specific type.
actual_type = typval2type(actual_tv, get_copyID(), &type_list,
actual_type = &t_func_unknown;
else
// When the actual type is list<any> or dict<any> go through the values
// to possibly get a more specific type.
actual_type = typval2type(actual_tv, get_copyID(), &type_list,
TVTT_DO_MEMBER | TVTT_MORE_SPECIFIC);
if (actual_type != NULL)
{