summaryrefslogtreecommitdiff
path: root/src/structs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/structs.h')
-rw-r--r--src/structs.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/structs.h b/src/structs.h
index c532dde44..e46446d4d 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -2108,6 +2108,9 @@ struct loopvars_S
int lvs_copyID; // for garbage collection
};
+// maximum nesting of :while and :for loops in a :def function
+#define MAX_LOOP_DEPTH 10
+
typedef struct outer_S outer_T;
struct outer_S {
garray_T *out_stack; // stack from outer scope, or a copy
@@ -2116,11 +2119,13 @@ struct outer_S {
outer_T *out_up; // outer scope of outer scope or NULL
partial_T *out_up_partial; // partial owning out_up or NULL
- garray_T *out_loop_stack; // stack from outer scope, or a copy
+ struct {
+ garray_T *stack; // stack from outer scope, or a copy
// containing only vars inside the loop
- short out_loop_var_idx; // first variable defined in a loop
- // in out_loop_stack
- short out_loop_var_count; // number of variables defined in a loop
+ short var_idx; // first variable defined in a loop in
+ // out_loop_stack
+ short var_count; // number of variables defined in a loop
+ } out_loop[MAX_LOOP_DEPTH];
};
struct partial_S
@@ -2141,7 +2146,8 @@ struct partial_S
funcstack_T *pt_funcstack; // copy of stack, used after context
// function returns
- loopvars_T *pt_loopvars; // copy of loop variables, used after loop
+ loopvars_T *(pt_loopvars[MAX_LOOP_DEPTH]);
+ // copy of loop variables, used after loop
// block ends
typval_T *pt_argv; // arguments in allocated array
@@ -2151,6 +2157,14 @@ struct partial_S
dict_T *pt_dict; // dict for "self"
};
+typedef struct {
+ short lvi_depth; // current nested loop depth
+ struct {
+ short var_idx; // index of first variable inside loop
+ short var_count; // number of variables inside loop
+ } lvi_loop[MAX_LOOP_DEPTH];
+} loopvarinfo_T;
+
typedef struct AutoPatCmd_S AutoPatCmd_T;
/*