To: vim_dev@googlegroups.com Subject: Patch 8.2.1700 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1700 Problem: Vim9: try/catch causes wrong value to be returned. Solution: Reset tcd_return. (closes #6964) Files: src/vim9execute.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.1699/src/vim9execute.c 2020-09-16 17:22:54.923689811 +0200 --- src/vim9execute.c 2020-09-16 22:28:55.229262242 +0200 *************** *** 1922,1927 **** --- 1922,1928 ---- trycmd->tcd_catch_idx = iptr->isn_arg.try.try_catch; trycmd->tcd_finally_idx = iptr->isn_arg.try.try_finally; trycmd->tcd_caught = FALSE; + trycmd->tcd_return = FALSE; } break; *** ../vim-8.2.1699/src/testdir/test_vim9_script.vim 2020-09-16 17:55:36.537602345 +0200 --- src/testdir/test_vim9_script.vim 2020-09-16 22:28:19.845378365 +0200 *************** *** 1169,1174 **** --- 1169,1194 ---- assert_equal('finally', g:in_finally) enddef + def TryOne(): number + try + return 0 + catch + endtry + return 0 + enddef + + def TryTwo(n: number): string + try + let x = {} + catch + endtry + return 'text' + enddef + + def Test_try_catch_twice() + assert_equal('text', TryOne()->TryTwo()) + enddef + def Test_try_catch_match() let seq = 'a' try *** ../vim-8.2.1699/src/version.c 2020-09-16 21:41:49.746622621 +0200 --- src/version.c 2020-09-16 22:25:55.913846825 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1700, /**/ -- People who want to share their religious views with you almost never want you to share yours with them. /// 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 ///