shithub: mc

Download patch

ref: 2c85c3a788e346c0ead8e008f159520376d99340
parent: ee4f263f0c410a8e1061ff704054f8707cb0cb0c
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jul 12 19:42:51 EDT 2015

Correctly dump out global symtabs.

    Somehow during the namespace shuffle, we lost dumping
    namespaces.

--- a/parse/dump.c
+++ b/parse/dump.c
@@ -63,7 +63,7 @@
     /* print types */
     k = htkeys(st->ty, &n);
     for (i = 0; i < n; i++) {
-        findentf(fd, depth, "T ");
+        findentf(fd, depth + 1, "T ");
         /* already indented */
         outname(k[i], fd); 
         t = gettype(st, k[i]);
@@ -79,7 +79,7 @@
     /* dump declarations */
     k = htkeys(st->dcl, &n);
     for (i = 0; i < n; i++) {
-        findentf(fd, depth, "S ");
+        findentf(fd, depth + 1, "S ");
         /* already indented */
         outsym(getdcl(st, k[i]), fd, 0);
     }
@@ -91,6 +91,18 @@
     outstab(st, fd, 0);
 }
 
+void dumpfilestabs(Node *file, int depth, FILE *fd)
+{
+    size_t nk, i;
+    void **k;
+
+    k = htkeys(file->file.ns, &nk);
+    for (i = 0; i < nk; i++) {
+        outstab(htget(file->file.ns, k[i]), fd, depth);
+    }
+    free(k);
+}
+
 /* Outputs a node in indented tree form. This is
  * not a full serialization, but mainly an aid for
  * understanding and debugging. */
@@ -110,8 +122,7 @@
     switch(n->type) {
         case Nfile:
             fprintf(fd, "(name = %s)\n", n->file.files[0]);
-            findentf(fd, depth + 1, "Globls:\n");
-            outstab(n->file.globls, fd, depth + 2);
+            dumpfilestabs(file, depth + 1, fd);
             for (i = 0; i < n->file.nuses; i++)
                 outnode(n->file.uses[i], fd, depth + 1);
             for (i = 0; i < n->file.nstmts; i++)