vim-patch:8.2.0703: Vim9: closure cannot store value in outer context (#28925)

Problem:    Vim9: closure cannot store value in outer context.
Solution:   Make storing value in outer context work.  Make :disassemble
            accept a function reference.

b68b346e6d

Funcstack is Vim9script-only.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2024-05-23 07:04:53 +08:00 committed by GitHub
parent 5cbd6d9b9f
commit a599183a27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -4836,8 +4836,10 @@ bool set_ref_in_item(typval_T *tv, int copyID, ht_stack_T **ht_stack, list_stack
case VAR_PARTIAL: {
partial_T *pt = tv->vval.v_partial;
// A partial does not have a copyID, because it cannot contain itself.
if (pt != NULL) {
if (pt != NULL && pt->pt_copyID != copyID) {
// Didn't see this partial yet.
pt->pt_copyID = copyID;
abort = set_ref_in_func(pt->pt_name, pt->pt_func, copyID);
if (pt->pt_dict != NULL) {
typval_T dtv;

View File

@ -364,6 +364,7 @@ struct ufunc {
struct partial_S {
int pt_refcount; ///< Reference count.
int pt_copyID;
char *pt_name; ///< Function name; when NULL use pt_func->name.
ufunc_T *pt_func; ///< Function pointer; when NULL lookup function with pt_name.
bool pt_auto; ///< When true the partial was created by using dict.member