patch 8.2.4371: Vim9: can create a script variable from a legacy function
Problem: Vim9: can create a script variable from a legacy function.
Solution: Disallow creating a script variable from a function.
diff --git a/src/evalvars.c b/src/evalvars.c
index 994b979..d182a0e 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -3504,6 +3504,12 @@
semsg(_(e_cannot_use_str_itself_it_is_imported), name);
goto failed;
}
+ if (!in_vim9script())
+ {
+ semsg(_(e_cannot_create_vim9_script_variable_in_function_str),
+ name);
+ goto failed;
+ }
}
if (dest_tv == NULL)