0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2162: Vim9: Cannot load or store autoload variables

Problem:    Vim9: Cannot load or store autoload variables.
Solution:   Add ISN_LOADAUTO and ISN_STOREAUTO. (closes #7485)
This commit is contained in:
Bram Moolenaar
2020-12-19 16:30:44 +01:00
parent 1f33e0a7c4
commit 03290b8444
10 changed files with 106 additions and 15 deletions

View File

@@ -1391,6 +1391,21 @@ call_def_function(
}
break;
// load autoload variable
case ISN_LOADAUTO:
{
char_u *name = iptr->isn_arg.string;
if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
goto failed;
SOURCING_LNUM = iptr->isn_lnum;
if (eval_variable(name, STRLEN(name),
STACK_TV_BOT(0), NULL, TRUE, FALSE) == FAIL)
goto on_error;
++ectx.ec_stack.ga_len;
}
break;
// load g:/b:/w:/t: namespace
case ISN_LOADGDICT:
case ISN_LOADBDICT:
@@ -1611,6 +1626,14 @@ call_def_function(
}
break;
// store an autoload variable
case ISN_STOREAUTO:
SOURCING_LNUM = iptr->isn_lnum;
set_var(iptr->isn_arg.string, STACK_TV_BOT(-1), TRUE);
clear_tv(STACK_TV_BOT(-1));
--ectx.ec_stack.ga_len;
break;
// store number in local variable
case ISN_STORENR:
tv = STACK_TV_VAR(iptr->isn_arg.storenr.stnr_idx);
@@ -3286,6 +3309,9 @@ ex_disassemble(exarg_T *eap)
iptr->isn_arg.loadstore.ls_name, si->sn_name);
}
break;
case ISN_LOADAUTO:
smsg("%4d LOADAUTO %s", current, iptr->isn_arg.string);
break;
case ISN_LOADG:
smsg("%4d LOADG g:%s", current, iptr->isn_arg.string);
break;
@@ -3337,6 +3363,9 @@ ex_disassemble(exarg_T *eap)
smsg("%4d STOREV v:%s", current,
get_vim_var_name(iptr->isn_arg.number));
break;
case ISN_STOREAUTO:
smsg("%4d STOREAUTO %s", current, iptr->isn_arg.string);
break;
case ISN_STOREG:
smsg("%4d STOREG %s", current, iptr->isn_arg.string);
break;