changeset 25551:5ab75ca75d21 v8.2.3312

patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped Commit: https://github.com/vim/vim/commit/e525bdda3aa29f0ffcb18d8d16903ebafc2b5881 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 7 18:12:40 2021 +0200 patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped Problem: Vim9: after "if false" line breaks in expression not skipped. Solution: Do parse the expression. (closes https://github.com/vim/vim/issues/8723)
author Bram Moolenaar <Bram@vim.org>
date Sat, 07 Aug 2021 18:15:03 +0200
parents 6934c5328627
children 4ecef4a5ea54
files src/testdir/test_vim9_script.vim src/version.c src/vim9compile.c
diffstat 3 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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()
--- 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,
--- 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.