vim-patch:8.2.2782: Vim9: blob operations not fully tested

Problem:    Vim9: blob operations not fully tested.
Solution:   Make more blob tests run in Vim9 script.  Fix filter().  Make
            insert() give an error for a null blob, like add().

39211cba72

vim-patch:8.2.3284: no error for insert() or remove() changing a locked blob

Problem:    No error for insert() or remove() changing a locked blob.
Solution:   Check a blob is not locked before changing it. (Sean Dewar,
            closes vim/vim#8696)

80d7395dcf

Co-authored-by: Bram Moolenaar <Bram@vim.org>
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
This commit is contained in:
zeertzjq
2023-02-28 15:50:35 +08:00
parent 0ded757c31
commit 88b70e7d46
4 changed files with 253 additions and 91 deletions

View File

@@ -3743,7 +3743,6 @@ static void f_inputsecret(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// "insert()" function
static void f_insert(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
list_T *l;
bool error = false;
if (argvars[0].v_type == VAR_BLOB) {
@@ -3786,8 +3785,12 @@ static void f_insert(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
tv_copy(&argvars[0], rettv);
} else if (argvars[0].v_type != VAR_LIST) {
semsg(_(e_listblobarg), "insert()");
} else if (!value_check_lock(tv_list_locked((l = argvars[0].vval.v_list)),
N_("insert() argument"), TV_TRANSLATE)) {
} else {
list_T *l = argvars[0].vval.v_list;
if (value_check_lock(tv_list_locked(l), N_("insert() argument"), TV_TRANSLATE)) {
return;
}
int64_t before = 0;
if (argvars[2].v_type != VAR_UNKNOWN) {
before = tv_get_number_chk(&argvars[2], &error);