Patch 8.2.4836
Problem: Vim9: some lines not covered by tests.
Solution: Remove dead code. Add disassemble tests.
Files: src/vim9execute.c, src/vim9.h,
src/testdir/test_vim9_disassemble.vim
*** ../vim-8.2.4835/src/vim9execute.c 2022-04-27 22:15:35.992839061 +0100
--- src/vim9execute.c 2022-04-28 11:52:14.974115711 +0100
***************
*** 3788,3796 ****
}
else
jump = tv2bool(tv);
! if (when == JUMP_IF_FALSE
! || when == JUMP_AND_KEEP_IF_FALSE
! || when == JUMP_IF_COND_FALSE)
jump = !jump;
if (when == JUMP_IF_FALSE || !jump)
{
--- 3788,3794 ----
}
else
jump = tv2bool(tv);
! if (when == JUMP_IF_FALSE || when == JUMP_IF_COND_FALSE)
jump = !jump;
if (when == JUMP_IF_FALSE || !jump)
{
***************
*** 5662,5677 ****
iptr->isn_arg.number);
break;
case ISN_STOREOUTER:
! {
! if (iptr->isn_arg.number < 0)
! smsg("%s%4d STOREOUTEr level %d arg[%d]", pfx, current,
! iptr->isn_arg.outer.outer_depth,
! iptr->isn_arg.outer.outer_idx + STACK_FRAME_SIZE);
! else
! smsg("%s%4d STOREOUTER level %d $%d", pfx, current,
! iptr->isn_arg.outer.outer_depth,
! iptr->isn_arg.outer.outer_idx);
! }
break;
case ISN_STOREV:
smsg("%s%4d STOREV v:%s", pfx, current,
--- 5660,5668 ----
iptr->isn_arg.number);
break;
case ISN_STOREOUTER:
! smsg("%s%4d STOREOUTER level %d $%d", pfx, current,
! iptr->isn_arg.outer.outer_depth,
! iptr->isn_arg.outer.outer_idx);
break;
case ISN_STOREV:
smsg("%s%4d STOREV v:%s", pfx, current,
***************
*** 5935,5943 ****
case JUMP_IF_FALSE:
when = "JUMP_IF_FALSE";
break;
- case JUMP_AND_KEEP_IF_FALSE:
- when = "JUMP_AND_KEEP_IF_FALSE";
- break;
case JUMP_IF_COND_FALSE:
when = "JUMP_IF_COND_FALSE";
break;
--- 5926,5931 ----
*** ../vim-8.2.4835/src/vim9.h 2022-04-27 17:54:20.147363240 +0100
--- src/vim9.h 2022-04-28 11:52:19.306110826 +0100
***************
*** 239,245 ****
JUMP_NEVER,
JUMP_IF_FALSE, // pop and jump if false
JUMP_AND_KEEP_IF_TRUE, // jump if top of stack is truthy, drop if not
- JUMP_AND_KEEP_IF_FALSE, // jump if top of stack is falsy, drop if not
JUMP_IF_COND_TRUE, // jump if top of stack is true, drop
if not
JUMP_IF_COND_FALSE, // jump if top of stack is false, drop
if not
} jumpwhen_T;
--- 239,244 ----
*** ../vim-8.2.4835/src/testdir/test_vim9_disassemble.vim 2022-04-27
22:15:35.996839058 +0100
--- src/testdir/test_vim9_disassemble.vim 2022-04-28 11:59:48.921521367
+0100
***************
*** 265,270 ****
--- 265,271 ----
def s:PutRange()
:$-2put a
+ :$-3put! b
enddef
def Test_disassemble_put_range()
***************
*** 273,278 ****
--- 274,283 ----
' :$-2put a\_s*' ..
'\d RANGE $-2\_s*' ..
'\d PUT a range\_s*' ..
+
+ ' :$-3put! b\_s*' ..
+ '\d RANGE $-3\_s*' ..
+ '\d PUT b above range\_s*' ..
'\d RETURN void',
res)
enddef
***************
*** 684,689 ****
--- 689,698 ----
unlet g:somevar
unlet! g:somevar
unlet $SOMEVAR
+
+ var l = [1, 2, 3]
+ unlet l[2]
+ unlet l[0 : 1]
enddef
def Test_disassemble_unlet()
***************
*** 697,709 ****
'unlet! g:somevar\_s*' ..
'\d UNLET! g:somevar\_s*' ..
'unlet $SOMEVAR\_s*' ..
! '\d UNLETENV $SOMEVAR\_s*',
res)
enddef
def s:LockLocal()
var d = {a: 1}
lockvar d.a
enddef
def Test_disassemble_lock_local()
--- 706,738 ----
'unlet! g:somevar\_s*' ..
'\d UNLET! g:somevar\_s*' ..
'unlet $SOMEVAR\_s*' ..
! '\d UNLETENV $SOMEVAR\_s*' ..
!
! 'var l = \[1, 2, 3]\_s*' ..
! '\d\+ PUSHNR 1\_s*' ..
! '\d\+ PUSHNR 2\_s*' ..
! '\d\+ PUSHNR 3\_s*' ..
! '\d\+ NEWLIST size 3\_s*' ..
! '\d\+ SETTYPE list<number>\_s*' ..
! '\d\+ STORE $0\_s*' ..
!
! 'unlet l\[2]\_s*' ..
! '\d\+ PUSHNR 2\_s*' ..
! '\d\+ LOAD $0\_s*' ..
! '\d\+ UNLETINDEX\_s*' ..
!
! 'unlet l\[0 : 1]\_s*' ..
! '\d\+ PUSHNR 0\_s*' ..
! '\d\+ PUSHNR 1\_s*' ..
! '\d\+ LOAD $0\_s*' ..
! '\d\+ UNLETRANGE\_s*',
res)
enddef
def s:LockLocal()
var d = {a: 1}
lockvar d.a
+ const nr = 22
enddef
def Test_disassemble_lock_local()
***************
*** 717,723 ****
'\d STORE $0\_s*' ..
'lockvar d.a\_s*' ..
'\d LOAD $0\_s*' ..
! '\d LOCKUNLOCK lockvar 2 d.a\_s*',
res)
enddef
--- 746,757 ----
'\d STORE $0\_s*' ..
'lockvar d.a\_s*' ..
'\d LOAD $0\_s*' ..
! '\d LOCKUNLOCK lockvar 2 d.a\_s*' ..
!
! 'const nr = 22\_s*' ..
! '\d\+ PUSHNR 22\_s*' ..
! '\d\+ LOCKCONST\_s*' ..
! '\d\+ STORE $1',
res)
enddef
***************
*** 2185,2190 ****
--- 2219,2251 ----
'\d\+ RETURN void',
res)
enddef
+
+ def s:StoreRange()
+ var l = [1, 2]
+ l[0 : 1] = [7, 8]
+ enddef
+
+ def Test_disassemble_store_range()
+ var res = execute('disass s:StoreRange')
+ assert_match('\<SNR>\d*_StoreRange\_s*' ..
+ 'var l = \[1, 2]\_s*' ..
+ '\d PUSHNR 1\_s*' ..
+ '\d PUSHNR 2\_s*' ..
+ '\d NEWLIST size 2\_s*' ..
+ '\d SETTYPE list<number>\_s*' ..
+ '\d STORE $0\_s*' ..
+
+ 'l\[0 : 1] = \[7, 8]\_s*' ..
+ '\d\+ PUSHNR 7\_s*' ..
+ '\d\+ PUSHNR 8\_s*' ..
+ '\d\+ NEWLIST size 2\_s*' ..
+ '\d\+ PUSHNR 0\_s*' ..
+ '\d\+ PUSHNR 1\_s*' ..
+ '\d\+ LOAD $0\_s*' ..
+ '\d\+ STORERANGE\_s*' ..
+ '\d\+ RETURN void',
+ res)
+ enddef
def s:Echomsg()
echomsg 'some' 'message'
*** ../vim-8.2.4835/src/version.c 2022-04-27 22:15:35.996839058 +0100
--- src/version.c 2022-04-27 22:44:45.802916882 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4836,
/**/
--
hundred-and-one symptoms of being an internet addict:
81. At social functions you introduce your husband as "my domain server."
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220428110139.53E0A1C05B5%40moolenaar.net.