diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-06 20:28:13 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-06 20:28:13 +0000 |
commit | 8cbf2499179db39a46e700ab04d0b36e22bcc1bb (patch) | |
tree | 2ce9615ef9c17d198536190fdccf6f52dae5131f | |
parent | 5f4ef5f5e5529c147c2274cd0f6416e2546d6fc7 (diff) | |
download | vim-git-8cbf2499179db39a46e700ab04d0b36e22bcc1bb.tar.gz |
patch 8.2.4314: test fails where lines are skippedv8.2.4314
Problem: Test fails where lines are skipped.
Solution: Only give an error when not skipping commands.
-rw-r--r-- | src/testdir/test_vim9_script.vim | 5 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9compile.c | 9 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index 4fa71d94d..37459a76b 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1228,6 +1228,11 @@ def Test_vim9script_fails() assert_fails('vim9script', 'E1038:') v9.CheckDefFailure(['vim9script'], 'E1038:') + + # no error when skipping + if has('nothing') + vim9script + endif enddef def Test_script_var_shadows_function() diff --git a/src/version.c b/src/version.c index 7dbefa49f..a071c5f67 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 */ /**/ + 4314, +/**/ 4313, /**/ 4312, diff --git a/src/vim9compile.c b/src/vim9compile.c index 0bf47e24d..d0479a5fb 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3139,8 +3139,13 @@ compile_def_function( break; case CMD_vim9script: - emsg(_(e_vim9script_can_only_be_used_in_script)); - goto erret; + if (cctx.ctx_skip != SKIP_YES) + { + emsg(_(e_vim9script_can_only_be_used_in_script)); + goto erret; + } + line = (char_u *)""; + break; case CMD_global: if (check_global_and_subst(ea.cmd, p) == FAIL) |