diff src/structs.h @ 22596:107eae953b87 v8.2.1846

patch 8.2.1846: Vim9: block variables are not found in compiled function Commit: https://github.com/vim/vim/commit/fbbcd00367e1a4fafd047d42ffce0e5dce88925c Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 15 12:46:44 2020 +0200 patch 8.2.1846: Vim9: block variables are not found in compiled function Problem: Vim9: variables declared in a local block are not found in when a function is compiled. Solution: Look for script variables in sn_all_vars.
author Bram Moolenaar <Bram@vim.org>
date Thu, 15 Oct 2020 13:00:05 +0200
parents 209c7aa56325
children 71b57779177d
line wrap: on
line diff
--- a/src/structs.h
+++ b/src/structs.h
@@ -1582,6 +1582,8 @@ typedef struct
     char_u	*uf_va_name;	// name from "...name" or NULL
     type_T	*uf_va_type;	// type from "...name: type" or NULL
     type_T	*uf_func_type;	// type of the function, &t_func_any if unknown
+    int		uf_block_depth;	// nr of entries in uf_block_ids
+    int		*uf_block_ids;	// blocks a :def function is defined inside
 # if defined(FEAT_LUA)
     cfunc_T     uf_cb;		// callback function for cfunc
     cfunc_free_T uf_cb_free;    // callback function to free cfunc
@@ -1792,7 +1794,8 @@ typedef struct
 
     garray_T	sn_imports;	// imported items, imported_T
     garray_T	sn_type_list;	// keeps types used by variables
-    int		sn_current_block_id;  // Unique ID for each script block
+    int		sn_current_block_id; // ID for current block, 0 for outer
+    int		sn_last_block_id;  // Unique ID for each script block
 
     int		sn_version;	// :scriptversion
     int		sn_had_command;	// TRUE if any command was executed