1
0
forked from aniani/vim

patch 8.2.1190: Vim9: checking for Vim9 syntax is spread out

Problem:    Vim9: checking for Vim9 syntax is spread out.
Solution:   Use in_vim9script().
This commit is contained in:
Bram Moolenaar
2020-07-12 17:07:05 +02:00
parent 8af81d656a
commit eb6880b6eb
9 changed files with 26 additions and 28 deletions

View File

@@ -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;