mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.2855: white space after "->" does not give E274
Problem: White space after "->" does not give E274. Solution: Do not skip white space in legacy script. (closes #8212)
This commit is contained in:
10
src/eval.c
10
src/eval.c
@@ -5916,10 +5916,18 @@ handle_subscript(
|
||||
}
|
||||
else if (p[0] == '-' && p[1] == '>')
|
||||
{
|
||||
if (in_vim9script())
|
||||
*arg = skipwhite(p + 2);
|
||||
else
|
||||
*arg = p + 2;
|
||||
if (ret == OK)
|
||||
{
|
||||
if ((**arg == '{' && !in_vim9script()) || **arg == '(')
|
||||
if (VIM_ISWHITE(**arg))
|
||||
{
|
||||
emsg(_(e_nowhitespace));
|
||||
ret = FAIL;
|
||||
}
|
||||
else if ((**arg == '{' && !in_vim9script()) || **arg == '(')
|
||||
// expr->{lambda}() or expr->(lambda)()
|
||||
ret = eval_lambda(arg, rettv, evalarg, verbose);
|
||||
else
|
||||
|
@@ -136,6 +136,7 @@ func Test_method_syntax()
|
||||
call assert_fails('eval [1, 2, 3]->sort ()', 'E274:')
|
||||
call assert_fails('eval [1, 2, 3] ->sort ()', 'E274:')
|
||||
call assert_fails('eval [1, 2, 3]-> sort ()', 'E274:')
|
||||
call assert_fails('eval [1, 2, 3]-> sort()', 'E274:')
|
||||
endfunc
|
||||
|
||||
func Test_method_lambda()
|
||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2855,
|
||||
/**/
|
||||
2854,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user