mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
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 #6964)
This commit is contained in:
@@ -1169,6 +1169,26 @@ def Test_try_catch_nested()
|
|||||||
assert_equal('finally', g:in_finally)
|
assert_equal('finally', g:in_finally)
|
||||||
enddef
|
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()
|
def Test_try_catch_match()
|
||||||
let seq = 'a'
|
let seq = 'a'
|
||||||
try
|
try
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
1700,
|
||||||
/**/
|
/**/
|
||||||
1699,
|
1699,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -1922,6 +1922,7 @@ call_def_function(
|
|||||||
trycmd->tcd_catch_idx = iptr->isn_arg.try.try_catch;
|
trycmd->tcd_catch_idx = iptr->isn_arg.try.try_catch;
|
||||||
trycmd->tcd_finally_idx = iptr->isn_arg.try.try_finally;
|
trycmd->tcd_finally_idx = iptr->isn_arg.try.try_finally;
|
||||||
trycmd->tcd_caught = FALSE;
|
trycmd->tcd_caught = FALSE;
|
||||||
|
trycmd->tcd_return = FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user