Skip to content

Commit 2b22b11

Browse files
committed
patch 8.2.1683: Vim9: assignment test fails
Problem: Vim9: assignment test fails. Solution: Include changes to find Ex command.
1 parent dbeecb2 commit 2b22b11

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

src/ex_docmd.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3224,19 +3224,33 @@ find_ex_command(
32243224
// "g:varname" is an expression.
32253225
|| eap->cmd[1] == ':'
32263226
)
3227-
: (
3228-
// "varname[]" is an expression.
3229-
*p == '['
32303227
// "varname->func()" is an expression.
3231-
|| (*p == '-' && p[1] == '>')
3232-
// "varname.expr" is an expression.
3233-
|| (*p == '.' && ASCII_ISALPHA(p[1]))
3234-
)))
3228+
: (*p == '-' && p[1] == '>')))
32353229
{
32363230
eap->cmdidx = CMD_eval;
32373231
return eap->cmd;
32383232
}
32393233

3234+
if (p != eap->cmd && (
3235+
// "varname[]" is an expression.
3236+
*p == '['
3237+
// "varname.key" is an expression.
3238+
|| (*p == '.' && ASCII_ISALPHA(p[1]))))
3239+
{
3240+
char_u *after = p;
3241+
3242+
// When followed by "=" or "+=" then it is an assignment.
3243+
++emsg_silent;
3244+
if (skip_expr(&after) == OK
3245+
&& (*after == '='
3246+
|| (*after != NUL && after[1] == '=')))
3247+
eap->cmdidx = CMD_let;
3248+
else
3249+
eap->cmdidx = CMD_eval;
3250+
--emsg_silent;
3251+
return eap->cmd;
3252+
}
3253+
32403254
// "[...]->Method()" is a list expression, but "[a, b] = Func()" is
32413255
// an assignment.
32423256
// If there is no line break inside the "[...]" then "p" is

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1683,
753755
/**/
754756
1682,
755757
/**/

0 commit comments

Comments
 (0)