diff src/vim9compile.c @ 24283:bcfff560e089 v8.2.2682

patch 8.2.2682: Vim9: cannot find Name.Func from "import * as Name" Commit: https://github.com/vim/vim/commit/529fb5a5f62378bbaac00e1ed9b9c32c6e20c1b9 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 1 12:57:57 2021 +0200 patch 8.2.2682: Vim9: cannot find Name.Func from "import * as Name" Problem: Vim9: cannot find Name.Func from "import * as Name". (Alexander Goussas) Solution: When no variable found try finding a function. (closes #8045) Check that the function was exported.
author Bram Moolenaar <Bram@vim.org>
date Thu, 01 Apr 2021 13:00:03 +0200
parents cabed216cc2f
children bbf4b3185554
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2720,11 +2720,17 @@ compile_load_scriptvar(
 								   cctx, TRUE);
 	    *p = cc;
 	    p = skipwhite(p);
-
-	    // TODO: what if it is a function?
+	    *end = p;
+
 	    if (idx < 0)
+	    {
+		if (*p == '(' && ufunc != NULL)
+		{
+		    generate_PUSHFUNC(cctx, ufunc->uf_name, import->imp_type);
+		    return OK;
+		}
 		return FAIL;
-	    *end = p;
+	    }
 
 	    generate_VIM9SCRIPT(cctx, ISN_LOADSCRIPT,
 		    import->imp_sid,