comparison dmd/constfold.c @ 336:aaade6ded589 trunk

[svn r357] Merged DMD 1.033
author lindquist
date Sat, 12 Jul 2008 19:38:31 +0200
parents 2b72433d5c8c
children 29dc68c949b0
comparison
equal deleted inserted replaced
335:17b844102023 336:aaade6ded589
1423 e->type = e->type->semantic(loc, NULL); 1423 e->type = e->type->semantic(loc, NULL);
1424 } 1424 }
1425 else 1425 else
1426 e->type = type; 1426 e->type = type;
1427 } 1427 }
1428 else if (e1->op == TOKarrayliteral && 1428 else if ((e1->op == TOKarrayliteral || e1->op == TOKnull) &&
1429 e1->type->toBasetype()->nextOf()->equals(e2->type)) 1429 e1->type->toBasetype()->nextOf()->equals(e2->type))
1430 { 1430 {
1431 ArrayLiteralExp *es1 = (ArrayLiteralExp *)e1; 1431 ArrayLiteralExp *es1;
1432 1432 if (e1->op == TOKarrayliteral)
1433 es1 = new ArrayLiteralExp(es1->loc, (Expressions *)es1->elements->copy()); 1433 { es1 = (ArrayLiteralExp *)e1;
1434 es1->elements->push(e2); 1434 es1 = new ArrayLiteralExp(es1->loc, (Expressions *)es1->elements->copy());
1435 es1->elements->push(e2);
1436 }
1437 else
1438 {
1439 es1 = new ArrayLiteralExp(e1->loc, e2);
1440 }
1435 e = es1; 1441 e = es1;
1436 1442
1437 if (type->toBasetype()->ty == Tsarray) 1443 if (type->toBasetype()->ty == Tsarray)
1438 { 1444 {
1439 e->type = new TypeSArray(e2->type, new IntegerExp(0, es1->elements->dim, Type::tindex)); 1445 e->type = new TypeSArray(e2->type, new IntegerExp(0, es1->elements->dim, Type::tindex));