Mercurial > vim
comparison src/vim9compile.c @ 21828:af5db9b6d210
patch 8.2.1463: Vim9: list slice not supported yet
Commit: https://github.com/vim/vim/commit/ed5918771fcf9877d8445e74c62ab1ce6b8e28c1
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 15 22:14:53 2020 +0200
patch 8.2.1463: Vim9: list slice not supported yet
Problem: Vim9: list slice not supported yet.
Solution: Add support for list slicing.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 15 Aug 2020 22:15:03 +0200 |
parents | ccad66ac6c3e |
children | d8422de73113 |
comparison
equal
deleted
inserted
replaced
21827:fbafd1638f76 | 21828:af5db9b6d210 |
---|---|
3169 } | 3169 } |
3170 else if (vtype == VAR_LIST || *typep == &t_any) | 3170 else if (vtype == VAR_LIST || *typep == &t_any) |
3171 { | 3171 { |
3172 if (is_slice) | 3172 if (is_slice) |
3173 { | 3173 { |
3174 emsg("Sorry, list slice not implemented yet"); | 3174 if (generate_instr_drop(cctx, ISN_LISTSLICE, 2) == FAIL) |
3175 return FAIL; | 3175 return FAIL; |
3176 } | 3176 } |
3177 if ((*typep)->tt_type == VAR_LIST) | 3177 else |
3178 *typep = (*typep)->tt_member; | 3178 { |
3179 if (generate_instr_drop(cctx, ISN_LISTINDEX, 1) == FAIL) | 3179 if ((*typep)->tt_type == VAR_LIST) |
3180 return FAIL; | 3180 *typep = (*typep)->tt_member; |
3181 if (generate_instr_drop(cctx, ISN_LISTINDEX, 1) == FAIL) | |
3182 return FAIL; | |
3183 } | |
3181 } | 3184 } |
3182 else | 3185 else |
3183 { | 3186 { |
3184 emsg(_(e_list_dict_or_blob_required)); | 3187 emsg(_(e_list_dict_or_blob_required)); |
3185 return FAIL; | 3188 return FAIL; |
7093 case ISN_ENDTRY: | 7096 case ISN_ENDTRY: |
7094 case ISN_EXECCONCAT: | 7097 case ISN_EXECCONCAT: |
7095 case ISN_EXECUTE: | 7098 case ISN_EXECUTE: |
7096 case ISN_FOR: | 7099 case ISN_FOR: |
7097 case ISN_LISTINDEX: | 7100 case ISN_LISTINDEX: |
7101 case ISN_LISTSLICE: | |
7098 case ISN_STRINDEX: | 7102 case ISN_STRINDEX: |
7099 case ISN_STRSLICE: | 7103 case ISN_STRSLICE: |
7100 case ISN_GETITEM: | 7104 case ISN_GETITEM: |
7101 case ISN_SLICE: | 7105 case ISN_SLICE: |
7102 case ISN_MEMBER: | 7106 case ISN_MEMBER: |