aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/typval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-04 13:54:55 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-05-04 14:44:38 +0800
commit1659cd15bebfd8553bb91f24d833789451705b03 (patch)
tree3bd30c8c82db000a867faea195c776f52364f548 /src/nvim/eval/typval.c
parent24d4a825693db5f8454a389259a76f71f8697832 (diff)
downloadrneovim-1659cd15bebfd8553bb91f24d833789451705b03.tar.gz
rneovim-1659cd15bebfd8553bb91f24d833789451705b03.tar.bz2
rneovim-1659cd15bebfd8553bb91f24d833789451705b03.zip
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. https://github.com/vim/vim/commit/9af78769eeae0318e07aa8b6af4d6e2244481ca7 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r--src/nvim/eval/typval.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index cf355a22fa..297adf7f9c 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -765,6 +765,17 @@ int tv_list_concat(list_T *const l1, list_T *const l2, typval_T *const tv)
return OK;
}
+list_T *tv_list_slice(list_T *ol, int n1, int n2)
+{
+ list_T *l = tv_list_alloc(n2 - n1 + 1);
+ listitem_T *item = tv_list_find(ol, n1);
+ for (; n1 <= n2; n1++) {
+ tv_list_append_tv(l, TV_LIST_ITEM_TV(item));
+ item = TV_LIST_ITEM_NEXT(rettv->vval.v_list, item);
+ }
+ return l;
+}
+
typedef struct {
char *s;
char *tofree;