Patch 8.2.0280

9 views
Skip to first unread message

Bram Moolenaar

unread,
Feb 19, 2020, 11:06:52 AM2/19/20
to vim...@googlegroups.com

Patch 8.2.0280
Problem: Vim9: throw in :def function not caught higher up.
Solution: Set "need_rethrow".
Files: src/vim9execute.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.0279/src/vim9execute.c 2020-02-16 15:03:44.193305731 +0100
--- src/vim9execute.c 2020-02-19 16:26:01.145998771 +0100
***************
*** 482,487 ****
--- 482,488 ----
tv->v_type = VAR_NUMBER;
tv->vval.v_number = 0;
++ectx.ec_stack.ga_len;
+ need_rethrow = TRUE;
goto done;
}

*** ../vim-8.2.0279/src/testdir/test_vim9_script.vim 2020-02-19 15:46:45.269950987 +0100
--- src/testdir/test_vim9_script.vim 2020-02-19 16:35:28.839605442 +0100
***************
*** 206,211 ****
--- 206,239 ----
assert_equal(['1', 'wrong', '3'], l)
enddef

+ def ThrowFromDef()
+ throw 'getout'
+ enddef
+
+ func CatchInFunc()
+ try
+ call ThrowFromDef()
+ catch
+ let g:thrown_func = v:exception
+ endtry
+ endfunc
+
+ def CatchInDef()
+ try
+ ThrowFromDef()
+ catch
+ g:thrown_def = v:exception
+ endtry
+ enddef
+
+ def Test_try_catch_nested()
+ CatchInFunc()
+ assert_equal('getout', g:thrown_func)
+
+ CatchInDef()
+ assert_equal('getout', g:thrown_def)
+ enddef
+
let s:export_script_lines =<< trim END
vim9script
let name: string = 'bob'
*** ../vim-8.2.0279/src/version.c 2020-02-19 15:46:45.269950987 +0100
--- src/version.c 2020-02-19 16:33:00.712207458 +0100
***************
*** 740,741 ****
--- 740,743 ----
{ /* Add new patch number below this line */
+ /**/
+ 280,
/**/

--
From "know your smileys":
%-) After staring at screen for 15 hours

/// 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