Patch 8.2.2330
Problem: Vim9: crash when using :trow in a not executed block.
Solution: Don't generate the instruction when skipping. (closes #7659)
Files: src/vim9compile.c, src/testdir/test_vim9_script.vim
*** ../vim-8.2.2329/src/vim9compile.c 2021-01-10 22:42:46.920847063 +0100
--- src/vim9compile.c 2021-01-11 20:16:46.791539467 +0100
***************
*** 474,481 ****
isn_T *isn;
isntype_T isntype = ISN_2STRING;
garray_T *stack = &cctx->ctx_type_stack;
! type_T **type = ((type_T **)stack->ga_data) + stack->ga_len + offset;
switch ((*type)->tt_type)
{
// nothing to be done
--- 474,483 ----
isn_T *isn;
isntype_T isntype = ISN_2STRING;
garray_T *stack = &cctx->ctx_type_stack;
! type_T **type;
+ RETURN_OK_IF_SKIP(cctx);
+ type = ((type_T **)stack->ga_data) + stack->ga_len + offset;
switch ((*type)->tt_type)
{
// nothing to be done
***************
*** 7461,7466 ****
--- 7463,7470 ----
if (compile_expr0(&p, cctx) == FAIL)
return NULL;
+ if (cctx->ctx_skip == SKIP_YES)
+ return p;
if (may_generate_2STRING(-1, cctx) == FAIL)
return NULL;
if (generate_instr_drop(cctx, ISN_THROW, 1) == NULL)
*** ../vim-8.2.2329/src/testdir/test_vim9_script.vim 2021-01-11
18:46:55.947382209 +0100
--- src/testdir/test_vim9_script.vim 2021-01-11 20:15:29.395817733 +0100
***************
*** 324,330 ****
echo 'none'
endfunc
! def Test_try_catch()
var l = []
try # comment
add(l, '1')
--- 324,330 ----
echo 'none'
endfunc
! def Test_try_catch_throw()
var l = []
try # comment
add(l, '1')
***************
*** 558,563 ****
--- 558,569 ----
assert_equal(411, n)
enddef
+ def Test_throw_skipped()
+ if 0
+ throw dontgethere
+ endif
+ enddef
+
def DeletedFunc(): list<any>
return ['delete me']
enddef
*** ../vim-8.2.2329/src/version.c 2021-01-11 19:54:38.776073318 +0100
--- src/version.c 2021-01-11 20:06:27.810036680 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2330,
/**/
--
hundred-and-one symptoms of being an internet addict:
127. You bring your laptop and cellular phone to church.
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
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/202101111918.10BJI1Ha725736%40masaka.moolenaar.net.