aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd/expressionsem.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d/dmd/expressionsem.d')
-rw-r--r--gcc/d/dmd/expressionsem.d41
1 files changed, 20 insertions, 21 deletions
diff --git a/gcc/d/dmd/expressionsem.d b/gcc/d/dmd/expressionsem.d
index 04efa1f..19111e3 100644
--- a/gcc/d/dmd/expressionsem.d
+++ b/gcc/d/dmd/expressionsem.d
@@ -641,21 +641,25 @@ TupleDeclaration isAliasThisTuple(Expression e)
Type t = e.type.toBasetype();
while (true)
{
- Dsymbol s = t.toDsymbol(null);
- if (!s)
- return null;
- auto ad = s.isAggregateDeclaration();
- if (!ad)
- return null;
- s = ad.aliasthis ? ad.aliasthis.sym : null;
- if (s && s.isVarDeclaration())
+ if (Dsymbol s = t.toDsymbol(null))
{
- TupleDeclaration td = s.isVarDeclaration().toAlias().isTupleDeclaration();
- if (td && td.isexp)
- return td;
+ if (auto ad = s.isAggregateDeclaration())
+ {
+ s = ad.aliasthis ? ad.aliasthis.sym : null;
+ if (s && s.isVarDeclaration())
+ {
+ TupleDeclaration td = s.isVarDeclaration().toAlias().isTupleDeclaration();
+ if (td && td.isexp)
+ return td;
+ }
+ if (Type att = t.aliasthisOf())
+ {
+ t = att;
+ continue;
+ }
+ }
}
- if (Type att = t.aliasthisOf())
- t = att;
+ return null;
}
}
@@ -1247,6 +1251,9 @@ private Expression resolveUFCS(Scope* sc, CallExp ce)
}
else
{
+ if (arrayExpressionSemantic(ce.arguments.peekSlice(), sc))
+ return ErrorExp.get();
+
if (Expression ey = die.dotIdSemanticProp(sc, 1))
{
if (ey.op == EXP.error)
@@ -1254,19 +1261,11 @@ private Expression resolveUFCS(Scope* sc, CallExp ce)
ce.e1 = ey;
if (isDotOpDispatch(ey))
{
- // even opDispatch and UFCS must have valid arguments,
- // so now that we've seen indication of a problem,
- // check them for issues.
- Expressions* originalArguments = Expression.arraySyntaxCopy(ce.arguments);
-
const errors = global.startGagging();
e = ce.expressionSemantic(sc);
if (!global.endGagging(errors))
return e;
- if (arrayExpressionSemantic(originalArguments.peekSlice(), sc))
- return ErrorExp.get();
-
/* fall down to UFCS */
}
else