summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-07 18:12:40 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-07 18:12:40 +0200
commite525bdda3aa29f0ffcb18d8d16903ebafc2b5881 (patch)
tree73a8e54308ce26ef1c046c66e38616a1ed58a00d
parentdae453f3397a26a53301d7327e6ed43e8b392035 (diff)
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skippedv8.2.3312
Problem: Vim9: after "if false" line breaks in expression not skipped. Solution: Do parse the expression. (closes #8723)
-rw-r--r--src/testdir/test_vim9_script.vim8
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c6
3 files changed, 12 insertions, 4 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 2c5e3e7dab..059141a754 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2372,6 +2372,14 @@ def Test_if_const_expr()
if false
burp
endif
+
+ # expression with line breaks skipped
+ if false
+ ('aaa'
+ .. 'bbb'
+ .. 'ccc'
+ )->setline(1)
+ endif
enddef
def Test_if_const_expr_fails()
diff --git a/src/version.c b/src/version.c
index d31a019916..a6e2f1ef0a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3312,
+/**/
3311,
/**/
3310,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 125135adaa..5effa5c719 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -9730,14 +9730,12 @@ compile_def_function(
if (p == ea.cmd && ea.cmdidx != CMD_SIZE)
{
- if (cctx.ctx_skip == SKIP_YES)
+ if (cctx.ctx_skip == SKIP_YES && ea.cmdidx != CMD_eval)
{
line += STRLEN(line);
goto nextline;
}
-
- // Expression or function call.
- if (ea.cmdidx != CMD_eval)
+ else if (ea.cmdidx != CMD_eval)
{
// CMD_var cannot happen, compile_assignment() above would be
// used. Most likely an assignment to a non-existing variable.