mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.1399: Vim9: may find imported item in wrong script
Problem: Vim9: may find imported item in wrong script. Solution: When looking up script-local function use the embedded script ID. (issue #6644)
This commit is contained in:
@@ -2548,12 +2548,10 @@ get_script_item_idx(int sid, char_u *name, int check_writable)
|
||||
imported_T *
|
||||
find_imported(char_u *name, size_t len, cctx_T *cctx)
|
||||
{
|
||||
scriptitem_T *si;
|
||||
int idx;
|
||||
|
||||
if (current_sctx.sc_sid <= 0)
|
||||
return NULL;
|
||||
si = SCRIPT_ITEM(current_sctx.sc_sid);
|
||||
if (cctx != NULL)
|
||||
for (idx = 0; idx < cctx->ctx_imports.ga_len; ++idx)
|
||||
{
|
||||
@@ -2566,6 +2564,15 @@ find_imported(char_u *name, size_t len, cctx_T *cctx)
|
||||
return import;
|
||||
}
|
||||
|
||||
return find_imported_in_script(name, len, current_sctx.sc_sid);
|
||||
}
|
||||
|
||||
imported_T *
|
||||
find_imported_in_script(char_u *name, size_t len, int sid)
|
||||
{
|
||||
scriptitem_T *si = SCRIPT_ITEM(sid);
|
||||
int idx;
|
||||
|
||||
for (idx = 0; idx < si->sn_imports.ga_len; ++idx)
|
||||
{
|
||||
imported_T *import = ((imported_T *)si->sn_imports.ga_data) + idx;
|
||||
|
Reference in New Issue
Block a user