0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.2080: Vim9: no proper error message for using s:var in for loop

Problem:    Vim9: no proper error message for using s:var in for loop.
Solution:   Give a specific error.
This commit is contained in:
Bram Moolenaar
2020-12-02 14:24:30 +01:00
parent 38bd8de551
commit ea87069d78
3 changed files with 29 additions and 0 deletions

View File

@@ -6617,6 +6617,12 @@ compile_for(char_u *arg_start, cctx_T *cctx)
goto failed;
}
if (STRNCMP(name, "s:", 2) == 0)
{
semsg(_(e_cannot_declare_script_variable_in_function), name);
goto failed;
}
// Reserve a variable to store "var".
// TODO: check for type
var_lvar = reserve_local(cctx, arg, varlen, FALSE, &t_any);