mirror of
https://github.com/vim/vim.git
synced 2025-07-24 10:45:12 -04:00
patch 9.0.1556: Vim9: error for missing "return" after "throw"
Problem: Vim9: error for missing "return" after "throw". Solution: Set had_return flag for "throw". (closes #12262)
This commit is contained in:
parent
b7398fe41c
commit
cf2610c82b
@ -488,6 +488,19 @@ def Test_missing_return()
|
||||
'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
|
||||
|
@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1556,
|
||||
/**/
|
||||
1555,
|
||||
/**/
|
||||
|
@ -3611,6 +3611,7 @@ compile_def_function(
|
||||
break;
|
||||
case CMD_throw:
|
||||
line = compile_throw(p, &cctx);
|
||||
cctx.ctx_had_return = TRUE;
|
||||
break;
|
||||
|
||||
case CMD_eval:
|
||||
|
Loading…
x
Reference in New Issue
Block a user