Skip to content

Commit

Permalink
Use subs.empty() instead of .size() == 0
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Rift <[email protected]>
  • Loading branch information
riftEmber committed Sep 3, 2024
1 parent a5a8aab commit f80630e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions frontend/lib/resolution/InitResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ static const Type* ctFromSubs(Context* context,
const Type* ret = nullptr;

if (auto rec = receiverType->toRecordType()) {
auto instantatiatedFrom = subs.size() == 0 ? nullptr :
root->toRecordType();
auto instantatiatedFrom = subs.empty() ? nullptr : root->toRecordType();
ret = RecordType::get(context, rec->id(), rec->name(),
instantatiatedFrom,
subs);
Expand All @@ -281,9 +280,8 @@ static const Type* ctFromSubs(Context* context,

bool genericParent =
superType && superType->instantiatedFromCompositeType() != nullptr;
auto instantiatedFrom = (subs.size() == 0 && !genericParent)
? nullptr
: root->toBasicClassType();
auto instantiatedFrom =
(subs.empty() && !genericParent) ? nullptr : root->toBasicClassType();

auto basic = BasicClassType::get(context, oldBasic->id(),
oldBasic->name(),
Expand Down Expand Up @@ -368,7 +366,7 @@ const Type* InitResolver::computeReceiverTypeConsideringState(void) {
}
}

if (subs.size() != 0 || genericParent) {
if (!subs.empty() || genericParent) {
const Type* ret = ctFromSubs(ctx_, initialRecvType_, superType_, ctInitial, subs);
CHPL_ASSERT(ret);
return ret;
Expand Down

0 comments on commit f80630e

Please sign in to comment.