patch 8.2.2975: Vim9: can only use an autoload function name as a string
Problem: Vim9: can only use an autoload function name as a string.
Solution: Load the autoload script when encountered. (closes #8124)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 6fcad3d..44c082d 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3084,7 +3084,13 @@
if (name == NULL)
return FAIL;
- if (arg_exists(*arg, len, &idx, &type, &gen_load_outer, cctx) == OK)
+ if (vim_strchr(name, AUTOLOAD_CHAR) != NULL)
+ {
+ script_autoload(name, FALSE);
+ res = generate_LOAD(cctx, ISN_LOADAUTO, 0, name, &t_any);
+ }
+ else if (arg_exists(*arg, len, &idx, &type, &gen_load_outer, cctx)
+ == OK)
{
if (gen_load_outer == 0)
gen_load = TRUE;