1
0
forked from aniani/vim

patch 8.2.1683: Vim9: assignment test fails

Problem:    Vim9: assignment test fails.
Solution:   Include changes to find Ex command.
This commit is contained in:
Bram Moolenaar
2020-09-14 18:35:18 +02:00
parent dbeecb2b6b
commit 2b22b113c6
2 changed files with 23 additions and 7 deletions

View File

@@ -3224,19 +3224,33 @@ find_ex_command(
// "g:varname" is an expression.
|| eap->cmd[1] == ':'
)
: (
// "varname[]" is an expression.
*p == '['
// "varname->func()" is an expression.
|| (*p == '-' && p[1] == '>')
// "varname.expr" is an expression.
|| (*p == '.' && ASCII_ISALPHA(p[1]))
)))
: (*p == '-' && p[1] == '>')))
{
eap->cmdidx = CMD_eval;
return eap->cmd;
}
if (p != eap->cmd && (
// "varname[]" is an expression.
*p == '['
// "varname.key" is an expression.
|| (*p == '.' && ASCII_ISALPHA(p[1]))))
{
char_u *after = p;
// When followed by "=" or "+=" then it is an assignment.
++emsg_silent;
if (skip_expr(&after) == OK
&& (*after == '='
|| (*after != NUL && after[1] == '=')))
eap->cmdidx = CMD_let;
else
eap->cmdidx = CMD_eval;
--emsg_silent;
return eap->cmd;
}
// "[...]->Method()" is a list expression, but "[a, b] = Func()" is
// an assignment.
// If there is no line break inside the "[...]" then "p" is