[svn r277] Fixed a nasty bug in delegate expressions. Context pointers to nested functions of the parent, from inside a nested function were

invalid.
This commit is contained in:
Tomas Lindquist Olsen
2008-06-13 05:47:28 +02:00
parent 9a28d083f8
commit b13a5646ca
3 changed files with 49 additions and 6 deletions
+5 -6
View File
@@ -2230,13 +2230,12 @@ DValue* DelegateExp::toElem(IRState* p)
DValue* u = e1->toElem(p);
LLValue* uval;
if (DFuncValue* f = u->isFunc()) {
//assert(f->vthis);
//uval = f->vthis;
LLValue* nestvar = p->func()->decl->ir.irFunc->nestedVar;
if (nestvar)
uval = nestvar;
assert(f->func);
LLValue* contextptr = DtoNestedContext(f->func->toParent2()->isFuncDeclaration());
if (!contextptr)
uval = LLConstant::getNullValue(getVoidPtrType());
else
uval = llvm::ConstantPointerNull::get(int8ptrty);
uval = DtoBitCast(contextptr, getVoidPtrType());
}
else {
DValue* src = u;