Skip to content

Commit

Permalink
Support nested static array literal construction in ExpressionsToStat…
Browse files Browse the repository at this point in the history
…icArray
  • Loading branch information
9rnsr committed Sep 4, 2015
1 parent 28a6a51 commit 6c38d9e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/e2ir.c
Expand Up @@ -5134,6 +5134,18 @@ elem *toElem(Expression *e, IRState *irs)
for (size_t i = 0; i < dim; i++)
{
Expression *el = (*exps)[i];
if (el->op == TOKarrayliteral &&
el->type->toBasetype()->ty == Tsarray)
{
ArrayLiteralExp *ale = (ArrayLiteralExp *)el;
if (ale->elements && ale->elements->dim)
{
elem *ex = ExpressionsToStaticArray(
ale->loc, ale->elements, &stmp, offset + i * szelem);
e = el_combine(e, ex);
}
continue;
}

/* Generate: *(&stmp + i * szelem) = element[i]
*/
Expand Down

0 comments on commit 6c38d9e

Please sign in to comment.