ref: 3b80bdf127a0e3d1551a4393008f702ca022f2b3
parent: 9c1dd3355d31004cc2875f1ed055372e9b8b6d50
author: Ori Bernstein <[email protected]>
date: Fri Apr 5 16:48:20 EDT 2013
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.
--- a/parse/use.c
+++ b/parse/use.c
@@ -39,8 +39,9 @@
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 @@
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;