comparison src/eval.c @ 20871:65d9189d4dca v8.2.0987

patch 8.2.0987: Vim9: cannot assign to [var; var] Commit: https://github.com/vim/vim/commit/9af78769eeae0318e07aa8b6af4d6e2244481ca7 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 16 11:34:42 2020 +0200 patch 8.2.0987: Vim9: cannot assign to [var; var] Problem: Vim9: cannot assign to [var; var]. Solution: Assign rest of items to a list.
author Bram Moolenaar <Bram@vim.org>
date Tue, 16 Jun 2020 11:45:04 +0200
parents 876e16c48bd1
children 1693ca876049
comparison
equal deleted inserted replaced
20870:6203fd2cfb51 20871:65d9189d4dca
3235 n1 = len; 3235 n1 = len;
3236 } 3236 }
3237 if (range) 3237 if (range)
3238 { 3238 {
3239 list_T *l; 3239 list_T *l;
3240 listitem_T *item;
3241 3240
3242 if (n2 < 0) 3241 if (n2 < 0)
3243 n2 = len + n2; 3242 n2 = len + n2;
3244 else if (n2 >= len) 3243 else if (n2 >= len)
3245 n2 = len - 1; 3244 n2 = len - 1;
3246 if (!empty2 && (n2 < 0 || n2 + 1 < n1)) 3245 if (!empty2 && (n2 < 0 || n2 + 1 < n1))
3247 n2 = -1; 3246 n2 = -1;
3248 l = list_alloc(); 3247 l = list_slice(rettv->vval.v_list, n1, n2);
3249 if (l == NULL) 3248 if (l == NULL)
3250 return FAIL; 3249 return FAIL;
3251 for (item = list_find(rettv->vval.v_list, n1);
3252 n1 <= n2; ++n1)
3253 {
3254 if (list_append_tv(l, &item->li_tv) == FAIL)
3255 {
3256 list_free(l);
3257 return FAIL;
3258 }
3259 item = item->li_next;
3260 }
3261 clear_tv(rettv); 3250 clear_tv(rettv);
3262 rettv_list_set(rettv, l); 3251 rettv_list_set(rettv, l);
3263 } 3252 }
3264 else 3253 else
3265 { 3254 {