summaryrefslogtreecommitdiff
path: root/base_cgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'base_cgen.c')
-rw-r--r--base_cgen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/base_cgen.c b/base_cgen.c
index 8ac73e5..4c8cb72 100644
--- a/base_cgen.c
+++ b/base_cgen.c
@@ -107,7 +107,7 @@ static bool cgen_ident(CGenerator *g, Identifier i, Location *where) {
return false;
}
Declaration *decl = id_decl->decl;
- if (decl->flags & DECL_FLAG_HAS_EXPR) {
+ if ((decl->flags & DECL_FLAG_HAS_EXPR) && (decl->flags & DECL_FLAG_CONST)) {
if (decl->expr.kind == EXPR_FN) {
cgen_fn_name(g, &decl->expr.fn, NULL);
return true;
@@ -196,7 +196,7 @@ static bool cgen_type_post(CGenerator *g, Type *t) {
}
static bool cgen_fn_name(CGenerator *g, FnExpr *f, Location *where) {
- if (f->name && g->block == NULL) {
+ if (f->name) {
if (ident_eq_str(f->name, "main"))
cgen_write(g, "main__");
else