mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-29 06:30:39 +03:00
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:
parent
26217eabb2
commit
b3f59134c1
2 changed files with 44 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue