summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-04-05 20:48:20 -0400
committerOri Bernstein <ori@eigenstate.org>2013-04-05 20:48:20 -0400
commit3b80bdf127a0e3d1551a4393008f702ca022f2b3 (patch)
treea0b09b0739e9d02dd242de85dca28d4d1269f516
parent9c1dd3355d31004cc2875f1ed055372e9b8b6d50 (diff)
downloadmc-3b80bdf127a0e3d1551a4393008f702ca022f2b3.tar.gz
Install union constructors when loading types.
Union constructors are parts of union types that need to appear in the global namespace. This change puts them there.
-rw-r--r--parse/use.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/parse/use.c b/parse/use.c
index e17ae0d..4b2226a 100644
--- a/parse/use.c
+++ b/parse/use.c
@@ -39,8 +39,9 @@ int loaduse(FILE *f, Stab *st)
char *pkg;
Stab *s;
Node *dcl;
- Type *t;
+ Type *t, *u;
int c;
+ size_t i;
if (fgetc(f) != 'U')
return 0;
@@ -72,6 +73,12 @@ int loaduse(FILE *f, Stab *st)
t = tyunpickle(f);
assert(t->type == Tyname || t->type == Tygeneric);
puttype(s, t->name, t);
+ u = tybase(t);
+ if (u->type == Tyunion) {
+ for (i = 0; i < u->nmemb; i++)
+ putucon(s, u->udecls[i]);
+ }
+
break;
case EOF:
break;