comparison src/vim9compile.c @ 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 e311a80f8cbe
children 5c4ab8d4472c
comparison
equal deleted inserted replaced
27612:8f106547bf9d 27613:42d0279c6e7c
530 * Returns the index in "sn_var_vals" if found. 530 * Returns the index in "sn_var_vals" if found.
531 * If found but not in "sn_var_vals" returns -1. 531 * If found but not in "sn_var_vals" returns -1.
532 * If not found or the variable is not writable returns -2. 532 * If not found or the variable is not writable returns -2.
533 */ 533 */
534 int 534 int
535 get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx) 535 get_script_item_idx(
536 int sid,
537 char_u *name,
538 int check_writable,
539 cctx_T *cctx,
540 cstack_T *cstack)
536 { 541 {
537 hashtab_T *ht; 542 hashtab_T *ht;
538 dictitem_T *di; 543 dictitem_T *di;
539 scriptitem_T *si = SCRIPT_ITEM(sid); 544 scriptitem_T *si = SCRIPT_ITEM(sid);
540 svar_T *sv; 545 svar_T *sv;
542 547
543 if (!SCRIPT_ID_VALID(sid)) 548 if (!SCRIPT_ID_VALID(sid))
544 return -1; 549 return -1;
545 if (sid == current_sctx.sc_sid) 550 if (sid == current_sctx.sc_sid)
546 { 551 {
547 sallvar_T *sav = find_script_var(name, 0, cctx, NULL); 552 sallvar_T *sav = find_script_var(name, 0, cctx, cstack);
548 553
549 if (sav == NULL) 554 if (sav == NULL)
550 return -2; 555 return -2;
551 idx = sav->sav_var_vals_idx; 556 idx = sav->sav_var_vals_idx;
552 sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; 557 sv = ((svar_T *)si->sn_var_vals.ga_data) + idx;
1447 { 1452 {
1448 // Check writable only when no index follows. 1453 // Check writable only when no index follows.
1449 lhs->lhs_scriptvar_idx = get_script_item_idx( 1454 lhs->lhs_scriptvar_idx = get_script_item_idx(
1450 lhs->lhs_scriptvar_sid, rawname, 1455 lhs->lhs_scriptvar_sid, rawname,
1451 lhs->lhs_has_index ? ASSIGN_FINAL : ASSIGN_CONST, 1456 lhs->lhs_has_index ? ASSIGN_FINAL : ASSIGN_CONST,
1452 cctx); 1457 cctx, NULL);
1453 if (lhs->lhs_scriptvar_idx >= 0) 1458 if (lhs->lhs_scriptvar_idx >= 0)
1454 { 1459 {
1455 scriptitem_T *si = SCRIPT_ITEM( 1460 scriptitem_T *si = SCRIPT_ITEM(
1456 lhs->lhs_scriptvar_sid); 1461 lhs->lhs_scriptvar_sid);
1457 svar_T *sv = 1462 svar_T *sv =