mirror of
https://github.com/vim/vim.git
synced 2025-11-09 10:37:17 -05:00
patch 9.0.1501: crash with nested :try and :throw in catch block
Problem: Crash with nested :try and :throw in catch block. Solution: Jump to :endtry before returning from function. (closes #12245)
This commit is contained in:
@@ -812,6 +812,41 @@ def Test_try_catch_throw()
|
||||
v9.CheckDefAndScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_throw_in_nested_try()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
|
||||
def Try(F: func(): void)
|
||||
try
|
||||
F()
|
||||
catch
|
||||
endtry
|
||||
enddef
|
||||
|
||||
class X
|
||||
def F()
|
||||
try
|
||||
throw 'Foobar'
|
||||
catch
|
||||
throw v:exception
|
||||
endtry
|
||||
enddef
|
||||
endclass
|
||||
|
||||
def Test_TryMethod()
|
||||
var x = X.new()
|
||||
Try(() => x.F())
|
||||
enddef
|
||||
|
||||
|
||||
try
|
||||
Test_TryMethod()
|
||||
catch
|
||||
endtry
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_try_var_decl()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
|
||||
Reference in New Issue
Block a user