Remove LDC-specific callable literal kind inference hack.

This commit is contained in:
David Nadlinger
2013-01-04 02:07:37 +01:00
parent 5c518a16ec
commit 26217eabb2
2 changed files with 2 additions and 21 deletions

View File

@@ -1804,7 +1804,6 @@ Expression *CommaExp::castTo(Scope *sc, Type *t)
/****************************************
* Set type inference target
* flag 1: don't put an error when inference fails
* 2: ldc specific: allow to infer function literal kind (TOKdelegate or TOKfunction)
*/
Expression *Expression::inferType(Type *t, int flag, TemplateParameters *tparams)
@@ -1965,27 +1964,9 @@ Expression *FuncExp::inferType(Type *to, int flag, TemplateParameters *tparams)
}
else
e = this;
#if IN_LLVM
if (flag == 2 && e)
{ FuncExp *fe = (FuncExp *)e;
if (fe->fd && fe->fd->tok == TOKreserved)
{
if (fe->type->ty == Tpointer)
{
fe->fd->vthis = NULL;
fe->fd->tok = TOKfunction;
}
else
{
fe->fd->tok = TOKdelegate;
}
}
}
#endif
}
L1:
if (flag != 1 && !e)
if (!flag && !e)
{ error("cannot infer function literal type from %s", to->toChars());
e = new ErrorExp();
}

View File

@@ -1006,7 +1006,7 @@ Type *functionParameters(Loc loc, Scope *sc, TypeFunction *tf,
Type *pt = p->type;
if (tf->varargs == 2 && i + 1 == nparams && pt->nextOf())
pt = pt->nextOf();
arg = arg->inferType(pt, 2);
arg = arg->inferType(pt);
(*arguments)[i] = arg;
}