1
0
forked from aniani/vim

patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly

Problem:    Vim9: "break" inside try/catch not handled correctly.
Solution:   First jump to :endtry. (closes #9927)
This commit is contained in:
Bram Moolenaar
2022-03-10 21:53:44 +00:00
parent e406ff87c8
commit 873f8243f6
4 changed files with 45 additions and 7 deletions

View File

@@ -907,6 +907,28 @@ def Test_continue_in_try_in_while()
unlet g:sequence
enddef
def Test_break_in_try_in_for()
var lines =<< trim END
vim9script
def Ls(): list<string>
var ls: list<string>
for s in ['abc', 'def']
for _ in [123, 456]
try
eval [][0]
catch
break
endtry
endfor
ls += [s]
endfor
return ls
enddef
assert_equal(['abc', 'def'], Ls())
END
v9.CheckScriptSuccess(lines)
enddef
def Test_nocatch_return_in_try()
# return in try block returns normally
def ReturnInTry(): string