Skip to content

Commit

Permalink
expressionsem.d: Combine redundant branches (#20796)
Browse files Browse the repository at this point in the history
Co-authored-by: Dennis Korpel <[email protected]>
  • Loading branch information
dkorpel and Dennis Korpel authored Jan 28, 2025
1 parent c3da7f0 commit 84c7b04
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions compiler/src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -12127,10 +12127,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return;
}

if (exp.suggestBinaryOverloads(sc))
return setError();

if (exp.checkArithmeticBin())
if (exp.suggestBinaryOverloads(sc) || exp.checkArithmeticBin())
return setError();

tb1 = exp.e1.type.toBasetype();
Expand Down Expand Up @@ -12283,10 +12280,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return;
}

if (exp.suggestBinaryOverloads(sc))
return setError();

if (exp.checkArithmeticBin())
if (exp.suggestBinaryOverloads(sc) || exp.checkArithmeticBin())
return setError();

t1 = exp.e1.type.toBasetype();
Expand Down Expand Up @@ -12587,7 +12581,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
trySetCatExpLowering(result);
}

bool commonBinOpSemantic(BinExp exp)
bool commonArithBinOpSemantic(BinExp exp)
{
if (Expression e = exp.opOverloadBinary(sc, aliasThisStop))
{
Expand All @@ -12600,12 +12594,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
result = ex;
return true;
}
return false;
}
bool commonArithBinOpSemantic(BinExp exp)
{
if (commonBinOpSemantic(exp))
return true;

Type tb = exp.type.toBasetype();
if (tb.ty == Tarray || tb.ty == Tsarray)
Expand All @@ -12619,13 +12607,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return true;
}

if (exp.suggestBinaryOverloads(sc))
{
setError();
return true;
}

if (exp.checkArithmeticBin() || exp.checkSharedAccessBin(sc))
if (exp.suggestBinaryOverloads(sc) || exp.checkArithmeticBin() || exp.checkSharedAccessBin(sc))
{
setError();
return true;
Expand Down Expand Up @@ -12839,10 +12821,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return;
}

if (exp.suggestBinaryOverloads(sc))
return setError();

if (exp.checkIntegralBin() || exp.checkSharedAccessBin(sc))
if (exp.suggestBinaryOverloads(sc) || exp.checkIntegralBin() || exp.checkSharedAccessBin(sc))
return setError();

if (!target.isVectorOpSupported(exp.e1.type.toBasetype(), exp.op, exp.e2.type.toBasetype()))
Expand Down Expand Up @@ -12913,10 +12892,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return;
}

if (exp.suggestBinaryOverloads(sc))
return setError();

if (exp.checkIntegralBin() || exp.checkSharedAccessBin(sc))
if (exp.suggestBinaryOverloads(sc) || exp.checkIntegralBin() || exp.checkSharedAccessBin(sc))
return setError();

result = exp;
Expand Down

0 comments on commit 84c7b04

Please sign in to comment.