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 -- [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/202009162030.08GKUaAR2247296%40masaka.moolenaar.net.

Raspunde prin e-mail lui