Skip to content

Commit f80d113

Browse files
authored
Merge pull request #17498 from rudkx/remove-redundant-if
Remove redundant nested if statement.
2 parents 92b6d8c + 100bffd commit f80d113

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

lib/IDE/TypeReconstruction.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -570,12 +570,10 @@ FindNamedDecls(ASTContext *ast, const DeclBaseName &name, VisitNodeResult &resul
570570
if (decl->hasInterfaceType()) {
571571
result._decls.push_back(decl);
572572
Type decl_type;
573-
if (decl->hasInterfaceType()) {
574-
decl_type = decl->getInterfaceType();
575-
MetatypeType *meta_type = decl_type->getAs<MetatypeType>();
576-
if (meta_type)
577-
decl_type = meta_type->getInstanceType();
578-
}
573+
decl_type = decl->getInterfaceType();
574+
MetatypeType *meta_type = decl_type->getAs<MetatypeType>();
575+
if (meta_type)
576+
decl_type = meta_type->getInstanceType();
579577
result._types.push_back(decl_type);
580578
}
581579
}
@@ -633,15 +631,11 @@ FindNamedDecls(ASTContext *ast, const DeclBaseName &name, VisitNodeResult &resul
633631
for (auto decl : decls) {
634632
if (decl->hasInterfaceType()) {
635633
result._decls.push_back(decl);
636-
if (decl->hasInterfaceType()) {
637-
result._types.push_back(decl->getInterfaceType());
638-
MetatypeType *meta_type =
639-
result._types.back()->getAs<MetatypeType>();
640-
if (meta_type)
641-
result._types.back() = meta_type->getInstanceType();
642-
} else {
643-
result._types.push_back(Type());
644-
}
634+
result._types.push_back(decl->getInterfaceType());
635+
MetatypeType *meta_type =
636+
result._types.back()->getAs<MetatypeType>();
637+
if (meta_type)
638+
result._types.back() = meta_type->getInstanceType();
645639
}
646640
}
647641
return result._types.size();

0 commit comments

Comments
 (0)