diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-02-02 22:33:56 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-02-02 22:33:56 -0500 |
commit | 0a2322c338093affdbca8c5ad6f038a54d79a5e5 (patch) | |
tree | b66eec06b9846148da4807bb8089e8bac255b523 | |
parent | ae47cf5b2c8991e21f0445a34f6960afa3f25e4e (diff) |
more namespaces
-rw-r--r-- | cgen.c | 5 | ||||
-rw-r--r-- | decls_cgen.c | 2 | ||||
-rw-r--r-- | sdecls_cgen.c | 2 | ||||
-rw-r--r-- | types.h | 3 |
4 files changed, 3 insertions, 9 deletions
@@ -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)) @@ -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 } */ |