diff options
-rw-r--r-- | src/testdir/test_vim9_script.vim | 17 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9script.c | 6 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index 0b99eec5d..e85da5a80 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1705,6 +1705,23 @@ def Test_vim9_comment_not_compiled() ], 'E488:') enddef +def Test_finish() + let lines =<< trim END + vim9script + let g:res = 'one' + if v:false | finish | endif + let g:res = 'two' + finish + let g:res = 'three' + END + writefile(lines, 'Xfinished') + source Xfinished + assert_equal('two', g:res) + + unlet g:res + delete('Xfinished') +enddef + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new diff --git a/src/version.c b/src/version.c index d89763bfc..efb3c3187 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 731, +/**/ 730, /**/ 729, diff --git a/src/vim9script.c b/src/vim9script.c index 8bc1962bf..4d7e8ee46 100644 --- a/src/vim9script.c +++ b/src/vim9script.c @@ -130,6 +130,12 @@ ex_vim9script(exarg_T *eap) vim_free(((char_u **)(gap->ga_data))[--gap->ga_len]); ((char_u **)(gap->ga_data))[gap->ga_len++] = NULL; } + else if (checkforcmd(&p, "finish", 4)) + { + // TODO: this should not happen below "if false". + // Use "if cond | finish | endif as a workaround. + break; + } } // Compile the :def functions. |