shithub: mc

Download patch

ref: 5207c09ea6510258a90d83f86cc9f9a365bb3d26
parent: bc999872d044b073d9f20bd2278c58ad7811453c
author: Ori Bernstein <[email protected]>
date: Wed Mar 5 06:44:25 EST 2014

Fix error messages and add comments.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -799,6 +799,7 @@
     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 @@
     }
     free(k);
 
+    /* export the traits */
     k = htkeys(exports->tr, &nk);
     for (i = 0; i < nk; i++) {
         trx = gettrait(exports, k[i]);
@@ -829,13 +831,13 @@
             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;
@@ -842,7 +844,7 @@
     }
     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 @@
     free(k);
 
 
+
+    /* export the union constructors */
     k = htkeys(exports->uc, &nk);
     for (i = 0; i < nk; i++) {
         ux = getucon(exports, k[i]);