diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2022-10-18 03:58:19 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2022-10-18 03:58:19 +0200 |
commit | e471f9e0fb7ade475dd3eb8b230bcb440877ee7e (patch) | |
tree | 5d9c5a23474b9a9464e75cadf3e872042fa9097e /conf/conf.h | |
parent | 324252975004154cc70623c94f05083bff100209 (diff) |
Filter: Fix handling of variables in anonymous filters
Define scope for anonymous filters, and also explicitly distinguish block
scopes and function/filter scopes instead of using anonymous / named
distinction.
Anonymous filters forgot to push scope, so variables for them were in
fact defined in the top scope and therefore they shared a frame. This got
broken after rework of variables, which assumed that there is a named
scope for every function/filter.
Diffstat (limited to 'conf/conf.h')
-rw-r--r-- | conf/conf.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/conf/conf.h b/conf/conf.h index be46f172..96c873df 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -134,6 +134,7 @@ struct sym_scope { struct symbol *name; /* Name of this scope */ uint slots; /* Variable slots */ byte active; /* Currently entered */ + byte block; /* No independent stack frame */ byte soft_scopes; /* Number of soft scopes above */ }; @@ -220,6 +221,12 @@ void cf_pop_scope(void); void cf_push_soft_scope(void); void cf_pop_soft_scope(void); +static inline void cf_push_block_scope(void) +{ cf_push_scope(NULL); conf_this_scope->block = 1; } + +static inline void cf_pop_block_scope(void) +{ ASSERT(conf_this_scope->block); cf_pop_scope(); } + char *cf_symbol_class_name(struct symbol *sym); /* Parser */ |