aboutsummaryrefslogtreecommitdiff
path: root/src/debug.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-08-14 18:59:45 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-08-14 18:59:45 +0300
commitcb8ec6419e76899d91c068c4835a477c01063450 (patch)
treec2815da3824b516831d96a56fc6b9ae427b230c7 /src/debug.c
parent852ff838af56ef3668ff94c27b0140869dcb7359 (diff)
downloadek-cb8ec6419e76899d91c068c4835a477c01063450.tar.gz
ek-cb8ec6419e76899d91c068c4835a477c01063450.zip
print whole type list
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/debug.c b/src/debug.c
index 92d85d2..2db23a9 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -234,6 +234,22 @@ static void _type_list_str(FILE *fp, struct type *types)
}
}
+static void _param_str(FILE *fp, struct ast *params)
+{
+ if (!params)
+ return;
+
+ assert(params->k == AST_VAR_DEF);
+ _type_str(fp, var_type(params));
+
+ params = params->n;
+ foreach_node(n, params) {
+ assert(n->k == AST_VAR_DEF);
+ fprintf(fp, ", ");
+ _type_str(fp, var_type(n));
+ }
+}
+
/**
* Workhorse for type_str().
*
@@ -266,16 +282,26 @@ static void _type_str(FILE *fp, struct type *type)
if (trait_id(def)) {
fprintf(fp, "%s ", trait_id(def));
}
- fprintf(fp, "(trait)");
+
+ if (struct_params(def)) {
+ fprintf(fp, "![");
+ _param_str(fp, trait_params(def));
+ fprintf(fp, "]");
+ }
break;
}
case TYPE_STRUCT: {
struct ast *def = type->d;
if (struct_id(def)) {
- fprintf(fp, "%s ", struct_id(def));
+ fprintf(fp, "%s", struct_id(def));
+ }
+
+ if (struct_params(def)) {
+ fprintf(fp, "![");
+ _param_str(fp, struct_params(def));
+ fprintf(fp, "]");
}
- fprintf(fp, "(struct)");
break;
}