Problem: cstack not always passed to where it is needed.
Solution: Pass ctack through functions.
cc = *p;
*p = NUL;
if (find_exported(import->imp_sid, lp->ll_name, &ufunc, &type,
- NULL, TRUE) == -1)
+ NULL, NULL, TRUE) == -1)
{
*p = cc;
return NULL;
**arg = NUL;
idx = find_exported(rettv->vval.v_number, exp_name, &ufunc, &type,
- evalarg->eval_cctx, verbose);
+ evalarg->eval_cctx, evalarg->eval_cstack, verbose);
**arg = cc;
if (idx < 0 && ufunc == NULL)
int need_type_where(type_T *actual, type_T *expected, int offset, where_T where, cctx_T *cctx, int silent, int actual_is_const);
int need_type(type_T *actual, type_T *expected, int offset, int arg_idx, cctx_T *cctx, int silent, int actual_is_const);
lvar_T *reserve_local(cctx_T *cctx, char_u *name, size_t len, int isConst, type_T *type);
-int get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx);
+int get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx, cstack_T *cstack);
imported_T *find_imported(char_u *name, size_t len, int load, cctx_T *cctx);
char_u *may_peek_next_line(cctx_T *cctx, char_u *arg, char_u **nextp);
char_u *peek_next_line_from_context(cctx_T *cctx);
void free_imports_and_script_vars(int sid);
void mark_imports_for_reload(int sid);
void ex_import(exarg_T *eap);
-int find_exported(int sid, char_u *name, ufunc_T **ufunc, type_T **type, cctx_T *cctx, int verbose);
+int find_exported(int sid, char_u *name, ufunc_T **ufunc, type_T **type, cctx_T *cctx, cstack_T *cstack, int verbose);
char_u *vim9_declare_scriptvar(exarg_T *eap, char_u *arg);
void update_vim9_script_var(int create, dictitem_T *di, char_u *name, int flags, typval_T *tv, type_T **type, int do_member);
void hide_script_var(scriptitem_T *si, int idx, int func_defined);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4333,
/**/
4332,
/**/
* If not found or the variable is not writable returns -2.
*/
int
-get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx)
+get_script_item_idx(
+ int sid,
+ char_u *name,
+ int check_writable,
+ cctx_T *cctx,
+ cstack_T *cstack)
{
hashtab_T *ht;
dictitem_T *di;
return -1;
if (sid == current_sctx.sc_sid)
{
- sallvar_T *sav = find_script_var(name, 0, cctx, NULL);
+ sallvar_T *sav = find_script_var(name, 0, cctx, cstack);
if (sav == NULL)
return -2;
lhs->lhs_scriptvar_idx = get_script_item_idx(
lhs->lhs_scriptvar_sid, rawname,
lhs->lhs_has_index ? ASSIGN_FINAL : ASSIGN_CONST,
- cctx);
+ cctx, NULL);
if (lhs->lhs_scriptvar_idx >= 0)
{
scriptitem_T *si = SCRIPT_ITEM(
if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
return FAIL;
si = SCRIPT_ITEM(current_sctx.sc_sid);
- idx = get_script_item_idx(current_sctx.sc_sid, name, 0, cctx);
+ idx = get_script_item_idx(current_sctx.sc_sid, name, 0, cctx, NULL);
if (idx >= 0)
{
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx;
else
{
idx = find_exported(import->imp_sid, exp_name, &ufunc, &type,
- cctx, TRUE);
+ cctx, NULL, TRUE);
}
*p = cc;
*end = p;
/*
* Find an exported item in "sid" matching "name".
+ * Either "cctx" or "cstack" is NULL.
* When it is a variable return the index.
* When it is a user function return "*ufunc".
* When not found returns -1 and "*ufunc" is NULL.
ufunc_T **ufunc,
type_T **type,
cctx_T *cctx,
+ cstack_T *cstack,
int verbose)
{
int idx = -1;
scriptitem_T *script = SCRIPT_ITEM(sid);
// Find name in "script".
- idx = get_script_item_idx(sid, name, 0, cctx);
+ idx = get_script_item_idx(sid, name, 0, cctx, cstack);
if (idx >= 0)
{
sv = ((svar_T *)script->sn_var_vals.ga_data) + idx;