From db59b30eda651a3589efee89743d7eaf0e841632 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Wed, 19 Dec 2012 20:37:16 +0100 Subject: [PATCH] Slight rewrite to make intent cleaner. No functionality change intended, although it might make the last commit unnecessary. --- gen/nested.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/gen/nested.cpp b/gen/nested.cpp index cd41018c..796ef985 100644 --- a/gen/nested.cpp +++ b/gen/nested.cpp @@ -398,23 +398,20 @@ static void DtoCreateNestedContextType(FuncDeclaration* fd) { if (vd->isParameter()) { // Parameters will have storage associated with them (to handle byref etc.), // so handle those cases specially by storing a pointer instead of a value. - IrParameter * irparam = vd->ir.irParam; - LLValue* value = irparam->value; - assert(value); - LLType* type = value->getType(); - bool refout = vd->storage_class & (STCref | STCout); - bool lazy = vd->storage_class & STClazy; - bool byref = irparam->arg->byref; - bool isVthisPtr = irparam->isVthis && !byref; - if ((!refout && (!byref || lazy)) || isVthisPtr) { + const IrParameter* irparam = vd->ir.irParam; + const bool refout = vd->storage_class & (STCref | STCout); + const bool lazy = vd->storage_class & STClazy; + const bool byref = irparam->arg->byref; + const bool isVthisPtr = irparam->isVthis && !byref; + if (!(refout || (byref && !lazy)) || isVthisPtr) { // This will be copied to the nesting frame. if (lazy) - type = type->getContainedType(0); + types.push_back(irparam->value->getType()->getContainedType(0)); else - type = DtoType(vd->type); + types.push_back(DtoType(vd->type)); } else { + types.push_back(irparam->value->getType()); } - types.push_back(type); } else if (isSpecialRefVar(vd)) { types.push_back(DtoType(vd->type->pointerTo())); } else {