From 75fc567dfdb4a6500990d79dc3f167d3262a96c5 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Tue, 4 Feb 2020 14:25:48 -0500 Subject: nms . typing and fixing cgen for local namespaces --- scope.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scope.c') 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; -- cgit v1.2.3