diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-26 21:01:15 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-26 21:01:15 +0000 |
commit | 70c43d84be98ab54d3723155dcc4232dc5a5f081 (patch) | |
tree | 31f3a580fe1bbfecc50e822e718696836d9cb95c /src/evalvars.c | |
parent | 1080c48ec8d672d7e9fbefb5a1255c9df09a2884 (diff) | |
download | vim-git-70c43d84be98ab54d3723155dcc4232dc5a5f081.tar.gz |
patch 8.2.4225: Vim9: depth argument of :lockvar not parsed in :def functionv8.2.4225
Problem: Vim9: depth argument of :lockvar not parsed in :def function.
Solution: Parse the optional depth argument. (closes #9629)
Fix that locking doesn't work for a non-materialize list.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index 496666e1e..c53cc87fb 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -2060,10 +2060,18 @@ item_lock(typval_T *tv, int deep, int lock, int check_refcount) l->lv_lock |= VAR_LOCKED; else l->lv_lock &= ~VAR_LOCKED; - if ((deep < 0 || deep > 1) && l->lv_first != &range_list_item) - // recursive: lock/unlock the items the List contains - FOR_ALL_LIST_ITEMS(l, li) - item_lock(&li->li_tv, deep - 1, lock, check_refcount); + if (deep < 0 || deep > 1) + { + if (l->lv_first == &range_list_item) + l->lv_lock |= VAR_ITEMS_LOCKED; + else + { + // recursive: lock/unlock the items the List contains + CHECK_LIST_MATERIALIZE(l); + FOR_ALL_LIST_ITEMS(l, li) item_lock(&li->li_tv, + deep - 1, lock, check_refcount); + } + } } break; case VAR_DICT: |