patch 8.2.2238: Vim9: cannot load a Vim9 script without the +eval feature
Problem: Vim9: cannot load a Vim9 script without the +eval feature.
Solution: Support Vim9 script syntax without the +eval feature.
diff --git a/src/autocmd.c b/src/autocmd.c
index c3aa324..f7ca41d 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -55,9 +55,7 @@
char once; // "One shot": removed after execution
char nested; // If autocommands nest here.
char last; // last command in list
-#ifdef FEAT_EVAL
sctx_T script_ctx; // script context where defined
-#endif
struct AutoCmd *next; // next AutoCmd in list
} AutoCmd;
@@ -1249,8 +1247,8 @@
if (ac == NULL)
return FAIL;
ac->cmd = vim_strsave(cmd);
-#ifdef FEAT_EVAL
ac->script_ctx = current_sctx;
+#ifdef FEAT_EVAL
ac->script_ctx.sc_lnum += SOURCING_LNUM;
#endif
if (ac->cmd == NULL)
@@ -1819,8 +1817,8 @@
static int nesting = 0;
AutoPatCmd patcmd;
AutoPat *ap;
-#ifdef FEAT_EVAL
sctx_T save_current_sctx;
+#ifdef FEAT_EVAL
funccal_entry_T funccal_entry;
char_u *save_cmdarg;
long save_cmdbang;
@@ -2029,9 +2027,9 @@
estack_push(ETYPE_AUCMD, NULL, 0);
ESTACK_CHECK_SETUP
-#ifdef FEAT_EVAL
save_current_sctx = current_sctx;
+#ifdef FEAT_EVAL
# ifdef FEAT_PROFILE
if (do_profiling == PROF_YES)
prof_child_enter(&wait_time); // doesn't count for the caller itself
@@ -2138,8 +2136,8 @@
autocmd_fname_full = save_autocmd_fname_full;
autocmd_bufnr = save_autocmd_bufnr;
autocmd_match = save_autocmd_match;
-#ifdef FEAT_EVAL
current_sctx = save_current_sctx;
+#ifdef FEAT_EVAL
restore_funccal();
# ifdef FEAT_PROFILE
if (do_profiling == PROF_YES)
@@ -2370,9 +2368,7 @@
if (ac->once)
au_del_cmd(ac);
autocmd_nested = ac->nested;
-#ifdef FEAT_EVAL
current_sctx = ac->script_ctx;
-#endif
if (ac->last)
acp->nextcmd = NULL;
else