0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.4066: Vim9: imported autoload script loaded again

Problem:    Vim9: imported autoload script loaded again.
Solution:   Do not create a new imported_T every time.
This commit is contained in:
Bram Moolenaar
2022-01-12 11:46:40 +00:00
parent 3cf21b3051
commit 17d36cbcd3
4 changed files with 29 additions and 13 deletions

View File

@@ -250,6 +250,8 @@ ex_incdec(exarg_T *eap)
void
ex_export(exarg_T *eap)
{
int prev_did_emsg = did_emsg;
if (!in_vim9script())
{
emsg(_(e_export_can_only_be_used_in_vim9script));
@@ -273,12 +275,14 @@ ex_export(exarg_T *eap)
// The command will reset "is_export" when exporting an item.
if (is_export)
{
emsg(_(e_export_with_invalid_argument));
if (did_emsg == prev_did_emsg)
emsg(_(e_export_with_invalid_argument));
is_export = FALSE;
}
break;
default:
emsg(_(e_invalid_command_after_export));
if (did_emsg == prev_did_emsg)
emsg(_(e_invalid_command_after_export));
break;
}
}
@@ -589,14 +593,17 @@ handle_import(
&& check_defined(as_name, STRLEN(as_name), cctx, FALSE) == FAIL)
goto erret;
imported = new_imported(import_gap);
if (imported == NULL)
goto erret;
imported->imp_name = as_name;
as_name = NULL;
imported->imp_sid = sid;
if (is_autoload)
imported->imp_flags = IMP_FLAGS_AUTOLOAD;
{
imported = new_imported(import_gap);
if (imported == NULL)
goto erret;
imported->imp_name = as_name;
as_name = NULL;
imported->imp_sid = sid;
if (is_autoload)
imported->imp_flags = IMP_FLAGS_AUTOLOAD;
}
}
erret: