summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-05 11:37:48 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-05 11:37:48 +0000
commite1d1211799bc37c063666e97437cf4e9af4782b0 (patch)
tree1a43103320c16459551d6ab64c4d02afd1947452 /src/vim9compile.c
parent330a388e18ad6b64c3574c712db675258b0e9878 (diff)
downloadvim-git-e1d1211799bc37c063666e97437cf4e9af4782b0.tar.gz
patch 8.2.4509: Vim9: can declare a variable with ":va"v8.2.4509
Problem: Vim9: can declare a variable with ":va". Solution: Disallow using ":va", require using ":var".
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 898712396..52c60fb9c 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1883,7 +1883,14 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
lhs_T lhs;
long start_lnum = SOURCING_LNUM;
- // Skip over the "var" or "[var, var]" to get to any "=".
+ p = eap->cmd;
+ if (eap->cmdidx == CMD_var && arg > p && !checkforcmd_noparen(&p, "var", 3))
+ {
+ emsg(_(e_must_use_var_instead_of_va));
+ return NULL;
+ }
+
+ // Skip over the "varname" or "[varname, varname]" to get to any "=".
p = skip_var_list(arg, TRUE, &var_count, &semicolon, TRUE);
if (p == NULL)
return *arg == '[' ? arg : NULL;