summaryrefslogtreecommitdiffstats
path: root/src/vim9.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-12-24 21:56:41 +0100
committerBram Moolenaar <Bram@vim.org>2020-12-24 21:56:41 +0100
commit4aab88d919168ce2ddf4845482f4cff9efa52b5b (patch)
tree04a73eecb83ace36a383230c41be60813dc26ba8 /src/vim9.h
parent38455a921395a56690790c8c1d28c1c43ca04c8a (diff)
patch 8.2.2208: Vim9: after reloading a script variable index may be invalidv8.2.2208
Problem: Vim9: after reloading a script variable index may be invalid. Solution: When the sequence number doesn't match give an error for using a script-local variable from a compiled function. (closes #7547)
Diffstat (limited to 'src/vim9.h')
-rw-r--r--src/vim9.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/vim9.h b/src/vim9.h
index 9048d23ca0..2752aa8014 100644
--- a/src/vim9.h
+++ b/src/vim9.h
@@ -244,8 +244,13 @@ typedef struct {
// arguments to ISN_LOADSCRIPT and ISN_STORESCRIPT
typedef struct {
- int script_sid; // script ID
- int script_idx; // index in sn_var_vals
+ int sref_sid; // script ID
+ int sref_idx; // index in sn_var_vals
+ int sref_seq; // sn_script_seq when compiled
+} scriptref_T;
+
+typedef struct {
+ scriptref_T *scriptref;
} script_T;
// arguments to ISN_UNLET
@@ -345,6 +350,8 @@ struct dfunc_S {
int df_idx; // index in def_functions
int df_deleted; // if TRUE function was deleted
char_u *df_name; // name used for error messages
+ int df_script_seq; // Value of sctx_T sc_seq when the function
+ // was compiled.
garray_T df_def_args_isn; // default argument instructions
isn_T *df_instr; // function body to be executed