diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-19 16:30:44 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-19 16:30:44 +0100 |
commit | 03290b8444b69c6d7307755770467bc488384e1a (patch) | |
tree | 7b6b7eaaa41c2f2194a0712f6848fe8209552af6 /src/vim9execute.c | |
parent | 1f33e0a7c4cd278158b37f91a2aa44f0bcd1f21a (diff) | |
download | vim-git-03290b8444b69c6d7307755770467bc488384e1a.tar.gz |
patch 8.2.2162: Vim9: Cannot load or store autoload variablesv8.2.2162
Problem: Vim9: Cannot load or store autoload variables.
Solution: Add ISN_LOADAUTO and ISN_STOREAUTO. (closes #7485)
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r-- | src/vim9execute.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c index 4fd62ce9e..7e5a1dea3 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -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; |