summaryrefslogtreecommitdiff
path: root/parse/dump.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-09-24 21:39:40 -0700
committerOri Bernstein <ori@eigenstate.org>2015-09-24 21:39:40 -0700
commit53bc10145695df7160e374bca21f4a9510e3fd7d (patch)
tree29664e4d29cc97b31f4ddb4de07648cef017b2b6 /parse/dump.c
parent0b58f43116b059473c24999e488f6471123dcdf8 (diff)
downloadmc-53bc10145695df7160e374bca21f4a9510e3fd7d.tar.gz
Capture and dump function environments in parse.
We can now dump the closure of a function correctly. We still don't compile it, though.
Diffstat (limited to 'parse/dump.c')
-rw-r--r--parse/dump.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/parse/dump.c b/parse/dump.c
index 7080f76..39d4ae5 100644
--- a/parse/dump.c
+++ b/parse/dump.c
@@ -84,6 +84,17 @@ static void outstab(Stab *st, FILE *fd, int depth)
outsym(getdcl(st, k[i]), fd, 0);
}
free(k);
+
+ /* dump closure */
+ if (st->closure) {
+ k = htkeys(st->closure, &n);
+ for (i = 0; i < n; i++) {
+ findentf(fd, depth + 1, "U ");
+ /* already indented */
+ outsym(getdcl(st, k[i]), fd, 0);
+ }
+ free(k);
+ }
}
void dumpstab(Stab *st, FILE *fd)