summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-03-05 11:44:25 -0500
committerOri Bernstein <ori@eigenstate.org>2014-03-05 11:44:25 -0500
commit5207c09ea6510258a90d83f86cc9f9a365bb3d26 (patch)
treef5ae1705fcd4b44c8fa3ff4fd5cb05d2ad7b5a2d /parse
parentbc999872d044b073d9f20bd2278c58ad7811453c (diff)
downloadmc-5207c09ea6510258a90d83f86cc9f9a365bb3d26.tar.gz
Fix error messages and add comments.
Diffstat (limited to 'parse')
-rw-r--r--parse/infer.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/parse/infer.c b/parse/infer.c
index f320f8e..03f54bd 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -799,6 +799,7 @@ static void mergeexports(Inferstate *st, Node *file)
exports = file->file.exports;
globls = file->file.globls;
+ /* export the types */
pushstab(globls);
k = htkeys(exports->ty, &nk);
for (i = 0; i < nk; i++) {
@@ -820,6 +821,7 @@ static void mergeexports(Inferstate *st, Node *file)
}
free(k);
+ /* export the traits */
k = htkeys(exports->tr, &nk);
for (i = 0; i < nk; i++) {
trx = gettrait(exports, k[i]);
@@ -829,20 +831,20 @@ static void mergeexports(Inferstate *st, Node *file)
if (!trg)
puttrait(globls, nx, trx);
else
- fatal(nx->line, "Exported type %s already declared on line %d", namestr(nx), tg->line);
+ fatal(nx->line, "Exported trait %s already declared on line %d", namestr(nx), tg->line);
} else {
trg = gettrait(globls, nx);
if (trg && !trg->isproto) {
*trx = *trg;
} else {
- fatal(nx->line, "Exported type %s not declared", namestr(nx));
+ fatal(nx->line, "Exported trait %s not declared", namestr(nx));
}
}
trx->vis = Visexport;
}
free(k);
-
+ /* export the declarations */
k = htkeys(exports->dcl, &nk);
for (i = 0; i < nk; i++) {
nx = getdcl(exports, k[i]);
@@ -861,6 +863,8 @@ static void mergeexports(Inferstate *st, Node *file)
free(k);
+
+ /* export the union constructors */
k = htkeys(exports->uc, &nk);
for (i = 0; i < nk; i++) {
ux = getucon(exports, k[i]);