Future-proof the code to classify static array members of structs.

I made sure to create a merge conflict with the code attached to ticket #229
(which comments this code out due to changes in the DMD 'Type' type hierarchy)
so that if it gets committed as-is there will be a human looking at it.
This commit is contained in:
Frits van Bommel
2009-03-08 01:26:30 +01:00
parent 2687d58198
commit 941ccdfdc3

View File

@@ -153,13 +153,14 @@ namespace {
// the other types that can get bigger than 16 bytes
accum.addField(offset, Memory);
} else if (ty->ty == Tsarray) {
d_uns64 eltsize = ty->next->size();
Type* eltType = ty->nextOf();
d_uns64 eltsize = eltType->size();
if (eltsize > 0) {
d_uns64 dim = ty->size() / eltsize;
assert(dim <= 16
&& "Array of non-empty type <= 16 bytes but > 16 elements?");
for (d_uns64 i = 0; i < dim; i++) {
classifyType(accum, ty->next, offset);
classifyType(accum, eltType, offset);
offset += eltsize;
}
}