0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.4330: Vim9: no error if script imports itself

Problem:    Vim9: no error if script imports itself.
Solution:   Give an error when a script imports itself.
This commit is contained in:
Bram Moolenaar
2022-02-08 19:12:19 +00:00
parent e023d49937
commit 779aeff5c3
4 changed files with 20 additions and 2 deletions

View File

@@ -516,6 +516,12 @@ handle_import(
goto erret;
}
if (sid == current_sctx.sc_sid)
{
emsg(_(e_script_cannot_import_itself));
goto erret;
}
import_gap = gap != NULL ? gap : &SCRIPT_ITEM(import_sid)->sn_imports;
for (i = 0; i < import_gap->ga_len; ++i)
{