diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-20 17:46:06 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-20 17:46:06 +0000 |
commit | 6b8c7ba062ca4b50e8f983e0485be7afa4eef691 (patch) | |
tree | 3785ea7cbfd478401baa1542acd8211876a1248b /src/evalvars.c | |
parent | a4df834a92535cf124afd1c3b711b4a7109e3534 (diff) | |
download | vim-git-6b8c7ba062ca4b50e8f983e0485be7afa4eef691.tar.gz |
patch 8.2.4600: Vim9: not enough test coverage for executing :def functionv8.2.4600
Problem: Vim9: not enough test coverage for executing :def function.
Solution: Add a few more tests. Fix inconsistencies.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index 4f7252c5c..058e8048f 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -1804,20 +1804,14 @@ do_unlet_var( && value_check_lock(lp->ll_dict->dv_lock, lp->ll_name, FALSE))) return FAIL; else if (lp->ll_range) - { - if (list_unlet_range(lp->ll_list, lp->ll_li, lp->ll_name, lp->ll_n1, - !lp->ll_empty2, lp->ll_n2) == FAIL) - return FAIL; - } + list_unlet_range(lp->ll_list, lp->ll_li, lp->ll_n1, + !lp->ll_empty2, lp->ll_n2); + else if (lp->ll_list != NULL) + // unlet a List item. + listitem_remove(lp->ll_list, lp->ll_li); else - { - if (lp->ll_list != NULL) - // unlet a List item. - listitem_remove(lp->ll_list, lp->ll_li); - else - // unlet a Dictionary item. - dictitem_remove(lp->ll_dict, lp->ll_di); - } + // unlet a Dictionary item. + dictitem_remove(lp->ll_dict, lp->ll_di); return ret; } @@ -1826,11 +1820,10 @@ do_unlet_var( * Unlet one item or a range of items from a list. * Return OK or FAIL. */ - int + void list_unlet_range( list_T *l, listitem_T *li_first, - char_u *name, long n1_arg, int has_n2, long n2) @@ -1838,14 +1831,6 @@ list_unlet_range( listitem_T *li = li_first; int n1 = n1_arg; - while (li != NULL && (!has_n2 || n2 >= n1)) - { - if (value_check_lock(li->li_tv.v_lock, name, FALSE)) - return FAIL; - li = li->li_next; - ++n1; - } - // Delete a range of List items. li = li_first; n1 = n1_arg; @@ -1857,7 +1842,6 @@ list_unlet_range( li = next; ++n1; } - return OK; } /* * "unlet" a variable. Return OK if it existed, FAIL if not. |