• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisão36e8e046c33594196e5a0fae806e6bf699462b7a (tree)
Hora2020-09-17 05:30:03
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Mensagem de Log

patch 8.2.1700: Vim9: try/catch causes wrong value to be returned

Commit: https://github.com/vim/vim/commit/9939f57b7f1c17a0142ebfe4f9e0b634158593e1
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 16 22:29:52 2020 +0200

patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Problem: Vim9: try/catch causes wrong value to be returned.
Solution: Reset tcd_return. (closes https://github.com/vim/vim/issues/6964)

Mudança Sumário

Diff

diff -r 3014f6ccad32 -r 36e8e046c335 src/testdir/test_vim9_script.vim
--- a/src/testdir/test_vim9_script.vim Wed Sep 16 21:45:04 2020 +0200
+++ b/src/testdir/test_vim9_script.vim Wed Sep 16 22:30:03 2020 +0200
@@ -1169,6 +1169,26 @@
11691169 assert_equal('finally', g:in_finally)
11701170 enddef
11711171
1172+def TryOne(): number
1173+ try
1174+ return 0
1175+ catch
1176+ endtry
1177+ return 0
1178+enddef
1179+
1180+def TryTwo(n: number): string
1181+ try
1182+ let x = {}
1183+ catch
1184+ endtry
1185+ return 'text'
1186+enddef
1187+
1188+def Test_try_catch_twice()
1189+ assert_equal('text', TryOne()->TryTwo())
1190+enddef
1191+
11721192 def Test_try_catch_match()
11731193 let seq = 'a'
11741194 try
diff -r 3014f6ccad32 -r 36e8e046c335 src/version.c
--- a/src/version.c Wed Sep 16 21:45:04 2020 +0200
+++ b/src/version.c Wed Sep 16 22:30:03 2020 +0200
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 1700,
755+/**/
754756 1699,
755757 /**/
756758 1698,
diff -r 3014f6ccad32 -r 36e8e046c335 src/vim9execute.c
--- a/src/vim9execute.c Wed Sep 16 21:45:04 2020 +0200
+++ b/src/vim9execute.c Wed Sep 16 22:30:03 2020 +0200
@@ -1922,6 +1922,7 @@
19221922 trycmd->tcd_catch_idx = iptr->isn_arg.try.try_catch;
19231923 trycmd->tcd_finally_idx = iptr->isn_arg.try.try_finally;
19241924 trycmd->tcd_caught = FALSE;
1925+ trycmd->tcd_return = FALSE;
19251926 }
19261927 break;
19271928
Show on old repository browser