diff options
| -rw-r--r-- | lib.c | 4 | ||||
| -rw-r--r-- | lib.h | 1 | ||||
| -rw-r--r-- | scope.c | 2 |
3 files changed, 5 insertions, 2 deletions
@@ -17,6 +17,7 @@ #include "parse.h" #include "symbol.h" #include "expression.h" +#include "scope.h" struct token *skip_to(struct token *token, int op) { @@ -146,6 +147,7 @@ struct allocator_struct symbol_allocator = { "symbols", NULL, __alignof__(struct struct allocator_struct expression_allocator = { "expressions", NULL, __alignof__(struct expression), CHUNK }; struct allocator_struct statement_allocator = { "statements", NULL, __alignof__(struct statement), CHUNK }; struct allocator_struct string_allocator = { "strings", NULL, __alignof__(struct statement), CHUNK }; +struct allocator_struct scope_allocator = { "scopes", NULL, __alignof__(struct scope), CHUNK }; struct allocator_struct bytes_allocator = { "bytes", NULL, 1, CHUNK }; #define __ALLOCATOR(type, size, x) \ @@ -165,7 +167,7 @@ struct allocator_struct bytes_allocator = { "bytes", NULL, 1, CHUNK }; ALLOCATOR(ident); ALLOCATOR(token); ALLOCATOR(symbol); ALLOCATOR(expression); ALLOCATOR(statement); ALLOCATOR(string); -__ALLOCATOR(void, 0, bytes); +ALLOCATOR(scope); __ALLOCATOR(void, 0, bytes); int ptr_list_size(struct ptr_list *head) { @@ -45,6 +45,7 @@ DECLARE_ALLOCATOR(symbol); DECLARE_ALLOCATOR(expression); DECLARE_ALLOCATOR(statement); DECLARE_ALLOCATOR(string); +DECLARE_ALLOCATOR(scope); __DECLARE_ALLOCATOR(void, bytes); #define LIST_NODE_NR (29) @@ -28,7 +28,7 @@ void bind_scope(struct symbol *sym, struct scope *scope) static void start_scope(struct scope **s) { - struct scope *scope = __alloc_bytes(sizeof(*scope)); + struct scope *scope = __alloc_scope(0); memset(scope, 0, sizeof(*scope)); scope->next = *s; *s = scope; |
