Remove redundant else

This commit is contained in:
0-v-0 2025-01-11 11:21:53 +08:00 committed by Nicholas Wilson
parent 646dc29eec
commit 0ee5b318b3
11 changed files with 21 additions and 28 deletions

View file

@ -394,7 +394,7 @@ alias versionFile = makeRule!((builder, rule) {
{ {
if ('0' <= version_[i] && version_[i] <= '9') if ('0' <= version_[i] && version_[i] <= '9')
continue; continue;
else if (version_[i] == '.') if (version_[i] == '.')
break; break;
return false; return false;
} }

View file

@ -546,7 +546,7 @@ void brcombine(ref GlobalOptimizer go)
} }
else if (list_next(b3.Bpred) || b3 == bo.startblock) else if (list_next(b3.Bpred) || b3 == bo.startblock)
continue; continue;
else if ((bc2 == BCretexp && b3.BC == BCretexp) if ((bc2 == BCretexp && b3.BC == BCretexp)
//|| (bc2 == BCret && b3.BC == BCret) //|| (bc2 == BCret && b3.BC == BCret)
) )
{ {

View file

@ -50,16 +50,13 @@ extern (C++) final class Import : Dsymbol
// import [aliasId] = std.stdio; // import [aliasId] = std.stdio;
return aliasId; return aliasId;
} }
else if (packages.length > 0) if (packages.length > 0)
{ {
// import [std].stdio; // import [std].stdio;
return packages[0]; return packages[0];
} }
else // import [id];
{ return id;
// import [id];
return id;
}
} }
super(loc, selectIdent()); super(loc, selectIdent());

View file

@ -6629,7 +6629,7 @@ private extern(C++) class SearchVisitor : Visitor
s = b.sym.search(loc, ident, flags); s = b.sym.search(loc, ident, flags);
if (!s) if (!s)
continue; 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; s = null;
else if (!(flags & SearchOpt.ignoreVisibility) && !(s.visible().kind == Visibility.Kind.protected_) && !symbolIsVisible(cd, s)) else if (!(flags & SearchOpt.ignoreVisibility) && !(s.visible().kind == Visibility.Kind.protected_) && !symbolIsVisible(cd, s))
s = null; s = null;

View file

@ -910,7 +910,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
*/ */
extern (D) TemplateTupleParameter isVariadic() extern (D) TemplateTupleParameter isVariadic()
{ {
size_t dim = parameters.length; const dim = parameters.length;
if (dim == 0) if (dim == 0)
return null; return null;
return (*parameters)[dim - 1].isTemplateTupleParameter(); return (*parameters)[dim - 1].isTemplateTupleParameter();

View file

@ -2805,11 +2805,11 @@ extern (C++) final class FuncExp : Expression
{ {
if (td) if (td)
return new FuncExp(loc, td.syntaxCopy(null)); 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)); return new FuncExp(loc, fd.syntaxCopy(null));
else // https://issues.dlang.org/show_bug.cgi?id=13481 // https://issues.dlang.org/show_bug.cgi?id=13481
// Prevent multiple semantic analysis of lambda body. // Prevent multiple semantic analysis of lambda body.
return new FuncExp(loc, fd); return new FuncExp(loc, fd);
} }
override const(char)* toChars() const override const(char)* toChars() const
@ -3573,10 +3573,9 @@ TypeFunction calledFunctionType(CallExp ce)
t = t.toBasetype(); t = t.toBasetype();
if (auto tf = t.isTypeFunction()) if (auto tf = t.isTypeFunction())
return tf; return tf;
else if (auto td = t.isTypeDelegate()) if (auto td = t.isTypeDelegate())
return td.nextOf().isTypeFunction(); return td.nextOf().isTypeFunction();
else return null;
return null;
} }
FuncDeclaration isFuncAddress(Expression e, bool* hasOverloads = null) @safe FuncDeclaration isFuncAddress(Expression e, bool* hasOverloads = null) @safe

View file

@ -2993,7 +2993,7 @@ extern (D) bool checkNRVO(FuncDeclaration fd)
auto v = ve.var.isVarDeclaration(); auto v = ve.var.isVarDeclaration();
if (!v || v.isReference()) if (!v || v.isReference())
return false; 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), // Variables in the data segment (e.g. globals, TLS or not),
// parameters and closure variables cannot be NRVOed. // parameters and closure variables cannot be NRVOed.

View file

@ -643,7 +643,7 @@ class Lexer
if (isidchar(c)) if (isidchar(c))
continue; continue;
else if (c & 0x80) if (c & 0x80)
{ {
const s = p; const s = p;
const u = decodeUTF(); const u = decodeUTF();

View file

@ -1333,7 +1333,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
// Don't allow D `immutable` and `shared` types to be interfaced with C++ // Don't allow D `immutable` and `shared` types to be interfaced with C++
if (type.isImmutable() || type.isShared()) if (type.isImmutable() || type.isShared())
return true; return true;
else if (Type cpptype = target.cpp.parameterType(type)) if (Type cpptype = target.cpp.parameterType(type))
type = cpptype; type = cpptype;
if (origType is null) if (origType is null)

View file

@ -1115,7 +1115,7 @@ extern (C++) struct Target
} }
else if ((isX86_64 || isAArch64) && sd.numArgTypes() == 0) else if ((isX86_64 || isAArch64) && sd.numArgTypes() == 0)
return true; return true;
else if (sd.isPOD()) if (sd.isPOD())
{ {
switch (sz) switch (sz)
{ {

View file

@ -1758,13 +1758,10 @@ pure @safe:
if (parseMangledNameArg()) if (parseMangledNameArg())
continue; continue;
else dst.len = l;
{ pos = p;
dst.len = l; brp = b;
pos = p; debug(trace) printf( "not a mangled name arg\n" );
brp = b;
debug(trace) printf( "not a mangled name arg\n" );
}
} }
if ( isDigit( front ) && isDigit( peek( 1 ) ) ) if ( isDigit( front ) && isDigit( peek( 1 ) ) )
{ {