From 0a2322c338093affdbca8c5ad6f038a54d79a5e5 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sun, 2 Feb 2020 22:33:56 -0500 Subject: more namespaces --- cgen.c | 5 +++-- decls_cgen.c | 2 -- sdecls_cgen.c | 2 -- types.h | 3 --- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/cgen.c b/cgen.c index c5be2d5..b37d432 100644 --- a/cgen.c +++ b/cgen.c @@ -199,6 +199,9 @@ static bool cgen_defs_decl(CGenerator *g, Declaration *d); static bool cgen_block_enter(CGenerator *g, Block *b) { g->block = b; + if (b->flags & BLOCK_IS_NMS) { + return true; + } Statement *stmts; if (b == NULL) { stmts = g->file->stmts; @@ -2069,8 +2072,6 @@ static bool cgen_stmt(CGenerator *g, Statement *s) { } static bool cgen_defs_fn(CGenerator *g, FnExpr *f, Type *t) { - if (f->c.defined) return true; - f->c.defined = true; FnType *fn_type = &t->fn; bool any_const = false; if (fn_type->constness) { diff --git a/decls_cgen.c b/decls_cgen.c index a9cbdf3..f815c13 100644 --- a/decls_cgen.c +++ b/decls_cgen.c @@ -76,8 +76,6 @@ static bool cgen_decls_fn_instances(CGenerator *g, FnExpr *f) { static bool cgen_fn_decl(CGenerator *g, FnExpr *f, Type *t) { FnType *fn_type = &t->fn; - if (f->c.declared) return true; - f->c.declared = true; if (fn_type->constness) { if (!cgen_decls_fn_instances(g, f)) return false; diff --git a/sdecls_cgen.c b/sdecls_cgen.c index 049d6a7..3a35087 100644 --- a/sdecls_cgen.c +++ b/sdecls_cgen.c @@ -57,8 +57,6 @@ static bool cgen_sdecls_expr(CGenerator *g, Expression *e) { case EXPR_FN: /* needs to go before decls_cgen.c... */ e->fn->c.id = ++g->ident_counter; - e->fn->c.declared = false; - e->fn->c.defined = false; break; case EXPR_TYPE: if (!cgen_sdecls_type(g, &e->typeval)) diff --git a/types.h b/types.h index 78d4b42..ba972a5 100644 --- a/types.h +++ b/types.h @@ -631,9 +631,6 @@ typedef struct FnExpr { /* if name = NULL, this is an anonymous function, and id will be the ID of the fn. */ Identifier name; IdentID id; - /* needed for imported templates atm */ - bool declared; - bool defined; } c; U8 flags; } FnExpr; /* an expression such as fn(x: int) int { 2 * x } */ -- cgit v1.2.3