1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2021-04-17 20:44:56 +02:00
parent 0995c81f2f
commit 51e933261b
8 changed files with 230 additions and 93 deletions

View File

@@ -2221,7 +2221,35 @@ call_def_function(
}
else if (status == OK && dest_type == VAR_BLOB)
{
// TODO
long lidx = (long)tv_idx->vval.v_number;
blob_T *blob = tv_dest->vval.v_blob;
varnumber_T nr;
int error = FALSE;
int len;
if (blob == NULL)
{
emsg(_(e_blob_not_set));
goto on_error;
}
len = blob_len(blob);
if (lidx < 0 && len + lidx >= 0)
// negative index is relative to the end
lidx = len + lidx;
// Can add one byte at the end.
if (lidx < 0 || lidx > len)
{
semsg(_(e_blobidx), lidx);
goto on_error;
}
if (value_check_lock(blob->bv_lock,
(char_u *)"blob", FALSE))
goto on_error;
nr = tv_get_number_chk(tv, &error);
if (error)
goto on_error;
blob_set_append(blob, lidx, nr);
}
else
{
@@ -4415,19 +4443,8 @@ ex_disassemble(exarg_T *eap)
break;
case ISN_STOREINDEX:
switch (iptr->isn_arg.vartype)
{
case VAR_LIST:
smsg("%4d STORELIST", current);
break;
case VAR_DICT:
smsg("%4d STOREDICT", current);
break;
case VAR_ANY:
smsg("%4d STOREINDEX", current);
break;
default: break;
}
smsg("%4d STOREINDEX %s", current,
vartype_name(iptr->isn_arg.vartype));
break;
case ISN_STORERANGE: