Lines Matching refs:scope
34 #include "scope.h"
36 static struct scope builtin_scope = { .next = &builtin_scope };
38 struct scope *block_scope = &builtin_scope, // regular automatic variables etc
46 sym->scope = block_scope;
49 void bind_scope(struct symbol *sym, struct scope *scope)
51 sym->scope = scope;
52 add_symbol(&scope->symbols, sym);
56 void rebind_scope(struct symbol *sym, struct scope *new)
58 struct scope *old = sym->scope;
69 static void start_scope(struct scope **s)
71 struct scope *scope = __alloc_scope(0);
72 scope->next = *s;
73 *s = scope;
78 struct scope *scope = __alloc_scope(0);
80 scope->next = &builtin_scope;
81 file_scope = scope;
83 /* top-level stuff defaults to file scope, "extern" etc will choose global scope */
84 function_scope = scope;
85 block_scope = scope;
109 static void end_scope(struct scope **s)
111 struct scope *scope = *s;
112 struct symbol_list *symbols = scope->symbols;
115 *s = scope->next;
116 scope->symbols = NULL;
166 int is_outer_scope(struct scope *scope)
168 if (scope == block_scope)
170 if (scope == &builtin_scope && block_scope->next == &builtin_scope)
175 int is_in_scope(struct scope *outer, struct scope *inner)