diff src/vim9script.c @ 27086:1e2a6c6c7e42 v8.2.4072

patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded Commit: https://github.com/vim/vim/commit/d041f4208b0a2149e9d41f6443aa1c14c076a411 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 12 19:54:00 2022 +0000 patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded Problem: Vim9: compiling function fails when autoload script is not loaded yet. Solution: Depend on runtime loading.
author Bram Moolenaar <Bram@vim.org>
date Wed, 12 Jan 2022 21:00:05 +0100
parents 19fefc42a063
children 70ad00a80185
line wrap: on
line diff
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -488,7 +488,16 @@ handle_import(
 	// we need a scriptitem without loading the script
 	sid = find_script_in_rtp(from_name);
 	vim_free(from_name);
-	res = SCRIPT_ID_VALID(sid) ? OK : FAIL;
+	if (SCRIPT_ID_VALID(sid))
+	{
+	    scriptitem_T    *si = SCRIPT_ITEM(sid);
+
+	    if (si->sn_autoload_prefix == NULL)
+		si->sn_autoload_prefix = get_autoload_prefix(si);
+	    res = OK;
+	}
+	else
+	    res = FAIL;
     }
     else
     {