summaryrefslogtreecommitdiff
path: root/cgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'cgen.c')
-rw-r--r--cgen.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cgen.c b/cgen.c
index 2509611..2802886 100644
--- a/cgen.c
+++ b/cgen.c
@@ -68,6 +68,11 @@ static bool cgen_stmt(CGenerator *g, Statement *s);
static bool cgen_decl(CGenerator *g, Declaration *d) {
arr_foreach(&d->idents, Identifier, ident) {
cgen_type_pre(g, &d->type);
+ if (d->flags & DECL_FLAG_CONST) {
+ cgen_write_space(g);
+ cgen_write(g, "const");
+ cgen_write_space(g);
+ }
cgen_ident(g, *ident, NULL);
cgen_type_post(g, &d->type);
if (d->flags & DECL_FLAG_HAS_EXPR) {