patch 8.2.3299: Vim9: exists() does not handle much at compile time
Problem: Vim9: exists() does not handle much at compile time.
Solution: Handle variable names. (closes #8688)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 6db930e..af46d15 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3552,7 +3552,14 @@
}
else if (*p == '*') // internal or user defined function
{
+ int save_version = current_sctx.sc_version;
+
+ // Vim9 script assumes a function is script-local, but here we want to
+ // find any matching function.
+ if (current_sctx.sc_version == SCRIPT_VERSION_VIM9)
+ current_sctx.sc_version = SCRIPT_VERSION_MAX;
n = function_exists(p + 1, FALSE);
+ current_sctx.sc_version = save_version;
}
else if (*p == '?') // internal function only
{