mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.4375: ctx_imports is not used
Problem: ctx_imports is not used. Solution: Delete ctx_imports. Add missing dependency.
This commit is contained in:
@@ -281,7 +281,7 @@ variable_exists(char_u *name, size_t len, cctx_T *cctx)
|
||||
&& (lookup_local(name, len, NULL, cctx) == OK
|
||||
|| arg_exists(name, len, NULL, NULL, NULL, cctx) == OK))
|
||||
|| script_var_exists(name, len, cctx, NULL) == OK
|
||||
|| find_imported(name, len, FALSE, cctx) != NULL;
|
||||
|| find_imported(name, len, FALSE) != NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -329,7 +329,7 @@ check_defined(
|
||||
if ((cctx != NULL
|
||||
&& (lookup_local(p, len, NULL, cctx) == OK
|
||||
|| arg_exists(p, len, NULL, NULL, NULL, cctx) == OK))
|
||||
|| find_imported(p, len, FALSE, cctx) != NULL
|
||||
|| find_imported(p, len, FALSE) != NULL
|
||||
|| (ufunc = find_func_even_dead(p, 0)) != NULL)
|
||||
{
|
||||
// A local or script-local function can shadow a global function.
|
||||
@@ -594,36 +594,18 @@ find_imported_in_script(char_u *name, size_t len, int sid)
|
||||
}
|
||||
|
||||
/*
|
||||
* Find "name" in imported items of the current script or in "cctx" if not
|
||||
* NULL.
|
||||
* Find "name" in imported items of the current script.
|
||||
* If "load" is TRUE and the script was not loaded yet, load it now.
|
||||
*/
|
||||
imported_T *
|
||||
find_imported(char_u *name, size_t len, int load, cctx_T *cctx)
|
||||
find_imported(char_u *name, size_t len, int load)
|
||||
{
|
||||
int idx;
|
||||
imported_T *ret = NULL;
|
||||
imported_T *ret;
|
||||
|
||||
if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
|
||||
return NULL;
|
||||
if (cctx != NULL)
|
||||
for (idx = 0; idx < cctx->ctx_imports.ga_len; ++idx)
|
||||
{
|
||||
imported_T *import = ((imported_T *)cctx->ctx_imports.ga_data)
|
||||
+ idx;
|
||||
|
||||
if (len == 0 ? STRCMP(name, import->imp_name) == 0
|
||||
: STRLEN(import->imp_name) == len
|
||||
&& STRNCMP(name, import->imp_name, len) == 0)
|
||||
{
|
||||
ret = import;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == NULL)
|
||||
ret = find_imported_in_script(name, len, current_sctx.sc_sid);
|
||||
|
||||
ret = find_imported_in_script(name, len, current_sctx.sc_sid);
|
||||
if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD))
|
||||
{
|
||||
scid_T dummy;
|
||||
@@ -636,23 +618,6 @@ find_imported(char_u *name, size_t len, int load, cctx_T *cctx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free all imported variables.
|
||||
*/
|
||||
static void
|
||||
free_imported(cctx_T *cctx)
|
||||
{
|
||||
int idx;
|
||||
|
||||
for (idx = 0; idx < cctx->ctx_imports.ga_len; ++idx)
|
||||
{
|
||||
imported_T *import = ((imported_T *)cctx->ctx_imports.ga_data) + idx;
|
||||
|
||||
vim_free(import->imp_name);
|
||||
}
|
||||
ga_clear(&cctx->ctx_imports);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when checking for a following operator at "arg". When the rest of
|
||||
* the line is empty or only a comment, peek the next line. If there is a next
|
||||
@@ -1364,7 +1329,7 @@ compile_lhs(
|
||||
: script_var_exists(var_start, lhs->lhs_varlen,
|
||||
cctx, NULL)) == OK;
|
||||
imported_T *import =
|
||||
find_imported(var_start, lhs->lhs_varlen, FALSE, cctx);
|
||||
find_imported(var_start, lhs->lhs_varlen, FALSE);
|
||||
|
||||
if (script_namespace || script_var || import != NULL)
|
||||
{
|
||||
@@ -2600,7 +2565,6 @@ compile_def_function(
|
||||
ga_init2(&cctx.ctx_locals, sizeof(lvar_T), 10);
|
||||
// Each entry on the type stack consists of two type pointers.
|
||||
ga_init2(&cctx.ctx_type_stack, sizeof(type2_T), 50);
|
||||
ga_init2(&cctx.ctx_imports, sizeof(imported_T), 10);
|
||||
cctx.ctx_type_list = &ufunc->uf_type_list;
|
||||
ga_init2(&cctx.ctx_instr, sizeof(isn_T), 50);
|
||||
instr = &cctx.ctx_instr;
|
||||
@@ -3291,7 +3255,6 @@ erret:
|
||||
estack_pop();
|
||||
|
||||
ga_clear_strings(&lines_to_free);
|
||||
free_imported(&cctx);
|
||||
free_locals(&cctx);
|
||||
ga_clear(&cctx.ctx_type_stack);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user