Adapt to new DMD lambda inference mechanism.

Rewriting types this late is a questionable design and prone
to break non-DMD client code; this should be discussed
again with Kenji.
This commit is contained in:
David Nadlinger 2013-01-04 04:26:32 +01:00
parent 26217eabb2
commit b3f59134c1
2 changed files with 44 additions and 2 deletions

View file

@ -164,6 +164,28 @@ IrTypePointer* IrTypePointer::get(Type* dt)
}
else
{
if (dt->nextOf()->ty == Tfunction)
{
TypeFunction* tf = static_cast<TypeFunction*>(dt->nextOf());
if (tf->funcdecl)
{
if (FuncLiteralDeclaration* fld =
tf->funcdecl->isFuncLiteralDeclaration())
{
if (fld->tok == TOKreserved)
{
// This is the type of a lambda that was inferred to be
// a function literal instead of a delegate, so set tok
// here in order to get correct types/mangling. Horrible
// hack, but DMD does the same thing in FuncExp::toElem
// and other random places.
fld->tok = TOKfunction;
fld->vthis = NULL;
}
}
}
}
elemType = DtoTypeNotVoid(dt->nextOf());
// DtoTypeNotVoid could have already created the same type, e.g. for