On Sunday, August 17, 2014 9:28:25 PM UTC+4, ZyX wrote:
> And fourth: behave like map: do its job until lock occurs and fail at the 
> first lock.
> * The above code was for :unlet, for :let slice assignment there should be 
> something similar (except that option 3. will no longer be consistent with 
> anything).

Full patch for fourth approach (with tests):

diff -r 18fd959b07ef src/eval.c
--- a/src/eval.c        Wed Aug 13 22:05:54 2014 +0200
+++ b/src/eval.c        Sun Aug 17 21:44:48 2014 +0400
@@ -2950,6 +2950,8 @@ set_var_lval(lp, endp, rettv, copy, op)
         */
        for (ri = rettv->vval.v_list->lv_first; ri != NULL; )
        {
+           if (tv_check_lock(lp->ll_li->li_tv.v_lock, lp->ll_name))
+               return;
            if (op != NULL && *op != '=')
                tv_op(&lp->ll_li->li_tv, &ri->li_tv, op);
            else
@@ -3651,6 +3653,8 @@ do_unlet_var(lp, name_end, forceit)
        while (lp->ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= lp->ll_n1))
        {
            li = lp->ll_li->li_next;
+           if (tv_check_lock(lp->ll_li->li_tv.v_lock, lp->ll_name))
+               return FAIL;
            listitem_remove(lp->ll_list, lp->ll_li);
            lp->ll_li = li;
            ++lp->ll_n1;
diff -r 18fd959b07ef src/testdir/test55.in
--- a/src/testdir/test55.in     Wed Aug 13 22:05:54 2014 +0200
+++ b/src/testdir/test55.in     Sun Aug 17 21:44:48 2014 +0400
@@ -282,6 +282,21 @@ let l = [0, 1, 2, 3]
 :    $put =ps
 :  endfor
 :endfor
+:unlet l
+:let l = [1, 2, 3, 4]
+:lockvar! l
+:$put =string(l)
+:unlockvar l[1]
+:unlet l[0:1]
+:$put =string(l)
+:unlet l[1:2]
+:$put =string(l)
+:unlockvar l[1]
+:let l[0:1] = [0, 1]
+:$put =string(l)
+:let l[1:2] = [0, 1]
+:$put =string(l)
+:unlet l
 :" :lockvar/islocked() triggering script autoloading
 :set rtp+=./sautest
 :lockvar g:footest#x
diff -r 18fd959b07ef src/testdir/test55.ok
--- a/src/testdir/test55.ok     Wed Aug 13 22:05:54 2014 +0200
+++ b/src/testdir/test55.ok     Sun Aug 17 21:44:48 2014 +0400
@@ -86,6 +86,11 @@ 0011-011
 FFpFFpp
 0000-000
 ppppppp
+[1, 2, 3, 4]
+[1, 2, 3, 4]
+[1, 3, 4]
+[1, 3, 4]
+[1, 0, 4]
 locked g:footest#x:-1
 exists g:footest#x:0
 g:footest#x: 1

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui