shithub: mc

Download patch

ref: abf3f3998139d3bc5bddc6fb90c63aecbcb48165
parent: 0c454eb69e126d7180b0a05598de1fac65dc3fd3
author: Ori Bernstein <[email protected]>
date: Fri Feb 14 14:56:13 EST 2014

Dump trait nodes for debugging.

--- a/parse/dump.c
+++ b/parse/dump.c
@@ -115,6 +115,7 @@
     size_t i;
     char *ty;
     int tid;
+    char buf[1024];
 
     indent(fd, depth);
     if (!n) {
@@ -227,7 +228,11 @@
             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!");