1
0
forked from aniani/vim

patch 8.2.2757: Vim9: blob tests for legacy and Vim9 script are separate

Problem:    Vim9: blob tests for legacy and Vim9 script are separate.
Solution:   Add CheckLegacyAndVim9Success().  Make blob index assign work.
This commit is contained in:
Bram Moolenaar
2021-04-12 21:21:02 +02:00
parent cfc3023cb6
commit 68452177ca
11 changed files with 254 additions and 94 deletions

View File

@@ -2219,6 +2219,10 @@ call_def_function(
clear_tv(tv);
}
}
else if (status == OK && dest_type == VAR_BLOB)
{
// TODO
}
else
{
status = FAIL;
@@ -2236,6 +2240,60 @@ call_def_function(
}
break;
// store value in blob range
case ISN_STORERANGE:
{
typval_T *tv_idx1 = STACK_TV_BOT(-3);
typval_T *tv_idx2 = STACK_TV_BOT(-2);
typval_T *tv_dest = STACK_TV_BOT(-1);
int status = OK;
// Stack contains:
// -4 value to be stored
// -3 first index or "none"
// -2 second index or "none"
// -1 destination blob
tv = STACK_TV_BOT(-4);
if (tv_dest->v_type != VAR_BLOB)
{
status = FAIL;
emsg(_(e_blob_required));
}
else
{
varnumber_T n1;
varnumber_T n2;
int error = FALSE;
n1 = tv_get_number_chk(tv_idx1, &error);
if (error)
status = FAIL;
else
{
if (tv_idx2->v_type == VAR_SPECIAL
&& tv_idx2->vval.v_number == VVAL_NONE)
n2 = blob_len(tv_dest->vval.v_blob) - 1;
else
n2 = tv_get_number_chk(tv_idx2, &error);
if (error)
status = FAIL;
else
status = blob_set_range(tv_dest->vval.v_blob,
n1, n2, tv);
}
}
clear_tv(tv_idx1);
clear_tv(tv_idx2);
clear_tv(tv_dest);
ectx.ec_stack.ga_len -= 4;
clear_tv(tv);
if (status == FAIL)
goto on_error;
}
break;
// load or store variable or argument from outer scope
case ISN_LOADOUTER:
case ISN_STOREOUTER:
@@ -4362,6 +4420,10 @@ ex_disassemble(exarg_T *eap)
}
break;
case ISN_STORERANGE:
smsg("%4d STORERANGE", current);
break;
// constants
case ISN_PUSHNR:
smsg("%4d PUSHNR %lld", current,