]> granicus.if.org Git - vim/commitdiff
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped v8.2.3312
authorBram Moolenaar <Bram@vim.org>
Sat, 7 Aug 2021 16:12:40 +0000 (18:12 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 7 Aug 2021 16:12:40 +0000 (18:12 +0200)
Problem:    Vim9: after "if false" line breaks in expression not skipped.
Solution:   Do parse the expression. (closes #8723)

src/testdir/test_vim9_script.vim
src/version.c
src/vim9compile.c

index 2c5e3e7dab0217554ffd49fe1f518233986802f7..059141a7547af601a7b5da5e8d2732511455976c 100644 (file)
@@ -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()
index d31a0199163f68f955deac16b5d815a3ca866b15..a6e2f1ef0a7415fd5309828f3986f82c37e19347 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3312,
 /**/
     3311,
 /**/
index 125135adaae5ac9fec95307d0c25a4c92952d2b5..5effa5c719de79319946d085937e4f376a974103 100644 (file)
@@ -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.