0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2759: Vim9: for loop infers type of loop variable

Problem:    Vim9: for loop infers type of loop variable.
Solution:   Do not get the member type. (closes #8102)
This commit is contained in:
Bram Moolenaar
2021-04-13 20:53:13 +02:00
parent f48b2fa33c
commit f2253963c2
8 changed files with 112 additions and 85 deletions

View File

@@ -713,7 +713,8 @@ vim9_declare_scriptvar(exarg_T *eap, char_u *arg)
* When "create" is TRUE this is a new variable, otherwise find and update an
* existing variable.
* "flags" can have ASSIGN_FINAL or ASSIGN_CONST.
* When "*type" is NULL use "tv" for the type and update "*type".
* When "*type" is NULL use "tv" for the type and update "*type". If
* "do_member" is TRUE also use the member type, otherwise use "any".
*/
void
update_vim9_script_var(
@@ -721,7 +722,8 @@ update_vim9_script_var(
dictitem_T *di,
int flags,
typval_T *tv,
type_T **type)
type_T **type,
int do_member)
{
scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
hashitem_T *hi;
@@ -774,7 +776,8 @@ update_vim9_script_var(
if (sv != NULL)
{
if (*type == NULL)
*type = typval2type(tv, get_copyID(), &si->sn_type_list);
*type = typval2type(tv, get_copyID(), &si->sn_type_list,
do_member);
sv->sv_type = *type;
}