commit 42fe38fae1971ee8c5292f5d953f0d23811d928c
parent dfb6a9caec6f2810a4431e521f29a0fae581c574
Author: Armin Weigl <tb46305@gmail.com>
Date: Wed, 3 Aug 2022 19:32:47 +0200
emit_const: implement tagged unions
Signed-off-by: Armin Weigl <tb46305@gmail.com>
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/typedef.c b/src/typedef.c
@@ -138,17 +138,21 @@ emit_const(const struct expression *expr, FILE *out)
free(ident);
break;
}
- case STORAGE_ALIAS:
+ case STORAGE_TAGGED:
+ emit_const(expr->constant.tagged.value, out);
+ fprintf(out, ": ");
+ emit_type(expr->constant.tagged.tag, out);
+ break;
case STORAGE_ARRAY:
case STORAGE_SLICE:
case STORAGE_STRUCT:
case STORAGE_TUPLE:
case STORAGE_UNION:
assert(0); // TODO
+ case STORAGE_ALIAS:
case STORAGE_CHAR:
case STORAGE_FUNCTION:
case STORAGE_POINTER:
- case STORAGE_TAGGED:
case STORAGE_VALIST:
assert(0); // Invariant
}