comparison src/vim9compile.c @ 24432:aa150abca273 v8.2.2756

patch 8.2.2756: Vim9: blob index and slice not implemented yet Commit: https://github.com/vim/vim/commit/cfc3023cb6ce5aaec13f49bc4b821feb05e3fb03 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 11 20:26:34 2021 +0200 patch 8.2.2756: Vim9: blob index and slice not implemented yet Problem: Vim9: blob index and slice not implemented yet. Solution: Implement blob index and slice.
author Bram Moolenaar <Bram@vim.org>
date Sun, 11 Apr 2021 20:30:04 +0200
parents fe71212fd202
children 602e528a8e43
comparison
equal deleted inserted replaced
24431:8f23b64d87fa 24432:aa150abca273
2723 : generate_instr_drop(cctx, ISN_STRINDEX, 1)) == FAIL) 2723 : generate_instr_drop(cctx, ISN_STRINDEX, 1)) == FAIL)
2724 return FAIL; 2724 return FAIL;
2725 } 2725 }
2726 else if (vtype == VAR_BLOB) 2726 else if (vtype == VAR_BLOB)
2727 { 2727 {
2728 emsg("Sorry, blob index and slice not implemented yet"); 2728 if (is_slice)
2729 return FAIL; 2729 {
2730 *typep = &t_blob;
2731 if (generate_instr_drop(cctx, ISN_BLOBSLICE, 2) == FAIL)
2732 return FAIL;
2733 }
2734 else
2735 {
2736 *typep = &t_number;
2737 if (generate_instr_drop(cctx, ISN_BLOBINDEX, 1) == FAIL)
2738 return FAIL;
2739 }
2730 } 2740 }
2731 else if (vtype == VAR_LIST || *typep == &t_any) 2741 else if (vtype == VAR_LIST || *typep == &t_any)
2732 { 2742 {
2733 if (is_slice) 2743 if (is_slice)
2734 { 2744 {
4086 int is_slice = FALSE; 4096 int is_slice = FALSE;
4087 4097
4088 // list index: list[123] 4098 // list index: list[123]
4089 // dict member: dict[key] 4099 // dict member: dict[key]
4090 // string index: text[123] 4100 // string index: text[123]
4091 // TODO: blob index 4101 // blob index: blob[123]
4092 // TODO: more arguments 4102 // TODO: more arguments
4093 // TODO: recognize list or dict at runtime 4103 // TODO: recognize list or dict at runtime
4094 if (generate_ppconst(cctx, ppconst) == FAIL) 4104 if (generate_ppconst(cctx, ppconst) == FAIL)
4095 return FAIL; 4105 return FAIL;
4096 ppconst->pp_is_const = FALSE; 4106 ppconst->pp_is_const = FALSE;
9239 case ISN_ADDLIST: 9249 case ISN_ADDLIST:
9240 case ISN_ANYINDEX: 9250 case ISN_ANYINDEX:
9241 case ISN_ANYSLICE: 9251 case ISN_ANYSLICE:
9242 case ISN_BCALL: 9252 case ISN_BCALL:
9243 case ISN_BLOBAPPEND: 9253 case ISN_BLOBAPPEND:
9254 case ISN_BLOBINDEX:
9255 case ISN_BLOBSLICE:
9244 case ISN_CATCH: 9256 case ISN_CATCH:
9245 case ISN_CHECKLEN: 9257 case ISN_CHECKLEN:
9246 case ISN_CHECKNR: 9258 case ISN_CHECKNR:
9247 case ISN_CMDMOD_REV: 9259 case ISN_CMDMOD_REV:
9248 case ISN_COMPAREANY: 9260 case ISN_COMPAREANY: