summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-22 18:12:44 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-22 18:12:44 +0000
commitb775e724394e05f3648fcb5f977979a592dd3f8c (patch)
tree0aad34c880cd4fe15070b30bfc820c12f7c9f966 /src/vim9compile.c
parent9c5b7cb4cf67c64648a324e9dfd1e17d793335a4 (diff)
downloadvim-git-b775e724394e05f3648fcb5f977979a592dd3f8c.tar.gz
patch 9.0.0920: cannot find an import prefixed with "s:"v9.0.0920
Problem: Cannot find an import prefixed with "s:". (Doug Kearns) Solution: Skip over the "s:". (closes #11585)
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index fb66a7880..17066b0e9 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -656,12 +656,14 @@ find_imported_in_script(char_u *name, size_t len, int sid)
imported_T *
find_imported(char_u *name, size_t len, int load)
{
- imported_T *ret;
-
if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
return NULL;
- ret = find_imported_in_script(name, len, current_sctx.sc_sid);
+ // Skip over "s:" before "s:something" to find the import name.
+ int off = name[0] == 's' && name[1] == ':' ? 2 : 0;
+
+ imported_T *ret = find_imported_in_script(name + off, len - off,
+ current_sctx.sc_sid);
if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD))
{
scid_T actual_sid = 0;