1
0
forked from aniani/vim

patch 8.2.1916: Vim9: function call is aborted even when "silent!" is used

Problem:    Vim9: function call is aborted even when "silent!" is used.
Solution:   Use did_emsg instead of called_emsg. (closes #7213)
This commit is contained in:
Bram Moolenaar
2020-10-28 16:54:47 +01:00
parent 6cf7e3b026
commit 171fb923b8
3 changed files with 36 additions and 3 deletions

View File

@@ -1462,6 +1462,35 @@ func Test_silent_echo()
call delete('XTest_silent_echo')
endfunc
def SilentlyError()
execute('silent! invalid')
g:did_it = 'yes'
enddef
"func UserError()
" silent! invalid
"endfunc
"
"def SilentlyUserError()
" UserError()
" g:did_it = 'yes'
"enddef
" This can't be a :def function, because the assert would not be reached.
" And this must not be inside a try/endtry.
func Test_ignore_silent_error()
let g:did_it = 'no'
call SilentlyError()
call assert_equal('yes', g:did_it)
" this doesn't work yet
" let g:did_it = 'no'
" call SilentlyUserError()
" call assert_equal('yes', g:did_it)
unlet g:did_it
endfunc
def Fibonacci(n: number): number
if n < 2
return n