0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1756: Vim9: :let will soon be disallowed

Problem:    Vim9: :let will soon be disallowed.
Solution:   Add v:disallow_let temporarily.  Fix tests.
This commit is contained in:
Bram Moolenaar
2020-09-27 15:19:27 +02:00
parent c0e29010f6
commit cfcd011fcd
7 changed files with 237 additions and 210 deletions

View File

@@ -146,6 +146,7 @@ static struct vimvar
{VV_NAME("echospace", VAR_NUMBER), VV_RO},
{VV_NAME("argv", VAR_LIST), VV_RO},
{VV_NAME("collate", VAR_STRING), VV_RO},
{VV_NAME("disallow_let", VAR_NUMBER), 0}, // TODO: remove
};
// shorthand
@@ -734,6 +735,12 @@ ex_let(exarg_T *eap)
ex_finally(eap);
return;
}
if (get_vim_var_nr(VV_DISALLOW_LET)
&& eap->cmdidx == CMD_let && vim9script)
{
emsg(_(e_cannot_use_let_in_vim9_script));
return;
}
if (eap->cmdidx == CMD_const && !vim9script && !eap->forceit)
// In legacy Vim script ":const" works like ":final".
eap->cmdidx = CMD_final;