Slight rewrite to make intent cleaner.

No functionality change intended, although it might make the last
commit unnecessary.
This commit is contained in:
David Nadlinger 2012-12-19 20:37:16 +01:00
parent 9cbfc604c7
commit db59b30eda

View file

@ -398,23 +398,20 @@ static void DtoCreateNestedContextType(FuncDeclaration* fd) {
if (vd->isParameter()) { if (vd->isParameter()) {
// Parameters will have storage associated with them (to handle byref etc.), // Parameters will have storage associated with them (to handle byref etc.),
// so handle those cases specially by storing a pointer instead of a value. // so handle those cases specially by storing a pointer instead of a value.
IrParameter * irparam = vd->ir.irParam; const IrParameter* irparam = vd->ir.irParam;
LLValue* value = irparam->value; const bool refout = vd->storage_class & (STCref | STCout);
assert(value); const bool lazy = vd->storage_class & STClazy;
LLType* type = value->getType(); const bool byref = irparam->arg->byref;
bool refout = vd->storage_class & (STCref | STCout); const bool isVthisPtr = irparam->isVthis && !byref;
bool lazy = vd->storage_class & STClazy; if (!(refout || (byref && !lazy)) || isVthisPtr) {
bool byref = irparam->arg->byref;
bool isVthisPtr = irparam->isVthis && !byref;
if ((!refout && (!byref || lazy)) || isVthisPtr) {
// This will be copied to the nesting frame. // This will be copied to the nesting frame.
if (lazy) if (lazy)
type = type->getContainedType(0); types.push_back(irparam->value->getType()->getContainedType(0));
else else
type = DtoType(vd->type); types.push_back(DtoType(vd->type));
} else { } else {
types.push_back(irparam->value->getType());
} }
types.push_back(type);
} else if (isSpecialRefVar(vd)) { } else if (isSpecialRefVar(vd)) {
types.push_back(DtoType(vd->type->pointerTo())); types.push_back(DtoType(vd->type->pointerTo()));
} else { } else {