patch 8.2.4050: Vim9: need to prefix every item in an autoload script

Problem:    Vim9: need to prefix every item in an autoload script.
Solution:   First step in supporting "vim9script autoload" and "import
            autoload".
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 11e3226..993bb1c 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -268,7 +268,7 @@
 		&& (lookup_local(name, len, NULL, cctx) == OK
 		    || arg_exists(name, len, NULL, NULL, NULL, cctx) == OK))
 	    || script_var_exists(name, len, cctx) == OK
-	    || find_imported(name, len, cctx) != NULL;
+	    || find_imported(name, len, FALSE, cctx) != NULL;
 }
 
 /*
@@ -331,7 +331,7 @@
     if ((cctx != NULL
 		&& (lookup_local(p, len, NULL, cctx) == OK
 		    || arg_exists(p, len, NULL, NULL, NULL, cctx) == OK))
-	    || find_imported(p, len, cctx) != NULL
+	    || find_imported(p, len, FALSE, cctx) != NULL
 	    || (ufunc = find_func_even_dead(p, FALSE, cctx)) != NULL)
     {
 	// A local or script-local function can shadow a global function.
@@ -581,11 +581,13 @@
 /*
  * Find "name" in imported items of the current script or in "cctx" if not
  * NULL.
+ * If "load" is TRUE and the script was not loaded yet, load it now.
  */
     imported_T *
-find_imported(char_u *name, size_t len, cctx_T *cctx)
+find_imported(char_u *name, size_t len, int load, cctx_T *cctx)
 {
     int		    idx;
+    imported_T	    *ret = NULL;
 
     if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
 	return NULL;
@@ -598,10 +600,23 @@
 	    if (len == 0 ? STRCMP(name, import->imp_name) == 0
 			 : STRLEN(import->imp_name) == len
 				  && STRNCMP(name, import->imp_name, len) == 0)
-		return import;
+	    {
+		ret = import;
+		break;
+	    }
 	}
 
-    return find_imported_in_script(name, len, current_sctx.sc_sid);
+    if (ret == NULL)
+	ret = find_imported_in_script(name, len, current_sctx.sc_sid);
+
+    if (ret != NULL && load && ret->imp_flags == IMP_FLAGS_AUTOLOAD)
+    {
+	// script found before but not loaded yet
+	ret->imp_flags = 0;
+	(void)do_source(SCRIPT_ITEM(ret->imp_sid)->sn_name, FALSE,
+							      DOSO_NONE, NULL);
+    }
+    return ret;
 }
 
 /*
@@ -1326,7 +1341,7 @@
 			  : script_var_exists(var_start, lhs->lhs_varlen,
 								  cctx)) == OK;
 		imported_T  *import =
-			       find_imported(var_start, lhs->lhs_varlen, cctx);
+			find_imported(var_start, lhs->lhs_varlen, FALSE, cctx);
 
 		if (script_namespace || script_var || import != NULL)
 		{