diff src/structs.h @ 23559:64dfb69e7d46 v8.2.2322

patch 8.2.2322: Vim9: closure nested limiting to one level Commit: https://github.com/vim/vim/commit/0186e58639b19933d3d9188d552fe6745265eb1b Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 10 18:33:11 2021 +0100 patch 8.2.2322: Vim9: closure nested limiting to one level Problem: Vim9: closure nested limiting to one level. Solution: Add outer_T. Also make STOREOUTER work.
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 Jan 2021 18:45:04 +0100
parents f50ee1ae4d9b
children 85ce241ff9e3
line wrap: on
line diff
--- a/src/structs.h
+++ b/src/structs.h
@@ -1965,6 +1965,14 @@ typedef struct funcstack_S
     int		fs_copyID;	// for garray_T collection
 } funcstack_T;
 
+typedef struct outer_S outer_T;
+struct outer_S {
+    garray_T	*out_stack;	    // stack from outer scope
+    int		out_frame_idx;	    // index of stack frame in out_stack
+    outer_T	*out_up;	    // outer scope of outer scope or NULL
+    int		out_up_is_copy;	    // don't free out_up
+};
+
 struct partial_S
 {
     int		pt_refcount;	// reference count
@@ -1975,13 +1983,11 @@ struct partial_S
     int		pt_auto;	// when TRUE the partial was created for using
 				// dict.member in handle_subscript()
 
-    // For a compiled closure: the arguments and local variables.
-    garray_T	*pt_ectx_stack;	    // where to find local vars
-    int		pt_ectx_frame;	    // index of function frame in uf_ectx_stack
-    garray_T	*pt_outer_stack;    // pt_ectx_stack one level up
-    int		pt_outer_frame;	    // pt_ectx_frame one level up.
-    funcstack_T	*pt_funcstack;	    // copy of stack, used after context
-				    // function returns
+    // For a compiled closure: the arguments and local variables scope
+    outer_T	pt_outer;
+
+    funcstack_T	*pt_funcstack;	// copy of stack, used after context
+				// function returns
 
     int		pt_argc;	// number of arguments
     typval_T	*pt_argv;	// arguments in allocated array