-Aggregate *Aggregate::Copy(CYPool &pool, const char *name) const {
- Aggregate *copy(new(pool) Aggregate(overlap, name));
+Enum *Enum::Copy(CYPool &pool, const char *rename) const {
+ if (rename == NULL)
+ rename = pool.strdup(name);
+ else if (rename[0] == '\0')
+ rename = NULL;
+ Enum *copy(new(pool) Enum(*type.Copy(pool), count, rename));
+ copy->constants = new(pool) Constant[count];
+ for (size_t i(0); i != count; ++i) {
+ copy->constants[i].name = pool.strdup(constants[i].name);
+ copy->constants[i].value = constants[i].value;
+ }
+ return Flag(copy);
+}
+
+Aggregate *Aggregate::Copy(CYPool &pool, const char *rename) const {
+ if (rename == NULL)
+ rename = pool.strdup(name);
+ else if (rename[0] == '\0')
+ rename = NULL;
+ Aggregate *copy(new(pool) Aggregate(overlap, rename));