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.
diff --git a/src/vim9script.c b/src/vim9script.c
index 5c1c055..8721088 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -516,6 +516,12 @@
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)
{