summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-08 21:17:22 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-08 21:17:22 +0000
commitb6a138eb334621f60c5891d035f80f398d59dbd3 (patch)
treecc5a52690b5e52b64c0dfe2e489e5f01feabac68 /src
parentdce2441a603f2c9343a4a46091283a32420d80a2 (diff)
patch 8.2.4333: cstack not always passed to where it is neededv8.2.4333
Problem: cstack not always passed to where it is needed. Solution: Pass ctack through functions.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c4
-rw-r--r--src/proto/vim9compile.pro2
-rw-r--r--src/proto/vim9script.pro2
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c11
-rw-r--r--src/vim9expr.c4
-rw-r--r--src/vim9script.c4
7 files changed, 19 insertions, 10 deletions
diff --git a/src/eval.c b/src/eval.c
index 2942d0fe1d..d775ee3f26 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -975,7 +975,7 @@ get_lval(
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;
@@ -6056,7 +6056,7 @@ handle_subscript(
**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)
diff --git a/src/proto/vim9compile.pro b/src/proto/vim9compile.pro
index 0790decb8a..9effb1744b 100644
--- a/src/proto/vim9compile.pro
+++ b/src/proto/vim9compile.pro
@@ -7,7 +7,7 @@ int check_defined(char_u *p, size_t len, cctx_T *cctx, cstack_T *cstack, int is_
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);
diff --git a/src/proto/vim9script.pro b/src/proto/vim9script.pro
index 46211ddb09..6295dc2cca 100644
--- a/src/proto/vim9script.pro
+++ b/src/proto/vim9script.pro
@@ -11,7 +11,7 @@ void ex_export(exarg_T *eap);
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);
diff --git a/src/version.c b/src/version.c
index 9f3dfd2f65..a4480e1866 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4333,
+/**/
4332,
/**/
4331,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 5f80988b80..265ea665b8 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -532,7 +532,12 @@ check_item_writable(svar_T *sv, int check_writable, char_u *name)
* 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;
@@ -544,7 +549,7 @@ get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx)
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;
@@ -1449,7 +1454,7 @@ compile_lhs(
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(
diff --git a/src/vim9expr.c b/src/vim9expr.c
index b44f9288d9..1e53478a50 100644
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -256,7 +256,7 @@ compile_load_scriptvar(
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;
@@ -316,7 +316,7 @@ compile_load_scriptvar(
else
{
idx = find_exported(import->imp_sid, exp_name, &ufunc, &type,
- cctx, TRUE);
+ cctx, NULL, TRUE);
}
*p = cc;
*end = p;
diff --git a/src/vim9script.c b/src/vim9script.c
index 1b8988d55f..fde51c91f9 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -649,6 +649,7 @@ ex_import(exarg_T *eap)
/*
* 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.
@@ -660,6 +661,7 @@ find_exported(
ufunc_T **ufunc,
type_T **type,
cctx_T *cctx,
+ cstack_T *cstack,
int verbose)
{
int idx = -1;
@@ -667,7 +669,7 @@ find_exported(
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;