Mercurial > vim
diff src/testdir/test_vim9_script.vim @ 33959:07d5c4814c45 v9.0.2172
patch 9.0.2172: Vim9: compiling :defer may fail
Commit: https://github.com/vim/vim/commit/a185a31fc05c2dd15315cd59afc02b69aabb5893
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Dec 16 14:36:08 2023 +0100
patch 9.0.2172: Vim9: compiling :defer may fail
Problem: Vim9: compiling :defer may fail
Solution: compile defer, when ctx_skip is not SKIP_YES
compiling defer fails in an if statement with false condition,
so check the ctx_skip value when compiling :defer
fixes: #13698
closes: #13702
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Dec 2023 14:45:03 +0100 |
parents | 9a932ba43f6e |
children | 07ac92709982 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -4783,6 +4783,19 @@ def Test_multidefer_with_exception() v9.CheckSourceSuccess(lines) enddef +" Test for using ":defer" inside an if statement with a false condition +def Test_defer_skipped() + var lines =<< trim END + def Foo() + if false + defer execute('echow "hello"', "") + endif + enddef + defcompile + END + v9.CheckSourceSuccess(lines) +enddef + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new