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)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 83f49d0..db7bb93 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3483,7 +3483,8 @@
// 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 @@
|| *eap->cmd == '&'
|| *eap->cmd == '$'
|| *eap->cmd == '@'
+ || eap->skip
|| lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK)
{
eap->cmdidx = CMD_var;