Mercurial > vim
diff src/vim9script.c @ 27607:db1831f585a4 v8.2.4330
patch 8.2.4330: Vim9: no error if script imports itself
Commit: https://github.com/vim/vim/commit/779aeff5c32c26161f42cdccbaa2376e78ee77d6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 8 19:12:19 2022 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 08 Feb 2022 20:15:03 +0100 |
parents | 018c911eb9cf |
children | e311a80f8cbe |
line wrap: on
line diff
--- a/src/vim9script.c +++ b/src/vim9script.c @@ -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) {