summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-02-04 14:25:48 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-02-04 14:25:48 -0500
commit75fc567dfdb4a6500990d79dc3f167d3262a96c5 (patch)
tree868f2db398c9747629e689e48b4bef9fcb84baee /scope.c
parent82990fa60f657861e9f2709d68c971d08e9b513c (diff)
nms . typing and fixing cgen for local namespaces
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/scope.c b/scope.c
index 1b116b7..1f3f687 100644
--- a/scope.c
+++ b/scope.c
@@ -59,6 +59,9 @@ static void remove_ident_decls(Block *b, Declaration *d) {
/* pass NULL for block for global scope */
static bool block_enter(Block *b, Statement *stmts, U16 flags) {
+ if (b && (b->flags & BLOCK_IS_NMS)) /* we only enter namespaces once, when they're created */
+ return true;
+
bool ret = true;
arr_foreach(stmts, Statement, stmt) {
if (stmt->kind == STMT_DECL) {
@@ -71,6 +74,9 @@ static bool block_enter(Block *b, Statement *stmts, U16 flags) {
}
static void block_exit(Block *b, Statement *stmts) {
+ if (b && (b->flags & BLOCK_IS_NMS))
+ return;
+
arr_foreach(stmts, Statement, stmt) {
if (stmt->kind == STMT_DECL) {
Declaration *decl = &stmt->decl;