Skip to content

Commit

Permalink
Remove redundant else
Browse files Browse the repository at this point in the history
  • Loading branch information
0-v-0 authored and thewilsonator committed Jan 11, 2025
1 parent 646dc29 commit 0ee5b31
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 28 deletions.
2 changes: 1 addition & 1 deletion compiler/src/build.d
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ alias versionFile = makeRule!((builder, rule) {
{
if ('0' <= version_[i] && version_[i] <= '9')
continue;
else if (version_[i] == '.')
if (version_[i] == '.')
break;
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/blockopt.d
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ void brcombine(ref GlobalOptimizer go)
}
else if (list_next(b3.Bpred) || b3 == bo.startblock)
continue;
else if ((bc2 == BCretexp && b3.BC == BCretexp)
if ((bc2 == BCretexp && b3.BC == BCretexp)
//|| (bc2 == BCret && b3.BC == BCret)
)
{
Expand Down
9 changes: 3 additions & 6 deletions compiler/src/dmd/dimport.d
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,13 @@ extern (C++) final class Import : Dsymbol
// import [aliasId] = std.stdio;
return aliasId;
}
else if (packages.length > 0)
if (packages.length > 0)
{
// import [std].stdio;
return packages[0];
}
else
{
// import [id];
return id;
}
// import [id];
return id;
}

super(loc, selectIdent());
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/dsymbolsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -6629,7 +6629,7 @@ private extern(C++) class SearchVisitor : Visitor
s = b.sym.search(loc, ident, flags);
if (!s)
continue;
else if (s == cd) // happens if s is nested in this and derives from this
if (s == cd) // happens if s is nested in this and derives from this
s = null;
else if (!(flags & SearchOpt.ignoreVisibility) && !(s.visible().kind == Visibility.Kind.protected_) && !symbolIsVisible(cd, s))
s = null;
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/dtemplate.d
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
*/
extern (D) TemplateTupleParameter isVariadic()
{
size_t dim = parameters.length;
const dim = parameters.length;
if (dim == 0)
return null;
return (*parameters)[dim - 1].isTemplateTupleParameter();
Expand Down
13 changes: 6 additions & 7 deletions compiler/src/dmd/expression.d
Original file line number Diff line number Diff line change
Expand Up @@ -2805,11 +2805,11 @@ extern (C++) final class FuncExp : Expression
{
if (td)
return new FuncExp(loc, td.syntaxCopy(null));
else if (fd.semanticRun == PASS.initial)
if (fd.semanticRun == PASS.initial)
return new FuncExp(loc, fd.syntaxCopy(null));
else // https://issues.dlang.org/show_bug.cgi?id=13481
// Prevent multiple semantic analysis of lambda body.
return new FuncExp(loc, fd);
// https://issues.dlang.org/show_bug.cgi?id=13481
// Prevent multiple semantic analysis of lambda body.
return new FuncExp(loc, fd);
}

override const(char)* toChars() const
Expand Down Expand Up @@ -3573,10 +3573,9 @@ TypeFunction calledFunctionType(CallExp ce)
t = t.toBasetype();
if (auto tf = t.isTypeFunction())
return tf;
else if (auto td = t.isTypeDelegate())
if (auto td = t.isTypeDelegate())
return td.nextOf().isTypeFunction();
else
return null;
return null;
}

FuncDeclaration isFuncAddress(Expression e, bool* hasOverloads = null) @safe
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/funcsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -2993,7 +2993,7 @@ extern (D) bool checkNRVO(FuncDeclaration fd)
auto v = ve.var.isVarDeclaration();
if (!v || v.isReference())
return false;
else if (fd.nrvo_var is null)
if (fd.nrvo_var is null)
{
// Variables in the data segment (e.g. globals, TLS or not),
// parameters and closure variables cannot be NRVOed.
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/lexer.d
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ class Lexer

if (isidchar(c))
continue;
else if (c & 0x80)
if (c & 0x80)
{
const s = p;
const u = decodeUTF();
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/semantic3.d
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
// Don't allow D `immutable` and `shared` types to be interfaced with C++
if (type.isImmutable() || type.isShared())
return true;
else if (Type cpptype = target.cpp.parameterType(type))
if (Type cpptype = target.cpp.parameterType(type))
type = cpptype;

if (origType is null)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/target.d
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ extern (C++) struct Target
}
else if ((isX86_64 || isAArch64) && sd.numArgTypes() == 0)
return true;
else if (sd.isPOD())
if (sd.isPOD())
{
switch (sz)
{
Expand Down
11 changes: 4 additions & 7 deletions druntime/src/core/demangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -1758,13 +1758,10 @@ pure @safe:

if (parseMangledNameArg())
continue;
else
{
dst.len = l;
pos = p;
brp = b;
debug(trace) printf( "not a mangled name arg\n" );
}
dst.len = l;
pos = p;
brp = b;
debug(trace) printf( "not a mangled name arg\n" );
}
if ( isDigit( front ) && isDigit( peek( 1 ) ) )
{
Expand Down

0 comments on commit 0ee5b31

Please sign in to comment.