Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.

This commit is contained in:
Tomas Lindquist Olsen
2008-09-15 02:04:26 +02:00
parent 431bc19d2f
commit 4280a86bcf
8 changed files with 67 additions and 8 deletions

View File

@@ -2380,6 +2380,17 @@ DValue* AssocArrayLiteralExp::toElem(IRState* p)
//////////////////////////////////////////////////////////////////////////////////////////
DValue* GEPExp::toElem(IRState* p)
{
// this should be good enough for now!
DValue* val = e1->toElem(p);
assert(val->isLVal());
LLValue* v = DtoGEPi(val->getLVal(), 0, index);
return new DVarValue(type, DtoBitCast(v, getPtrToType(DtoType(type))));
}
//////////////////////////////////////////////////////////////////////////////////////////
#define STUB(x) DValue *x::toElem(IRState * p) {error("Exp type "#x" not implemented: %s", toChars()); fatal(); return 0; }
STUB(Expression);
STUB(DotTypeExp);