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

patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable

Problem:    Vim9: no error for declaring buffer, window, etc. variable.
Solution:   Give an error.  Unify the error messages.
This commit is contained in:
Bram Moolenaar
2020-06-21 15:52:59 +02:00
parent 820ffa567c
commit e55b1c098d
7 changed files with 75 additions and 23 deletions

View File

@@ -1204,6 +1204,13 @@ ex_let_one(
emsg(_("E996: Cannot lock an environment variable"));
return NULL;
}
if (current_sctx.sc_version == SCRIPT_VERSION_VIM9
&& (flags & LET_NO_COMMAND) == 0)
{
vim9_declare_error(arg);
return NULL;
}
// Find the end of the name.
++arg;
name = arg;
@@ -2864,16 +2871,17 @@ set_var_const(
semsg(_(e_illvar), name);
return;
}
is_script_local = ht == get_script_local_ht();
if (current_sctx.sc_version == SCRIPT_VERSION_VIM9
&& ht == &globvarht
&& (flags & LET_NO_COMMAND) == 0)
&& !is_script_local
&& (flags & LET_NO_COMMAND) == 0
&& name[1] == ':')
{
semsg(_(e_declare_global), name);
vim9_declare_error(name);
return;
}
is_script_local = ht == get_script_local_ht();
di = find_var_in_ht(ht, 0, varname, TRUE);
// Search in parent scope which is possible to reference from lambda