mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.2357: Vim9: crash when parsing function return type fails
Problem: Vim9: crash when parsing function return type fails. Solution: Bail out and set return type to "unknown". (closes #7685)
This commit is contained in:
@@ -197,6 +197,17 @@ def Test_return_nothing()
|
|||||||
s:nothing->assert_equal(1)
|
s:nothing->assert_equal(1)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_return_invalid()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def Func(): invalid
|
||||||
|
return xxx
|
||||||
|
enddef
|
||||||
|
defcompile
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1010:', 2)
|
||||||
|
enddef
|
||||||
|
|
||||||
func Increment()
|
func Increment()
|
||||||
let g:counter += 1
|
let g:counter += 1
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -3886,6 +3886,12 @@ define_function(exarg_T *eap, char_u *name_arg)
|
|||||||
{
|
{
|
||||||
p = ret_type;
|
p = ret_type;
|
||||||
fp->uf_ret_type = parse_type(&p, &fp->uf_type_list, TRUE);
|
fp->uf_ret_type = parse_type(&p, &fp->uf_type_list, TRUE);
|
||||||
|
if (fp->uf_ret_type == NULL)
|
||||||
|
{
|
||||||
|
fp->uf_ret_type = &t_void;
|
||||||
|
SOURCING_LNUM = lnum_save;
|
||||||
|
goto erret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SOURCING_LNUM = lnum_save;
|
SOURCING_LNUM = lnum_save;
|
||||||
}
|
}
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2357,
|
||||||
/**/
|
/**/
|
||||||
2356,
|
2356,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user