diff options
Diffstat (limited to 'src/vim9script.c')
-rw-r--r-- | src/vim9script.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vim9script.c b/src/vim9script.c index c191113c8..3c57d341b 100644 --- a/src/vim9script.c +++ b/src/vim9script.c @@ -22,7 +22,9 @@ static char e_needs_vim9[] = N_("E1042: export can only be used in vim9script"); int in_vim9script(void) { - // TODO: go up the stack? + // Do not go up the stack, a ":function" inside vim9script uses legacy + // syntax. "sc_version" is also set when compiling a ":def" function in + // legacy script. return current_sctx.sc_version == SCRIPT_VERSION_VIM9; } @@ -67,7 +69,7 @@ ex_vim9script(exarg_T *eap) void ex_export(exarg_T *eap) { - if (current_sctx.sc_version != SCRIPT_VERSION_VIM9) + if (!in_vim9script()) { emsg(_(e_needs_vim9)); return; |