patch 8.2.4447: Vim9: can still use s:var in a compiled function
Problem: Vim9: can still use s:var in a compiled function.
Solution: Disallow using s:var for Vim9 script. (closes #9824)
diff --git a/src/vim9expr.c b/src/vim9expr.c
index 46d14dc..1485bd9 100644
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -422,8 +422,15 @@
{
case 'v': res = generate_LOADV(cctx, name, error);
break;
- case 's': if (is_expr && ASCII_ISUPPER(*name)
- && find_func(name, FALSE) != NULL)
+ case 's': if (current_script_is_vim9())
+ {
+ semsg(_(e_cannot_use_s_colon_in_vim9_script_str),
+ *arg);
+ vim_free(name);
+ return FAIL;
+ }
+ if (is_expr && ASCII_ISUPPER(*name)
+ && find_func(name, FALSE) != NULL)
res = generate_funcref(cctx, name, FALSE);
else
res = compile_load_scriptvar(cctx, name,