forked from aniani/vim
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)
This commit is contained in:
@@ -3307,7 +3307,7 @@ skip_option_env_lead(char_u *start)
|
||||
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 @@ find_ex_command(
|
||||
|
||||
// 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 @@ find_ex_command(
|
||||
|| *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 @@ find_ex_command(
|
||||
// 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;
|
||||
|
Reference in New Issue
Block a user