Merge pull request #7472 from JinShil/funcexp

Improve FuncExp: Do nothing if type is already set in semantic
merged-on-behalf-of: Iain Buclaw <ibuclaw@gdcproject.org>
This commit is contained in:
The Dlang Bot 2018-01-07 11:14:35 +01:00 committed by GitHub
commit 38aadf0081
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2554,14 +2554,20 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
if (exp.fd.treq)
printf(" treq = %s\n", exp.fd.treq.toChars());
}
if (exp.type)
{
result = exp;
return;
}
Expression e = exp;
uint olderrors;
sc = sc.push(); // just create new scope
sc.flags &= ~SCOPEctfe; // temporary stop CTFE
sc.protection = Prot(PROTpublic); // https://issues.dlang.org/show_bug.cgi?id=12506
if (!exp.type || exp.type == Type.tvoid)
{
/* fd.treq might be incomplete type,
* so should not semantic it.
* void foo(T)(T delegate(int) dg){}
@ -2603,7 +2609,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
goto Ldone;
}
uint olderrors = global.errors;
olderrors = global.errors;
exp.fd.dsymbolSemantic(sc);
if (olderrors == global.errors)
{
@ -2649,7 +2655,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
}
}
exp.fd.tookAddressOf++;
}
Ldone:
sc = sc.pop();