Fix array append with dollar op

This commit is contained in:
Alexey Prokhin
2011-07-19 10:14:12 +04:00
parent 4210f4285a
commit aef7e0ee36

View File

@@ -734,6 +734,10 @@ void DtoCatAssignElement(Loc& loc, Type* arrayType, DValue* array, Expression* e
LLValue *oldLength = DtoArrayLen(array);
// Do not move exp->toElem call after creating _d_arrayappendcTX,
// otherwise a ~= a[$-i] won't work correctly
DValue *expVal = exp->toElem(gIR);
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_arrayappendcTX");
LLSmallVector<LLValue*,3> args;
args.push_back(DtoTypeInfoOf(arrayType));
@@ -746,7 +750,7 @@ void DtoCatAssignElement(Loc& loc, Type* arrayType, DValue* array, Expression* e
LLValue* val = DtoExtractValue(appendedArray, 1, ".ptr");
val = DtoGEP1(val, oldLength, "lastElem");
val = DtoBitCast(val, DtoType(arrayType->nextOf()->pointerTo()));
DtoAssign(loc, new DVarValue(arrayType->nextOf(), val), exp->toElem(gIR));
DtoAssign(loc, new DVarValue(arrayType->nextOf(), val), expVal);
}
#else