forked from aniani/vim
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.
This commit is contained in:
20
src/list.c
20
src/list.c
@@ -868,6 +868,26 @@ list_concat(list_T *l1, list_T *l2, typval_T *tv)
|
||||
return list_extend(l, l2, NULL);
|
||||
}
|
||||
|
||||
list_T *
|
||||
list_slice(list_T *ol, long n1, long n2)
|
||||
{
|
||||
listitem_T *item;
|
||||
list_T *l = list_alloc();
|
||||
|
||||
if (l == NULL)
|
||||
return NULL;
|
||||
for (item = list_find(ol, n1); n1 <= n2; ++n1)
|
||||
{
|
||||
if (list_append_tv(l, &item->li_tv) == FAIL)
|
||||
{
|
||||
list_free(l);
|
||||
return NULL;
|
||||
}
|
||||
item = item->li_next;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a copy of list "orig". Shallow if "deep" is FALSE.
|
||||
* The refcount of the new list is set to 1.
|
||||
|
||||
Reference in New Issue
Block a user