From a75b08bc0043d3dc16033eaf5b7fbb9aecdb4945 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 13 Sep 2011 20:09:33 +0400 Subject: [PATCH] Fixed accessing struct members via alias this --- gen/functions.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gen/functions.cpp b/gen/functions.cpp index 669a3ee1..49d066c5 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -705,12 +705,12 @@ void DtoDefineFunction(FuncDeclaration* fd) LLValue* thisvar = irfunction->thisArg; assert(thisvar); - LLValue* thismem = DtoRawAlloca(thisvar->getType(), 0, "this"); // FIXME: align? - DtoStore(thisvar, thismem); - if (f->fty.is_arg_this_ref) - irfunction->thisArg = DtoLoad(thismem, "thisRef"); - else + LLValue* thismem = thisvar; + if (!f->fty.is_arg_this_ref) { + thismem = DtoRawAlloca(thisvar->getType(), 0, "this"); // FIXME: align? + DtoStore(thisvar, thismem); irfunction->thisArg = thismem; + } assert(!fd->vthis->ir.irLocal); fd->vthis->ir.irLocal = new IrLocal(fd->vthis);