0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.1744: Vim9: using ":const!" is weird

Problem:    Vim9: using ":const!" is weird.
Solution:   Use "var" - "final" - "const" like Dart.  "let" still works for
            now.
This commit is contained in:
Bram Moolenaar
2020-09-26 15:09:30 +02:00
parent 273af497ca
commit 30fd8204ce
16 changed files with 512 additions and 382 deletions

View File

@@ -97,6 +97,8 @@ ex_export(exarg_T *eap)
switch (eap->cmdidx)
{
case CMD_let:
case CMD_var:
case CMD_final:
case CMD_const:
case CMD_def:
// case CMD_class:
@@ -508,9 +510,12 @@ vim9_declare_scriptvar(exarg_T *eap, char_u *arg)
int called_emsg_before = called_emsg;
typval_T init_tv;
if (eap->cmdidx == CMD_const)
if (eap->cmdidx == CMD_final || eap->cmdidx == CMD_const)
{
emsg(_(e_const_requires_a_value));
if (eap->cmdidx == CMD_final)
emsg(_(e_final_requires_a_value));
else
emsg(_(e_const_requires_a_value));
return arg + STRLEN(arg);
}