0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2771: Vim9: assignment not recognized if declaration was skipped

Problem:    Vim9: assignment not recognized if declaration was skipped.
Solution:   Also recognized an assignment if the variable does not exist.
            (closes #8108)
This commit is contained in:
Bram Moolenaar
2021-04-15 22:13:39 +02:00
parent fe090eb58f
commit aa1959bd5e
3 changed files with 17 additions and 1 deletions

View File

@@ -3483,7 +3483,8 @@ find_ex_command(
// Recognize an assignment if we recognize the variable name:
// "g:var = expr"
// "var = expr" where "var" is a variable name.
// "var = expr" where "var" is a variable name or we are skipping
// (variable declaration might have been skipped).
if (*eap->cmd == '@')
p = eap->cmd + 2;
oplen = assignment_len(skipwhite(p), &heredoc);
@@ -3493,6 +3494,7 @@ find_ex_command(
|| *eap->cmd == '&'
|| *eap->cmd == '$'
|| *eap->cmd == '@'
|| eap->skip
|| lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK)
{
eap->cmdidx = CMD_var;