To: vim_dev@googlegroups.com Subject: Patch 8.2.2330 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 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 -- Bram@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 ///