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

patch 8.2.3859: Vim9: some code lines not tested

Problem:    Vim9: some code lines not tested.
Solution:   Add a few specific tests.
This commit is contained in:
Bram Moolenaar
2021-12-20 12:25:03 +00:00
parent 003312b1d2
commit a99fb23842
5 changed files with 16 additions and 8 deletions

View File

@@ -8333,7 +8333,6 @@ compile_for(char_u *arg_start, cctx_T *cctx)
lhs_type = parse_type(&p, cctx->ctx_type_list, TRUE);
}
// Script var is not supported.
if (get_var_dest(name, &dest, CMD_for, &opt_flags,
&vimvaridx, &type, cctx) == FAIL)
goto failed;
@@ -8351,6 +8350,13 @@ compile_for(char_u *arg_start, cctx_T *cctx)
}
else
{
// Script var is not supported.
if (STRNCMP(name, "s:", 2) == 0)
{
emsg(_(e_cannot_use_script_variable_in_for_loop));
goto failed;
}
if (!valid_varname(arg, (int)varlen, FALSE))
goto failed;
if (lookup_local(arg, varlen, NULL, cctx) == OK)
@@ -8359,12 +8365,6 @@ 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".
where.wt_index = var_list ? idx + 1 : 0;
where.wt_variable = TRUE;