patch 8.2.1011: Vim9: some code not tested
Problem: Vim9: some code not tested.
Solution: Add a few more test cases. Reorder checks for clearer error.
Remove unreachable code.
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 53a30c9..4271f38 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -2144,18 +2144,10 @@
listitem_T *li;
int index = iptr->isn_arg.number;
- // get list item: list is at stack-1, push item
+ // Get list item: list is at stack-1, push item.
+ // List type and length is checked for when compiling.
tv = STACK_TV_BOT(-1);
- if (tv->v_type != VAR_LIST)
- {
- emsg(_(e_listreq));
- goto failed;
- }
- if ((li = list_find(tv->vval.v_list, index)) == NULL)
- {
- semsg(_(e_listidx), index);
- goto failed;
- }
+ li = list_find(tv->vval.v_list, index);
if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
goto failed;