patch 8.2.3859: Vim9: some code lines not tested
Problem: Vim9: some code lines not tested.
Solution: Add a few specific tests.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 2b27f51..4bce997 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -8333,7 +8333,6 @@
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 @@
}
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 @@
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;