0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 8.2.2602: Vim9: continue doesn't work if :while is very first command

Problem:    Vim9: continue doesn't work if :while is very first command.
            (Yegappan Lakshmanan)
Solution:   Add one to the continue instruction index.
This commit is contained in:
Bram Moolenaar
2021-03-14 12:13:33 +01:00
parent 6bce5856b5
commit 2e34c34be1
3 changed files with 32 additions and 3 deletions

View File

@@ -592,6 +592,31 @@ def Test_try_catch_throw()
assert_equal(4, ReturnInFinally())
enddef
" :while at the very start of a function that :continue jumps to
def TryContinueFunc()
while g:Count < 2
g:sequence ..= 't'
try
echoerr 'Test'
catch
g:Count += 1
g:sequence ..= 'c'
continue
endtry
g:sequence ..= 'e'
g:Count += 1
endwhile
enddef
def Test_continue_in_try_in_while()
g:Count = 0
g:sequence = ''
TryContinueFunc()
assert_equal('tctc', g:sequence)
unlet g:Count
unlet g:sequence
enddef
def Test_nocatch_return_in_try()
# return in try block returns normally
def ReturnInTry(): string