diff src/eval.c @ 20295:bc2c9ea94ec1 v8.2.0703

patch 8.2.0703: Vim9: closure cannot store value in outer context Commit: https://github.com/vim/vim/commit/b68b346e6db6d3f848e0a89905fcd7777b73c5d8 Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 6 21:06:30 2020 +0200 patch 8.2.0703: Vim9: closure cannot store value in outer context Problem: Vim9: closure cannot store value in outer context. Solution: Make storing value in outer context work. Make :disassemble accept a function reference.
author Bram Moolenaar <Bram@vim.org>
date Wed, 06 May 2020 21:15:04 +0200
parents 683c2da4982b
children 4c317d8c1051
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -4337,9 +4337,11 @@ set_ref_in_item(
 	partial_T	*pt = tv->vval.v_partial;
 	int		i;
 
-	// 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)