patch 8.2.2525: Vim9: only local variables checked for a name
Problem: Vim9: only local variables checked for a name.
Solution: Also check arguments and script variables. (closes #7838)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index f4bdf7b..77a7a71 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3307,7 +3307,7 @@
find_ex_command(
exarg_T *eap,
int *full UNUSED,
- int (*lookup)(char_u *, size_t, void *, cctx_T *) UNUSED,
+ int (*lookup)(char_u *, size_t, cctx_T *) UNUSED,
cctx_T *cctx UNUSED)
{
int len;
@@ -3416,7 +3416,7 @@
// Recognize an assignment if we recognize the variable name:
// "g:var = expr"
- // "var = expr" where "var" is a local var name.
+ // "var = expr" where "var" is a variable name.
if (*eap->cmd == '@')
p = eap->cmd + 2;
oplen = assignment_len(skipwhite(p), &heredoc);
@@ -3426,7 +3426,7 @@
|| *eap->cmd == '&'
|| *eap->cmd == '$'
|| *eap->cmd == '@'
- || lookup(eap->cmd, p - eap->cmd, NULL, cctx) == OK)
+ || lookup(eap->cmd, p - eap->cmd, cctx) == OK)
{
eap->cmdidx = CMD_var;
return eap->cmd;
@@ -3445,7 +3445,7 @@
// If it is an ID it might be a variable with an operator on the next
// line, if the variable exists it can't be an Ex command.
if (p > eap->cmd && ends_excmd(*skipwhite(p))
- && (lookup(eap->cmd, p - eap->cmd, NULL, cctx) == OK
+ && (lookup(eap->cmd, p - eap->cmd, cctx) == OK
|| (ASCII_ISALPHA(eap->cmd[0]) && eap->cmd[1] == ':')))
{
eap->cmdidx = CMD_eval;