Mercurial > vim
comparison src/ex_docmd.c @ 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 | d7c1e3efa88e |
children | 00f2eebe74d9 |
comparison
equal
deleted
inserted
replaced
22267:65a5797b155f | 22268:2eaee3396f7a |
---|---|
3222 // '"string"->func()' is an expression. | 3222 // '"string"->func()' is an expression. |
3223 || *eap->cmd == '"' | 3223 || *eap->cmd == '"' |
3224 // "g:varname" is an expression. | 3224 // "g:varname" is an expression. |
3225 || eap->cmd[1] == ':' | 3225 || eap->cmd[1] == ':' |
3226 ) | 3226 ) |
3227 : ( | 3227 // "varname->func()" is an expression. |
3228 : (*p == '-' && p[1] == '>'))) | |
3229 { | |
3230 eap->cmdidx = CMD_eval; | |
3231 return eap->cmd; | |
3232 } | |
3233 | |
3234 if (p != eap->cmd && ( | |
3228 // "varname[]" is an expression. | 3235 // "varname[]" is an expression. |
3229 *p == '[' | 3236 *p == '[' |
3230 // "varname->func()" is an expression. | 3237 // "varname.key" is an expression. |
3231 || (*p == '-' && p[1] == '>') | 3238 || (*p == '.' && ASCII_ISALPHA(p[1])))) |
3232 // "varname.expr" is an expression. | |
3233 || (*p == '.' && ASCII_ISALPHA(p[1])) | |
3234 ))) | |
3235 { | 3239 { |
3236 eap->cmdidx = CMD_eval; | 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; | |
3237 return eap->cmd; | 3251 return eap->cmd; |
3238 } | 3252 } |
3239 | 3253 |
3240 // "[...]->Method()" is a list expression, but "[a, b] = Func()" is | 3254 // "[...]->Method()" is a list expression, but "[a, b] = Func()" is |
3241 // an assignment. | 3255 // an assignment. |