changeset 21026:fe2ed85db946 v8.2.1064

patch 8.2.1064: Vim9: no line break allowed before comperators Commit: https://github.com/vim/vim/commit/e6536aa766e95b6c64489678eb029e6909ee6a35 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jun 26 22:00:38 2020 +0200 patch 8.2.1064: Vim9: no line break allowed before comperators Problem: Vim9: no line break allowed before comperators. Solution: Check for comperator after line break.
author Bram Moolenaar <Bram@vim.org>
date Fri, 26 Jun 2020 22:15:03 +0200
parents 8463e5662d5b
children f7d632ae239d
files src/eval.c src/testdir/test_vim9_expr.vim src/version.c
diffstat 3 files changed, 44 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -2191,6 +2191,7 @@ eval4(char_u **arg, typval_T *rettv, eva
 {
     typval_T	var2;
     char_u	*p;
+    int		getnext;
     int		i;
     exptype_T	type = EXPR_UNKNOWN;
     int		len = 2;
@@ -2202,7 +2203,7 @@ eval4(char_u **arg, typval_T *rettv, eva
     if (eval5(arg, rettv, evalarg) == FAIL)
 	return FAIL;
 
-    p = *arg;
+    p = eval_next_non_blank(*arg, evalarg, &getnext);
     switch (p[0])
     {
 	case '=':   if (p[1] == '=')
@@ -2247,6 +2248,9 @@ eval4(char_u **arg, typval_T *rettv, eva
      */
     if (type != EXPR_UNKNOWN)
     {
+	if (getnext)
+	    *arg = eval_next_line(evalarg);
+
 	// extra question mark appended: ignore case
 	if (p[len] == '?')
 	{
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -529,6 +529,43 @@ def RetVoid()
   let x = 1
 enddef
 
+def Test_expr4_vimscript()
+  " only checks line continuation
+  let lines =<< trim END
+      vim9script
+      let var = 0
+      		< 1
+      assert_equal(1, var)
+  END
+  CheckScriptSuccess(lines)
+
+  lines =<< trim END
+      vim9script
+      let var = 123
+      		!= 123
+      assert_equal(0, var)
+  END
+  CheckScriptSuccess(lines)
+
+  lines =<< trim END
+      vim9script
+      let list = [1, 2, 3]
+      let var = list
+      		is list
+      assert_equal(1, var)
+  END
+  CheckScriptSuccess(lines)
+
+  lines =<< trim END
+      vim9script
+      let myblob = 0z1234
+      let var = myblob
+      		isnot 0z11
+      assert_equal(1, var)
+  END
+  CheckScriptSuccess(lines)
+enddef
+
 func Test_expr4_fails()
   let msg = "white space required before and after '>'"
   call CheckDefFailure(["let x = 1>2"], msg)
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1064,
+/**/
     1063,
 /**/
     1062,