Mercurial > vim
diff src/vim9execute.c @ 25776:f31cf0388eab v8.2.3423
patch 8.2.3423: Vim9: list += list creates a new list in :def function
Commit: https://github.com/vim/vim/commit/07802044b90b2cbcc64b2dfe235f019d7c37589c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 9 23:01:14 2021 +0200
patch 8.2.3423: Vim9: list += list creates a new list in :def function
Problem: Vim9: list += list creates a new list in :def function.
Solution: Append to the existing list.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 09 Sep 2021 23:15:04 +0200 |
parents | 154663508d9b |
children | fe8d153cb268 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -3677,7 +3677,14 @@ exec_instructions(ectx_T *ectx) // add two lists or blobs if (iptr->isn_type == ISN_ADDLIST) - eval_addlist(tv1, tv2); + { + if (iptr->isn_arg.op.op_type == EXPR_APPEND + && tv1->vval.v_list != NULL) + list_extend(tv1->vval.v_list, tv2->vval.v_list, + NULL); + else + eval_addlist(tv1, tv2); + } else eval_addblob(tv1, tv2); clear_tv(tv2);