Mercurial > vim
changeset 22268:2eaee3396f7a v8.2.1683
patch 8.2.1683: Vim9: assignment test fails
Commit: https://github.com/vim/vim/commit/2b22b113c6aedf2a1295cf7e6f2f2a5d463b3868
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 14 18:35:18 2020 +0200
patch 8.2.1683: Vim9: assignment test fails
Problem: Vim9: assignment test fails.
Solution: Include changes to find Ex command.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 14 Sep 2020 18:45:03 +0200 |
parents | 65a5797b155f |
children | 314411e1091e |
files | src/ex_docmd.c src/version.c |
diffstat | 2 files changed, 23 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -3224,16 +3224,30 @@ find_ex_command( // "g:varname" is an expression. || eap->cmd[1] == ':' ) - : ( + // "varname->func()" is an expression. + : (*p == '-' && p[1] == '>'))) + { + eap->cmdidx = CMD_eval; + return eap->cmd; + } + + if (p != eap->cmd && ( // "varname[]" is an expression. *p == '[' - // "varname->func()" is an expression. - || (*p == '-' && p[1] == '>') - // "varname.expr" is an expression. - || (*p == '.' && ASCII_ISALPHA(p[1])) - ))) + // "varname.key" is an expression. + || (*p == '.' && ASCII_ISALPHA(p[1])))) { - eap->cmdidx = CMD_eval; + 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; }