diff options
-rw-r--r-- | parse.c | 1 | ||||
-rw-r--r-- | scope.c | 5 | ||||
-rw-r--r-- | scope.h | 1 |
3 files changed, 7 insertions, 0 deletions
@@ -772,6 +772,7 @@ static struct token *struct_union_enum_specifier(enum type type, } sym = alloc_symbol(token->pos, type); + set_current_scope(sym); // used by dissect token = parse(token->next, sym); ctx->ctype.base_type = sym; token = expect(token, '}', "at end of specifier"); @@ -40,6 +40,11 @@ struct scope *block_scope = &builtin_scope, // regular automatic variables etc *file_scope = &builtin_scope, // static *global_scope = &builtin_scope; // externally visible +void set_current_scope(struct symbol *sym) +{ + sym->scope = block_scope; +} + void bind_scope(struct symbol *sym, struct scope *scope) { sym->scope = scope; @@ -53,6 +53,7 @@ extern void end_symbol_scope(void); extern void start_function_scope(void); extern void end_function_scope(void); +extern void set_current_scope(struct symbol *); extern void bind_scope(struct symbol *, struct scope *); extern void rebind_scope(struct symbol *, struct scope *); |