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

patch 8.2.0972: Vim9 script variable declarations need a type

Problem:    Vim9 script variable declarations need a type.
Solution:   Make "let var: type" declare a script-local variable.
This commit is contained in:
Bram Moolenaar
2020-06-13 18:09:19 +02:00
parent 142499de33
commit c82a5b5da5
7 changed files with 92 additions and 5 deletions

View File

@@ -728,8 +728,18 @@ ex_let(exarg_T *eap)
else if (expr[0] == '.')
emsg(_("E985: .= is not supported with script version 2"));
else if (!ends_excmd2(eap->cmd, arg))
// ":let var1 var2"
arg = list_arg_vars(eap, arg, &first);
{
if (current_sctx.sc_version == SCRIPT_VERSION_VIM9)
{
// Vim9 declaration ":let var: type"
arg = vim9_declare_scriptvar(eap, arg);
}
else
{
// ":let var1 var2" - list values
arg = list_arg_vars(eap, arg, &first);
}
}
else if (!eap->skip)
{
// ":let"