comparison src/vim9execute.c @ 20859:876e16c48bd1 v8.2.0981

patch 8.2.0981: Vim9: cannot compile "[var, var] = list" Commit: https://github.com/vim/vim/commit/47a519a933e8bcaf703a5feaac5c01491a658ee3 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 14 23:05:10 2020 +0200 patch 8.2.0981: Vim9: cannot compile "[var, var] = list" Problem: Vim9: cannot compile "[var, var] = list". Solution: Implement list assignment.
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 Jun 2020 23:15:04 +0200
parents 9f921ba86d05
children 65d9189d4dca
comparison
equal deleted inserted replaced
20858:e20d1d3b411c 20859:876e16c48bd1
2112 clear_tv(STACK_TV_BOT(-1)); 2112 clear_tv(STACK_TV_BOT(-1));
2113 copy_tv(&li->li_tv, STACK_TV_BOT(-1)); 2113 copy_tv(&li->li_tv, STACK_TV_BOT(-1));
2114 } 2114 }
2115 break; 2115 break;
2116 2116
2117 case ISN_GETITEM:
2118 {
2119 listitem_T *li;
2120 int index = iptr->isn_arg.number;
2121
2122 // get list item: list is at stack-1, push item
2123 tv = STACK_TV_BOT(-1);
2124 if (tv->v_type != VAR_LIST)
2125 {
2126 emsg(_(e_listreq));
2127 goto failed;
2128 }
2129 if ((li = list_find(tv->vval.v_list, index)) == NULL)
2130 {
2131 semsg(_(e_listidx), index);
2132 goto failed;
2133 }
2134
2135 if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
2136 goto failed;
2137 ++ectx.ec_stack.ga_len;
2138 copy_tv(&li->li_tv, STACK_TV_BOT(-1));
2139 }
2140 break;
2141
2117 case ISN_MEMBER: 2142 case ISN_MEMBER:
2118 { 2143 {
2119 dict_T *dict; 2144 dict_T *dict;
2120 char_u *key; 2145 char_u *key;
2121 dictitem_T *di; 2146 dictitem_T *di;
2787 case ISN_ADDBLOB: smsg("%4d ADDBLOB", current); break; 2812 case ISN_ADDBLOB: smsg("%4d ADDBLOB", current); break;
2788 2813
2789 // expression operations 2814 // expression operations
2790 case ISN_CONCAT: smsg("%4d CONCAT", current); break; 2815 case ISN_CONCAT: smsg("%4d CONCAT", current); break;
2791 case ISN_INDEX: smsg("%4d INDEX", current); break; 2816 case ISN_INDEX: smsg("%4d INDEX", current); break;
2817 case ISN_GETITEM: smsg("%4d ITEM %lld",
2818 current, iptr->isn_arg.number); break;
2792 case ISN_MEMBER: smsg("%4d MEMBER", current); break; 2819 case ISN_MEMBER: smsg("%4d MEMBER", current); break;
2793 case ISN_STRINGMEMBER: smsg("%4d MEMBER %s", current, 2820 case ISN_STRINGMEMBER: smsg("%4d MEMBER %s", current,
2794 iptr->isn_arg.string); break; 2821 iptr->isn_arg.string); break;
2795 case ISN_NEGATENR: smsg("%4d NEGATENR", current); break; 2822 case ISN_NEGATENR: smsg("%4d NEGATENR", current); break;
2796 2823