0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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.
This commit is contained in:
Bram Moolenaar
2020-06-26 22:00:38 +02:00
parent be7ee48876
commit e6536aa766
3 changed files with 44 additions and 1 deletions

View File

@@ -2191,6 +2191,7 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
{
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, evalarg_T *evalarg)
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, evalarg_T *evalarg)
*/
if (type != EXPR_UNKNOWN)
{
if (getnext)
*arg = eval_next_line(evalarg);
// extra question mark appended: ignore case
if (p[len] == '?')
{

View File

@@ -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)

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1064,
/**/
1063,
/**/