Mercurial > vim
diff src/vim9compile.c @ 24475:96905804bf5a
patch 8.2.2777: Vim9: blob operations not tested in all ways
Commit: https://github.com/vim/vim/commit/51e933261b984db014e858d79387a826d2626fb6
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 17 20:44:56 2021 +0200
patch 8.2.2777: Vim9: blob operations not tested in all ways
Problem: Vim9: blob operations not tested in all ways.
Solution: Run tests with CheckLegacyAndVim9Success(). Make blob assign with
index work.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 17 Apr 2021 20:45:04 +0200 |
parents | baf75c8e1b7b |
children | 943e9b1d2d16 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -6209,14 +6209,21 @@ compile_assign_unlet( } if (dest_type == VAR_DICT && may_generate_2STRING(-1, cctx) == FAIL) return FAIL; - if (dest_type == VAR_LIST) - { - if (range - && need_type(((type_T **)stack->ga_data)[stack->ga_len - 2], - &t_number, -1, 0, cctx, FALSE, FALSE) == FAIL) + if (dest_type == VAR_LIST || dest_type == VAR_BLOB) + { + type_T *type; + + if (range) + { + type = ((type_T **)stack->ga_data)[stack->ga_len - 2]; + if (need_type(type, &t_number, + -1, 0, cctx, FALSE, FALSE) == FAIL) return FAIL; - if (need_type(((type_T **)stack->ga_data)[stack->ga_len - 1], - &t_number, -1, 0, cctx, FALSE, FALSE) == FAIL) + } + type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; + if ((dest_type != VAR_BLOB || type != &t_special) + && need_type(type, &t_number, + -1, 0, cctx, FALSE, FALSE) == FAIL) return FAIL; } }