diff src/evalfunc.c @ 27394:69a48bcd1d80 v8.2.4225

patch 8.2.4225: Vim9: depth argument of :lockvar not parsed in :def function Commit: https://github.com/vim/vim/commit/70c43d84be98ab54d3723155dcc4232dc5a5f081 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 26 21:01:15 2022 +0000 patch 8.2.4225: Vim9: depth argument of :lockvar not parsed in :def function Problem: Vim9: depth argument of :lockvar not parsed in :def function. Solution: Parse the optional depth argument. (closes https://github.com/vim/vim/issues/9629) Fix that locking doesn't work for a non-materialize list.
author Bram Moolenaar <Bram@vim.org>
date Wed, 26 Jan 2022 22:15:03 +0100
parents ec2ba9acec1b
children 722db0819111
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -7922,7 +7922,7 @@ range_list_materialize(list_T *list)
 {
     varnumber_T start = list->lv_u.nonmat.lv_start;
     varnumber_T end = list->lv_u.nonmat.lv_end;
-    int	    stride = list->lv_u.nonmat.lv_stride;
+    int		stride = list->lv_u.nonmat.lv_stride;
     varnumber_T i;
 
     list->lv_first = NULL;
@@ -7930,8 +7930,13 @@ range_list_materialize(list_T *list)
     list->lv_len = 0;
     list->lv_u.mat.lv_idx_item = NULL;
     for (i = start; stride > 0 ? i <= end : i >= end; i += stride)
+    {
 	if (list_append_number(list, (varnumber_T)i) == FAIL)
 	    break;
+	if (list->lv_lock & VAR_ITEMS_LOCKED)
+	    list->lv_u.mat.lv_last->li_tv.v_lock = VAR_LOCKED;
+    }
+    list->lv_lock &= ~VAR_ITEMS_LOCKED;
 }
 
 /*