Patch 8.2.2335

3 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 12, 2021, 12:59:19 PM1/12/21
to vim...@googlegroups.com

Patch 8.2.2335
Problem: Vim9: "silent return" does not restore command modifiers.
Solution: Resture command modifiers before returning. (closes #7649)
Files: src/vim9compile.c, src/testdir/test_vim9_disassemble.vim


*** ../vim-8.2.2334/src/vim9compile.c 2021-01-11 21:20:05.665652009 +0100
--- src/vim9compile.c 2021-01-12 18:55:48.464445005 +0100
***************
*** 2055,2060 ****
--- 2055,2061 ----
{
if (cctx->ctx_has_cmdmod && generate_instr(cctx, ISN_CMDMOD_REV) == NULL)
return FAIL;
+ cctx->ctx_has_cmdmod = FALSE;
return OK;
}

***************
*** 4933,4938 ****
--- 4934,4943 ----
// No argument, return zero.
generate_PUSHNR(cctx, 0);
}
+
+ // Undo any command modifiers.
+ generate_undo_cmdmods(cctx);
+
if (cctx->ctx_skip != SKIP_YES && generate_instr(cctx, ISN_RETURN) == NULL)
return NULL;

*** ../vim-8.2.2334/src/testdir/test_vim9_disassemble.vim 2021-01-10 14:02:24.662205148 +0100
--- src/testdir/test_vim9_disassemble.vim 2021-01-12 18:57:54.435966883 +0100
***************
*** 1842,1845 ****
--- 1842,1860 ----
res)
enddef

+ def s:SilentReturn(): string
+ silent return "done"
+ enddef
+
+ def Test_silent_return()
+ var res = execute('disass s:SilentReturn')
+ assert_match('<SNR>\d*_SilentReturn\_s*' ..
+ 'silent return "done"\_s*' ..
+ '\d CMDMOD silent\_s*' ..
+ '\d PUSHS "done"\_s*' ..
+ '\d CMDMOD_REV\_s*' ..
+ '\d RETURN',
+ res)
+ enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
*** ../vim-8.2.2334/src/version.c 2021-01-12 17:42:20.949763884 +0100
--- src/version.c 2021-01-12 18:52:25.685268498 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2335,
/**/

--
In a world without fences, who needs Gates and Windows?

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages