forked from aniani/vim
patch 8.2.3129: Vim9: imported uninitialized list does not get type checked
Problem: Vim9: imported uninitialized list does not get type checked. Solution: Get type from imported variable.
This commit is contained in:
@@ -2564,9 +2564,9 @@ eval_variable(
|
||||
int ret = OK;
|
||||
typval_T *tv = NULL;
|
||||
int found = FALSE;
|
||||
dictitem_T *v;
|
||||
hashtab_T *ht = NULL;
|
||||
int cc;
|
||||
type_T *type = NULL;
|
||||
|
||||
// truncate the name, so that we can use strcmp()
|
||||
cc = name[len];
|
||||
@@ -2576,13 +2576,16 @@ eval_variable(
|
||||
if ((tv = lookup_debug_var(name)) == NULL)
|
||||
{
|
||||
// Check for user-defined variables.
|
||||
v = find_var(name, &ht, flags & EVAL_VAR_NOAUTOLOAD);
|
||||
dictitem_T *v = find_var(name, &ht, flags & EVAL_VAR_NOAUTOLOAD);
|
||||
|
||||
if (v != NULL)
|
||||
{
|
||||
tv = &v->di_tv;
|
||||
if (dip != NULL)
|
||||
*dip = v;
|
||||
}
|
||||
else
|
||||
ht = NULL;
|
||||
}
|
||||
|
||||
if (tv == NULL && (in_vim9script() || STRNCMP(name, "s:", 2) == 0))
|
||||
@@ -2628,6 +2631,7 @@ eval_variable(
|
||||
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data)
|
||||
+ import->imp_var_vals_idx;
|
||||
tv = sv->sv_tv;
|
||||
type = sv->sv_type;
|
||||
}
|
||||
}
|
||||
else if (in_vim9script())
|
||||
@@ -2656,13 +2660,10 @@ eval_variable(
|
||||
}
|
||||
else if (rettv != NULL)
|
||||
{
|
||||
type_T *type = NULL;
|
||||
|
||||
if (ht != NULL && ht == get_script_local_ht())
|
||||
{
|
||||
svar_T *sv = find_typval_in_script(tv, FALSE);
|
||||
svar_T *sv = find_typval_in_script(tv);
|
||||
|
||||
// TODO: check imported variable
|
||||
if (sv != NULL)
|
||||
type = sv->sv_type;
|
||||
}
|
||||
|
Reference in New Issue
Block a user