Refactor struct initializers codegen.

This not only reduces code duplication, but the unification
also enables code a la StructLiteralExp to handle classes
(for CTFE class constant support in 2.063).
This commit is contained in:
David Nadlinger
2013-06-12 15:36:15 +02:00
parent 2cebe6408c
commit 9a016a1002
7 changed files with 280 additions and 417 deletions

View File

@@ -91,6 +91,9 @@ IrTypeStruct* IrTypeStruct::get(StructDeclaration* sd)
if (sd->sizeok != 1)
return t;
// TODO:: Somehow merge this with IrAggr::createInitializerConstant, or
// replace it by just taking the type of the default initializer.
// mirror the sd->fields array but only fill in contributors
size_t n = sd->fields.dim;
LLSmallVector<VarDeclaration*, 16> data(n, NULL);