Mercurial > projects > ldc
comparison gen/toir.cpp @ 259:2e652b8ad1fd trunk
[svn r277] Fixed a nasty bug in delegate expressions. Context pointers to nested functions of the parent, from inside a nested function were
invalid.
author | lindquist |
---|---|
date | Fri, 13 Jun 2008 05:47:28 +0200 |
parents | 8dbddae09152 |
children | 88252a1af660 |
comparison
equal
deleted
inserted
replaced
258:8dbddae09152 | 259:2e652b8ad1fd |
---|---|
2228 } | 2228 } |
2229 | 2229 |
2230 DValue* u = e1->toElem(p); | 2230 DValue* u = e1->toElem(p); |
2231 LLValue* uval; | 2231 LLValue* uval; |
2232 if (DFuncValue* f = u->isFunc()) { | 2232 if (DFuncValue* f = u->isFunc()) { |
2233 //assert(f->vthis); | 2233 assert(f->func); |
2234 //uval = f->vthis; | 2234 LLValue* contextptr = DtoNestedContext(f->func->toParent2()->isFuncDeclaration()); |
2235 LLValue* nestvar = p->func()->decl->ir.irFunc->nestedVar; | 2235 if (!contextptr) |
2236 if (nestvar) | 2236 uval = LLConstant::getNullValue(getVoidPtrType()); |
2237 uval = nestvar; | |
2238 else | 2237 else |
2239 uval = llvm::ConstantPointerNull::get(int8ptrty); | 2238 uval = DtoBitCast(contextptr, getVoidPtrType()); |
2240 } | 2239 } |
2241 else { | 2240 else { |
2242 DValue* src = u; | 2241 DValue* src = u; |
2243 if (ClassDeclaration* cd = u->getType()->isClassHandle()) | 2242 if (ClassDeclaration* cd = u->getType()->isClassHandle()) |
2244 { | 2243 { |