patch 8.2.1463: Vim9: list slice not supported yet
Problem: Vim9: list slice not supported yet.
Solution: Add support for list slicing.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index c086c1c..da44770 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3171,13 +3171,16 @@
{
if (is_slice)
{
- emsg("Sorry, list slice not implemented yet");
- return FAIL;
+ if (generate_instr_drop(cctx, ISN_LISTSLICE, 2) == FAIL)
+ return FAIL;
}
- if ((*typep)->tt_type == VAR_LIST)
- *typep = (*typep)->tt_member;
- if (generate_instr_drop(cctx, ISN_LISTINDEX, 1) == FAIL)
- return FAIL;
+ else
+ {
+ if ((*typep)->tt_type == VAR_LIST)
+ *typep = (*typep)->tt_member;
+ if (generate_instr_drop(cctx, ISN_LISTINDEX, 1) == FAIL)
+ return FAIL;
+ }
}
else
{
@@ -7095,6 +7098,7 @@
case ISN_EXECUTE:
case ISN_FOR:
case ISN_LISTINDEX:
+ case ISN_LISTSLICE:
case ISN_STRINDEX:
case ISN_STRSLICE:
case ISN_GETITEM: