diff options
-rw-r--r-- | scope.c | 9 | ||||
-rw-r--r-- | scope.h | 2 |
2 files changed, 11 insertions, 0 deletions
@@ -162,3 +162,12 @@ int is_outer_scope(struct scope *scope) return 1; } +int is_in_scope(struct scope *outer, struct scope *inner) +{ + while (inner != outer) { + if (inner == function_scope) + return 0; + inner = inner->next; + } + return 1; +} @@ -62,4 +62,6 @@ extern void bind_scope(struct symbol *, struct scope *); extern void rebind_scope(struct symbol *, struct scope *); extern int is_outer_scope(struct scope *); +extern int is_in_scope(struct scope *outer, struct scope *inner); + #endif |