summaryrefslogtreecommitdiff
path: root/parse/dump.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-07-12 23:42:51 -0700
committerOri Bernstein <ori@eigenstate.org>2015-07-12 23:42:51 -0700
commit2c85c3a788e346c0ead8e008f159520376d99340 (patch)
tree6e768daee849c8b1b00231c3929b4b7fd62f282d /parse/dump.c
parentee4f263f0c410a8e1061ff704054f8707cb0cb0c (diff)
downloadmc-2c85c3a788e346c0ead8e008f159520376d99340.tar.gz
Correctly dump out global symtabs.
Somehow during the namespace shuffle, we lost dumping namespaces.
Diffstat (limited to 'parse/dump.c')
-rw-r--r--parse/dump.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/parse/dump.c b/parse/dump.c
index b50c406..7080f76 100644
--- a/parse/dump.c
+++ b/parse/dump.c
@@ -63,7 +63,7 @@ static void outstab(Stab *st, FILE *fd, int depth)
/* 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 @@ static void outstab(Stab *st, FILE *fd, int depth)
/* 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 @@ void dumpstab(Stab *st, FILE *fd)
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 @@ static void outnode(Node *n, FILE *fd, int depth)
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++)