Patch 8.2.4333
Problem: cstack not always passed to where it is needed.
Solution: Pass ctack through functions.
Files: src/eval.c, src/vim9expr.c, src/vim9script.c,
src/proto/
vim9script.pro, src/vim9compile.c,
src/proto/
vim9compile.pro
*** ../vim-8.2.4332/src/eval.c 2022-02-07 19:56:38.883286149 +0000
--- src/eval.c 2022-02-08 20:54:29.175666855 +0000
***************
*** 975,981 ****
cc = *p;
*p = NUL;
if (find_exported(import->imp_sid, lp->ll_name, &ufunc, &type,
! NULL, TRUE) == -1)
{
*p = cc;
return NULL;
--- 975,981 ----
cc = *p;
*p = NUL;
if (find_exported(import->imp_sid, lp->ll_name, &ufunc, &type,
! NULL, NULL, TRUE) == -1)
{
*p = cc;
return NULL;
***************
*** 6056,6062 ****
**arg = NUL;
idx = find_exported(rettv->vval.v_number, exp_name, &ufunc, &type,
! evalarg->eval_cctx, verbose);
**arg = cc;
if (idx < 0 && ufunc == NULL)
--- 6056,6062 ----
**arg = NUL;
idx = find_exported(rettv->vval.v_number, exp_name, &ufunc, &type,
! evalarg->eval_cctx, evalarg->eval_cstack, verbose);
**arg = cc;
if (idx < 0 && ufunc == NULL)
*** ../vim-8.2.4332/src/vim9expr.c 2022-02-08 20:35:23.749959758 +0000
--- src/vim9expr.c 2022-02-08 20:57:51.679326544 +0000
***************
*** 256,262 ****
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);
if (idx >= 0)
{
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx;
--- 256,262 ----
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, NULL);
if (idx >= 0)
{
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx;
***************
*** 316,322 ****
else
{
idx = find_exported(import->imp_sid, exp_name, &ufunc, &type,
! cctx, TRUE);
}
*p = cc;
*end = p;
--- 316,322 ----
else
{
idx = find_exported(import->imp_sid, exp_name, &ufunc, &type,
! cctx, NULL, TRUE);
}
*p = cc;
*end = p;
*** ../vim-8.2.4332/src/vim9script.c 2022-02-08 20:35:23.749959758 +0000
--- src/vim9script.c 2022-02-08 20:56:06.755500912 +0000
***************
*** 649,654 ****
--- 649,655 ----
/*
* 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,665 ****
--- 661,667 ----
ufunc_T **ufunc,
type_T **type,
cctx_T *cctx,
+ cstack_T *cstack,
int verbose)
{
int idx = -1;
***************
*** 667,673 ****
scriptitem_T *script = SCRIPT_ITEM(sid);
// Find name in "script".
! idx = get_script_item_idx(sid, name, 0, cctx);
if (idx >= 0)
{
sv = ((svar_T *)script->sn_var_vals.ga_data) + idx;
--- 669,675 ----
scriptitem_T *script = SCRIPT_ITEM(sid);
// Find name in "script".
! idx = get_script_item_idx(sid, name, 0, cctx, cstack);
if (idx >= 0)
{
sv = ((svar_T *)script->sn_var_vals.ga_data) + idx;
*** ../vim-8.2.4332/src/proto/
vim9script.pro 2022-01-10 18:06:58.682381797 +0000
--- src/proto/
vim9script.pro 2022-02-08 21:01:50.554941268 +0000
***************
*** 11,17 ****
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);
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);
--- 11,17 ----
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, 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);
*** ../vim-8.2.4332/src/vim9compile.c 2022-02-08 20:35:23.749959758 +0000
--- src/vim9compile.c 2022-02-08 21:04:18.154709130 +0000
***************
*** 532,538 ****
* 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)
{
hashtab_T *ht;
dictitem_T *di;
--- 532,543 ----
* 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,
! cstack_T *cstack)
{
hashtab_T *ht;
dictitem_T *di;
***************
*** 544,550 ****
return -1;
if (sid == current_sctx.sc_sid)
{
! sallvar_T *sav = find_script_var(name, 0, cctx, NULL);
if (sav == NULL)
return -2;
--- 549,555 ----
return -1;
if (sid == current_sctx.sc_sid)
{
! sallvar_T *sav = find_script_var(name, 0, cctx, cstack);
if (sav == NULL)
return -2;
***************
*** 1449,1455 ****
lhs->lhs_scriptvar_idx = get_script_item_idx(
lhs->lhs_scriptvar_sid, rawname,
lhs->lhs_has_index ? ASSIGN_FINAL : ASSIGN_CONST,
! cctx);
if (lhs->lhs_scriptvar_idx >= 0)
{
scriptitem_T *si = SCRIPT_ITEM(
--- 1454,1460 ----
lhs->lhs_scriptvar_idx = get_script_item_idx(
lhs->lhs_scriptvar_sid, rawname,
lhs->lhs_has_index ? ASSIGN_FINAL : ASSIGN_CONST,
! cctx, NULL);
if (lhs->lhs_scriptvar_idx >= 0)
{
scriptitem_T *si = SCRIPT_ITEM(
*** ../vim-8.2.4332/src/proto/
vim9compile.pro 2022-02-08 20:35:23.749959758 +0000
--- src/proto/
vim9compile.pro 2022-02-08 21:01:43.682952177 +0000
***************
*** 7,13 ****
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);
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);
--- 7,13 ----
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, 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);
*** ../vim-8.2.4332/src/version.c 2022-02-08 20:35:23.753959753 +0000
--- src/version.c 2022-02-08 21:16:39.701529761 +0000
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4333,
/**/
--
How To Keep A Healthy Level Of Insanity:
4. Put your garbage can on your desk and label it "in".
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///