diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-20 22:21:59 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-20 22:21:59 +0200 |
commit | 63cb6567f0153c35dc75cbc09039ff5d0a7b60e3 (patch) | |
tree | 5b9d2565e941b428a5c01288336de4448eb740c7 /src/vim9execute.c | |
parent | e29a27f6f8eef8f00d3c2d4cd9811d81cf3026b3 (diff) | |
download | vim-git-63cb6567f0153c35dc75cbc09039ff5d0a7b60e3.tar.gz |
patch 8.2.3191: Vim9: not enough code is testedv8.2.3191
Problem: Vim9: not enough code is tested.
Solution: Use CheckLegacyAndVim9Success() in more places. Fix uncovered
problems.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r-- | src/vim9execute.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c index 73896cb7a..32e52ac39 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -2679,7 +2679,8 @@ exec_instructions(ectx_T *ectx) // indexes must be a number SOURCING_LNUM = iptr->isn_lnum; if (check_for_number(tv_idx1) == FAIL - || check_for_number(tv_idx2) == FAIL) + || (tv_idx2->v_type != VAR_SPECIAL + && check_for_number(tv_idx2) == FAIL)) { status = FAIL; } @@ -2687,14 +2688,32 @@ exec_instructions(ectx_T *ectx) { list_T *l = tv_dest->vval.v_list; long n1 = (long)tv_idx1->vval.v_number; - long n2 = (long)tv_idx2->vval.v_number; + long n2 = tv_idx2->v_type == VAR_SPECIAL + ? 0 : (long)tv_idx2->vval.v_number; listitem_T *li; li = list_find_index(l, &n1); - if (li == NULL - || list_unlet_range(l, li, NULL, n1, - TRUE, n2) == FAIL) + if (li == NULL) status = FAIL; + else + { + if (n1 < 0) + n1 = list_idx_of_item(l, li); + if (n2 < 0) + { + listitem_T *li2 = list_find(l, n2); + + if (li2 == NULL) + status = FAIL; + else + n2 = list_idx_of_item(l, li2); + } + if (status != FAIL + && list_unlet_range(l, li, NULL, n1, + tv_idx2->v_type != VAR_SPECIAL, n2) + == FAIL) + status = FAIL; + } } } else |