diff gen/arrays.cpp @ 1643:8f121883bce8

Apply patch from klickverbot. This is his 'proper fix' patch for bug #395.
author Kelly Wilson <wilsonk cpsc.ucalgary.ca>
date Mon, 08 Mar 2010 23:37:40 -0700
parents 0de4525a9ed6
children 40bd4a0d4870
line wrap: on
line diff
--- a/gen/arrays.cpp	Mon Mar 08 23:10:26 2010 -0700
+++ b/gen/arrays.cpp	Mon Mar 08 23:37:40 2010 -0700
@@ -532,23 +532,14 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-void DtoCatAssignElement(Type* arrayType, DValue* array, Expression* exp)
+void DtoCatAssignElement(Loc& loc, Type* arrayType, DValue* array, Expression* exp)
 {
     Logger::println("DtoCatAssignElement");
     LOG_SCOPE;
 
     assert(array);
 
-    DValue *expVal = exp->toElem(gIR);
-    LLValue *valueToAppend;
-    if (expVal->isLVal())
-        valueToAppend = expVal->getLVal();
-    else {
-        valueToAppend = DtoAlloca(expVal->getType(), ".appendingElementOnStack");
-        DVarValue lval(expVal->getType(), valueToAppend);
-        Loc loc;
-        DtoAssign(loc, &lval, expVal);
-    }
+    LLValue *valueToAppend = makeLValue(loc, exp->toElem(gIR));
 
     LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_arrayappendcT");
     LLSmallVector<LLValue*,3> args;