Mercurial > vim
diff src/evalvars.c @ 20840:0600ab7b9f09 v8.2.0972
patch 8.2.0972: Vim9 script variable declarations need a type
Commit: https://github.com/vim/vim/commit/c82a5b5da5eab15bc35115545b639fb590272ad7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 13 18:09:19 2020 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 13 Jun 2020 18:15:03 +0200 |
parents | 9064044fd4f6 |
children | bacc2ab11810 |
line wrap: on
line diff
--- a/src/evalvars.c +++ b/src/evalvars.c @@ -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"