mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 00:20:40 +03:00
[svn r113] Added initial support for associative arrays (AAs).
Fixed some problems with the string runtime support functions. Fixed initialization of array of structs. Fixed slice assignment where LHS is slice but RHS is dynamic array. Fixed problems with result of assignment expressions. Fixed foreach problems with key type mismatches.
This commit is contained in:
parent
a807cbfc91
commit
d51e392b8d
25 changed files with 756 additions and 122 deletions
|
@ -128,8 +128,8 @@ void ExpStatement::toIR(IRState* p)
|
|||
Logger::println("ExpStatement::toIR(%d): %s", esi++, toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// if (global.params.symdebug)
|
||||
// DtoDwarfStopPoint(loc.linnum);
|
||||
if (global.params.symdebug)
|
||||
DtoDwarfStopPoint(loc.linnum);
|
||||
|
||||
if (exp != 0) {
|
||||
elem* e = exp->toElem(p);
|
||||
|
@ -731,6 +731,18 @@ void ForeachStatement::toIR(IRState* p)
|
|||
assert(0 && "aggregate type is not Tarray or Tsarray");
|
||||
}
|
||||
|
||||
if (niters->getType() != keytype)
|
||||
{
|
||||
size_t sz1 = gTargetData->getTypeSize(niters->getType());
|
||||
size_t sz2 = gTargetData->getTypeSize(keytype);
|
||||
if (sz1 < sz2)
|
||||
niters = gIR->ir->CreateZExt(niters, keytype, "foreachtrunckey");
|
||||
else if (sz1 > sz2)
|
||||
niters = gIR->ir->CreateTrunc(niters, keytype, "foreachtrunckey");
|
||||
else
|
||||
niters = gIR->ir->CreateBitCast(niters, keytype, "foreachtrunckey");
|
||||
}
|
||||
|
||||
llvm::Constant* delta = 0;
|
||||
if (op == TOKforeach) {
|
||||
new llvm::StoreInst(zerokey, keyvar, p->scopebb());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue