aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-08-14 19:06:16 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-08-14 19:06:16 +0300
commit1a56a881bc2c37614cfd074e7b986211c6d04809 (patch)
tree0b1b327d90439cca9ee93adca66c69c4a9b45166
parentcb8ec6419e76899d91c068c4835a477c01063450 (diff)
downloadek-1a56a881bc2c37614cfd074e7b986211c6d04809.tar.gz
ek-1a56a881bc2c37614cfd074e7b986211c6d04809.zip
print out aliases as well
-rw-r--r--src/debug.c6
-rw-r--r--tests/alias.ek9
2 files changed, 15 insertions, 0 deletions
diff --git a/src/debug.c b/src/debug.c
index 2db23a9..e90f1ee 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -261,6 +261,9 @@ static void _type_str(FILE *fp, struct type *type)
if (!type)
return;
+ if (type->a)
+ fprintf(fp, "[%s = ", alias_id(type->a));
+
switch (type->k) {
case TYPE_VOID: {
fprintf(fp, "void");
@@ -320,6 +323,9 @@ static void _type_str(FILE *fp, struct type *type)
else
fprintf(fp, "UNKNOWN TYPE");
}
+
+ if (type->a)
+ fputc(']', fp);
}
char *type_str(struct type *t)
diff --git a/tests/alias.ek b/tests/alias.ek
new file mode 100644
index 0000000..c6a26d6
--- /dev/null
+++ b/tests/alias.ek
@@ -0,0 +1,9 @@
+typedef i27 {}
+typedef i9 {}
+
+typedef int i27;
+
+main()
+{
+ int a = 10 as i9;
+}