comparison src/vim9script.c @ 24438:5c6ccab68d1e v8.2.2759

patch 8.2.2759: Vim9: for loop infers type of loop variable Commit: https://github.com/vim/vim/commit/f2253963c28e4791092620df6a6bb238c33168df Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 13 20:53:13 2021 +0200 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 https://github.com/vim/vim/issues/8102)
author Bram Moolenaar <Bram@vim.org>
date Tue, 13 Apr 2021 21:00:05 +0200
parents 28b8ede0d2b9
children e5db23a8ad98
comparison
equal deleted inserted replaced
24437:c63e5ce43b69 24438:5c6ccab68d1e
711 * Vim9 part of adding a script variable: add it to sn_all_vars (lookup by name 711 * Vim9 part of adding a script variable: add it to sn_all_vars (lookup by name
712 * with a hashtable) and sn_var_vals (lookup by index). 712 * with a hashtable) and sn_var_vals (lookup by index).
713 * When "create" is TRUE this is a new variable, otherwise find and update an 713 * When "create" is TRUE this is a new variable, otherwise find and update an
714 * existing variable. 714 * existing variable.
715 * "flags" can have ASSIGN_FINAL or ASSIGN_CONST. 715 * "flags" can have ASSIGN_FINAL or ASSIGN_CONST.
716 * When "*type" is NULL use "tv" for the type and update "*type". 716 * When "*type" is NULL use "tv" for the type and update "*type". If
717 * "do_member" is TRUE also use the member type, otherwise use "any".
717 */ 718 */
718 void 719 void
719 update_vim9_script_var( 720 update_vim9_script_var(
720 int create, 721 int create,
721 dictitem_T *di, 722 dictitem_T *di,
722 int flags, 723 int flags,
723 typval_T *tv, 724 typval_T *tv,
724 type_T **type) 725 type_T **type,
726 int do_member)
725 { 727 {
726 scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); 728 scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
727 hashitem_T *hi; 729 hashitem_T *hi;
728 svar_T *sv; 730 svar_T *sv;
729 731
772 sv = find_typval_in_script(&di->di_tv); 774 sv = find_typval_in_script(&di->di_tv);
773 } 775 }
774 if (sv != NULL) 776 if (sv != NULL)
775 { 777 {
776 if (*type == NULL) 778 if (*type == NULL)
777 *type = typval2type(tv, get_copyID(), &si->sn_type_list); 779 *type = typval2type(tv, get_copyID(), &si->sn_type_list,
780 do_member);
778 sv->sv_type = *type; 781 sv->sv_type = *type;
779 } 782 }
780 783
781 // let ex_export() know the export worked. 784 // let ex_export() know the export worked.
782 is_export = FALSE; 785 is_export = FALSE;