aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codegen.c
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-03 20:36:22 +0900
committernsfisis <nsfisis@gmail.com>2025-09-03 20:36:22 +0900
commit980d73ce25b116e645b16e9ed37dcf55fdffad7a (patch)
tree1039ecaa3a98b443a6818d660763051be1f5a54b /src/codegen.c
parent256cbd88c53d15884f3519ce75890c7bd1626cb2 (diff)
downloadducc-980d73ce25b116e645b16e9ed37dcf55fdffad7a.tar.gz
ducc-980d73ce25b116e645b16e9ed37dcf55fdffad7a.tar.zst
ducc-980d73ce25b116e645b16e9ed37dcf55fdffad7a.zip
feat: support native bool/true/false
Diffstat (limited to 'src/codegen.c')
-rw-r--r--src/codegen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 006ae20..a16ae73 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -584,11 +584,11 @@ void codegen(Program* prog, FILE* out) {
for (int i = 0; i < prog->vars->node_len; ++i) {
AstNode* var = prog->vars->node_items + i;
if (var->node_expr) {
- if (var->ty->kind == TypeKind_char)
+ if (type_sizeof(var->ty) == 1)
fprintf(g->out, " %s: .byte %d\n", var->name, var->node_expr->node_int_value);
- else if (var->ty->kind == TypeKind_short)
+ else if (type_sizeof(var->ty) == 2)
fprintf(g->out, " %s: .word %d\n", var->name, var->node_expr->node_int_value);
- else if (var->ty->kind == TypeKind_int)
+ else if (type_sizeof(var->ty) == 4)
fprintf(g->out, " %s: .int %d\n", var->name, var->node_expr->node_int_value);
else
unimplemented();