summaryrefslogtreecommitdiff
path: root/parse/dump.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-02-14 19:56:13 -0500
committerOri Bernstein <ori@eigenstate.org>2014-02-14 19:56:13 -0500
commitabf3f3998139d3bc5bddc6fb90c63aecbcb48165 (patch)
treea49eaf74e274cec62b42374eca82475a5a689dcb /parse/dump.c
parent0c454eb69e126d7180b0a05598de1fac65dc3fd3 (diff)
downloadmc-abf3f3998139d3bc5bddc6fb90c63aecbcb48165.tar.gz
Dump trait nodes for debugging.
Diffstat (limited to 'parse/dump.c')
-rw-r--r--parse/dump.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/parse/dump.c b/parse/dump.c
index c764d62..440ba42 100644
--- a/parse/dump.c
+++ b/parse/dump.c
@@ -115,6 +115,7 @@ static void outnode(Node *n, FILE *fd, int depth)
size_t i;
char *ty;
int tid;
+ char buf[1024];
indent(fd, depth);
if (!n) {
@@ -227,7 +228,11 @@ static void outnode(Node *n, FILE *fd, int depth)
fprintf(fd, ")\n");
break;
case Nimpl:
- die("Impl definition");
+ fprintf(fd, "(name = %s, type = %s)\n", namestr(n->impl.traitname), tyfmt(buf, sizeof buf, n->impl.type));
+ indent(fd, depth);
+ outnode(n->impl.traitname, fd, depth + 1);
+ for (i = 0; i < n->impl.ndecls; i++)
+ outnode(n->impl.decls[i], fd, depth+1);
break;
case Nnone:
fprintf(stderr, "Nnone not a real node type!");