comparison src/ex_docmd.c @ 25670:812c75fd255c v8.2.3371

patch 8.2.3371: Vim9: :$ENV cannot be followed by ->func() in next line Commit: https://github.com/vim/vim/commit/5ca5cc6412d7d68fd380926f9551a8b7ba335199 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 24 21:56:03 2021 +0200 patch 8.2.3371: Vim9: :$ENV cannot be followed by ->func() in next line Problem: Vim9: :$ENV cannot be followed by ->func() in next line. Solution: Use "$ENV" as the start of an expression. (closes https://github.com/vim/vim/issues/8790)
author Bram Moolenaar <Bram@vim.org>
date Tue, 24 Aug 2021 22:00:06 +0200
parents 23f065f27d2e
children 8c4dee4d1ac6
comparison
equal deleted inserted replaced
25669:87f9053e504c 25670:812c75fd255c
3423 p = eap->cmd; 3423 p = eap->cmd;
3424 if (lookup != NULL) 3424 if (lookup != NULL)
3425 { 3425 {
3426 char_u *pskip = skip_option_env_lead(eap->cmd); 3426 char_u *pskip = skip_option_env_lead(eap->cmd);
3427 3427
3428 if (vim_strchr((char_u *)"{('[\"@&", *p) != NULL 3428 if (vim_strchr((char_u *)"{('[\"@&$", *p) != NULL
3429 || ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL)) 3429 || ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL))
3430 { 3430 {
3431 int oplen; 3431 int oplen;
3432 int heredoc; 3432 int heredoc;
3433 char_u *swp; 3433 char_u *swp;
3434 3434
3435 if (*eap->cmd == '&' || (eap->cmd[0] == '@' 3435 if (*eap->cmd == '&'
3436 || *eap->cmd == '$'
3437 || (eap->cmd[0] == '@'
3436 && (valid_yank_reg(eap->cmd[1], FALSE) 3438 && (valid_yank_reg(eap->cmd[1], FALSE)
3437 || eap->cmd[1] == '@'))) 3439 || eap->cmd[1] == '@')))
3438 { 3440 {
3439 if (*eap->cmd == '&') 3441 if (*eap->cmd == '&')
3440 { 3442 {
3441 p = eap->cmd + 1; 3443 p = eap->cmd + 1;
3442 if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0) 3444 if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
3443 p += 2; 3445 p += 2;
3444 p = to_name_end(p, FALSE); 3446 p = to_name_end(p, FALSE);
3445 } 3447 }
3448 else if (*eap->cmd == '$')
3449 p = to_name_end(eap->cmd + 1, FALSE);
3446 else 3450 else
3447 p = eap->cmd + 2; 3451 p = eap->cmd + 2;
3448 if (ends_excmd(*skipwhite(p))) 3452 if (ends_excmd(*skipwhite(p)))
3449 { 3453 {
3450 // "&option <NL>" and "@r <NL>" is the start of an 3454 // "&option <NL>", "$ENV <NL>" and "@r <NL>" are the start
3451 // expression. 3455 // of an expression.
3452 eap->cmdidx = CMD_eval; 3456 eap->cmdidx = CMD_eval;
3453 return eap->cmd; 3457 return eap->cmd;
3454 } 3458 }
3455 // "&option" can be followed by "->" or "=", check below 3459 // "&option" can be followed by "->" or "=", check below
3456 } 3460 }