shithub: mc

Download patch

ref: 11752f28b4f0630ee461631196e2ebdefa803a82
parent: 971178af3859fd85f7d02dff3b301730061d82a8
author: Ori Bernstein <[email protected]>
date: Thu May 30 04:52:32 EDT 2013

unbreak union constructors.

    We weren't reading the types and adding them to the namespace.

--- a/parse/use.c
+++ b/parse/use.c
@@ -117,9 +117,9 @@
     line = rdint(fd);
     id = rdint(fd);
     name = unpickle(fd);
-    if (rdbool(fd))
-      rdtype(fd, &et);
     uc = mkucon(line, name, ut, et);
+    if (rdbool(fd))
+      rdtype(fd, &uc->etype);
     uc->id = id;
     return uc;
 }
@@ -589,11 +589,12 @@
  */
 int loaduse(FILE *f, Stab *st)
 {
+    intptr_t tid;
+    size_t i;
     char *pkg;
-    Stab *s;
     Node *dcl;
+    Stab *s;
     Type *t;
-    intptr_t tid;
     int c;
 
     if (fgetc(f) != 'U')
@@ -631,13 +632,10 @@
                 if (t->type == Tyname || t->type == Tygeneric)
                     if (!gettype(s, t->name))
                         puttype(s, t->name, t);
-                /*
-                u = tybase(t);
-                if (u->type == Tyunion)  {
-                    for (i = 0; i < u->nmemb; i++)
-                        putucon(s, u->udecls[i]);
+                if (t->type == Tyunion)  {
+                    for (i = 0; i < t->nmemb; i++)
+                        putucon(s, t->udecls[i]);
                 }
-                */
                 break;
             case EOF:
                 break;