comparison src/ex_docmd.c @ 21618:9ab43576a13b v8.2.1359

patch 8.2.1359: Vim9: cannot assign to / register in Vim9 script Commit: https://github.com/vim/vim/commit/83144546488b544a1fe4e2a4f8be954b98c696fc Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 2 20:40:43 2020 +0200 patch 8.2.1359: Vim9: cannot assign to / register in Vim9 script Problem: Vim9: cannot assign to / register in Vim9 script. Solution: Adjust check for assignment in Vim9 script. (closes https://github.com/vim/vim/issues/6567)
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Aug 2020 20:45:04 +0200
parents c18d00494b60
children 60ba361a7fdb
comparison
equal deleted inserted replaced
21617:74a20165daaf 21618:9ab43576a13b
3272 */ 3272 */
3273 p = eap->cmd; 3273 p = eap->cmd;
3274 if (lookup != NULL) 3274 if (lookup != NULL)
3275 { 3275 {
3276 // Skip over first char for "&opt = val", "$ENV = val" and "@r = val". 3276 // Skip over first char for "&opt = val", "$ENV = val" and "@r = val".
3277 char_u *pskip = (*eap->cmd == '&' || *eap->cmd == '$' 3277 char_u *pskip = (*eap->cmd == '&' || *eap->cmd == '$')
3278 || *eap->cmd == '@') ? eap->cmd + 1 : eap->cmd; 3278 ? eap->cmd + 1 : eap->cmd;
3279 3279
3280 if (vim_strchr((char_u *)"{('[\"", *p) != NULL 3280 if (vim_strchr((char_u *)"{('[\"@", *p) != NULL
3281 || ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL)) 3281 || ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL))
3282 { 3282 {
3283 int oplen; 3283 int oplen;
3284 int heredoc; 3284 int heredoc;
3285 3285
3334 } 3334 }
3335 3335
3336 // Recognize an assignment if we recognize the variable name: 3336 // Recognize an assignment if we recognize the variable name:
3337 // "g:var = expr" 3337 // "g:var = expr"
3338 // "var = expr" where "var" is a local var name. 3338 // "var = expr" where "var" is a local var name.
3339 if (*eap->cmd == '@')
3340 p = eap->cmd + 2;
3339 oplen = assignment_len(skipwhite(p), &heredoc); 3341 oplen = assignment_len(skipwhite(p), &heredoc);
3340 if (oplen > 0) 3342 if (oplen > 0)
3341 { 3343 {
3342 if (((p - eap->cmd) > 2 && eap->cmd[1] == ':') 3344 if (((p - eap->cmd) > 2 && eap->cmd[1] == ':')
3343 || *eap->cmd == '&' 3345 || *eap->cmd == '&'