Patch 9.0.1556
Problem: Vim9: error for missing "return" after "throw".
Solution: Set had_return flag for "throw". (closes #12262)
Files: src/vim9compile.c, src/testdir/test_vim9_func.vim
*** ../vim-9.0.1555/src/vim9compile.c 2023-05-07 21:59:28.540096431 +0100
--- src/vim9compile.c 2023-05-14 19:59:19.305527672 +0100
***************
*** 3611,3616 ****
--- 3611,3617 ----
break;
case CMD_throw:
line = compile_throw(p, &cctx);
+ cctx.ctx_had_return = TRUE;
break;
case CMD_eval:
*** ../vim-9.0.1555/src/testdir/test_vim9_func.vim 2023-04-01
22:05:35.155519002 +0100
--- src/testdir/test_vim9_func.vim 2023-05-14 19:59:01.149580383 +0100
***************
*** 488,493 ****
--- 488,506 ----
'enddef'], 'E1095:')
enddef
+ def Test_not_missing_return()
+ var lines =<< trim END
+ def Funky(): number
+ if false
+ return 0
+ endif
+ throw 'Error'
+ enddef
+ defcompile
+ END
+ v9.CheckScriptSuccess(lines)
+ enddef
+
def Test_return_bool()
var lines =<< trim END
vim9script
*** ../vim-9.0.1555/src/version.c 2023-05-14 17:39:15.518564072 +0100
--- src/version.c 2023-05-14 19:55:05.678334170 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1556,
/**/
--
Q. What happens to programmers when they die?
A: MS-Windows programmers are reinstalled. C++ programmers become undefined,
anyone who refers to them will die as well. Java programmers reincarnate
after being garbage collected, unless they are in permgen, in which case
they become zombies. Zimbu programmers leave a stack trace that tells us
exactly where they died and how they got there.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/20230514190036.18D321C1B21%40moolenaar.net.