aboutsummaryrefslogtreecommitdiff
path: root/src/debug.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-04-03 16:00:34 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-04-03 16:00:34 +0300
commit2ca159fb5c2a52f33c499eef1fa50a98a863b0f0 (patch)
treec9497ad8372a047bcff366c189c8969ed84f0406 /src/debug.c
parent4642bedb436981e92e3312f06bfcb2eb34074596 (diff)
downloadek-2ca159fb5c2a52f33c499eef1fa50a98a863b0f0.tar.gz
ek-2ca159fb5c2a52f33c499eef1fa50a98a863b0f0.zip
initial union testing
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/debug.c b/src/debug.c
index b929876..f850973 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -210,10 +210,32 @@ static void _type_str(FILE *fp, struct ast_node *type)
break;
}
+ case AST_TYPE_UNION: {
+ struct ast_node *unio_id = type->_type.unio.id;
+ fprintf(fp, "%s", unio_id->_id.id);
+
+ struct ast_node *impls = type->_type.unio.impls;
+ if (impls) {
+ fprintf(fp, "(");
+ while (impls) {
+ _type_str(fp, impls);
+ impls = impls->next;
+ if (impls)
+ fprintf(fp, ", ");
+ }
+ fprintf(fp, ")");
+ }
+ break;
+ }
+
case AST_TYPE_TYPEOF: {
_type_str(fp, type->_type.typeo.actual);
fprintf(fp, " (typeof)");
+ break;
}
+
+ default:
+ fprintf(fp, "NOT YET IMPLEMENTED");
}
_type_str(fp, type->_type.next);