comparison gen/toir.cpp @ 634:0084d2c76b74

Fixed problem with taking the delegate of a nested function of the current function.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Thu, 02 Oct 2008 01:28:33 +0200
parents 607b6b5819a7
children 2a0bcf7f7b3d
comparison
equal deleted inserted replaced
633:d208fc4291df 634:0084d2c76b74
1861 LLValue* lval = DtoAlloca(DtoType(type), "tmpdelegate"); 1861 LLValue* lval = DtoAlloca(DtoType(type), "tmpdelegate");
1862 1862
1863 DValue* u = e1->toElem(p); 1863 DValue* u = e1->toElem(p);
1864 LLValue* uval; 1864 LLValue* uval;
1865 if (DFuncValue* f = u->isFunc()) { 1865 if (DFuncValue* f = u->isFunc()) {
1866 assert(f->func); 1866 assert(f->func);
1867 LLValue* contextptr; 1867 LLValue* contextptr = DtoNestedContext(loc, f->func);
1868 if (p->func()->decl == f->func)
1869 contextptr = p->func()->thisArg;
1870 else
1871 contextptr = DtoNestedContext(loc, f->func);
1872 uval = DtoBitCast(contextptr, getVoidPtrType()); 1868 uval = DtoBitCast(contextptr, getVoidPtrType());
1873 } 1869 }
1874 else { 1870 else {
1875 DValue* src = u; 1871 DValue* src = u;
1876 if (ClassDeclaration* cd = u->getType()->isClassHandle()) 1872 if (ClassDeclaration* cd = u->getType()->isClassHandle())