Mercurial > vim
changeset 27613:42d0279c6e7c v8.2.4333
patch 8.2.4333: cstack not always passed to where it is needed
Commit: https://github.com/vim/vim/commit/b6a138eb334621f60c5891d035f80f398d59dbd3
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 8 21:17:22 2022 +0000
patch 8.2.4333: cstack not always passed to where it is needed
Problem: cstack not always passed to where it is needed.
Solution: Pass ctack through functions.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 08 Feb 2022 22:30:03 +0100 |
parents | 8f106547bf9d |
children | 0d11933dc9e9 |
files | src/eval.c src/proto/vim9compile.pro src/proto/vim9script.pro src/version.c src/vim9compile.c src/vim9expr.c src/vim9script.c |
diffstat | 7 files changed, 19 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- a/src/proto/vim9compile.pro +++ b/src/proto/vim9compile.pro @@ -7,7 +7,7 @@ int check_defined(char_u *p, size_t len, 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);
--- 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);
--- 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,
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -532,7 +532,12 @@ check_item_writable(svar_T *sv, int chec * 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 *nam 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(
--- 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;
--- 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;