Skip to content

Commit 98c5fde

Browse files
committed
[AST] Use SourceRange::combine in a couple of places
1 parent 691b8c8 commit 98c5fde

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

lib/AST/Decl.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10308,30 +10308,20 @@ SourceRange AbstractFunctionDecl::getSignatureSourceRange() const {
1030810308
if (isImplicit())
1030910309
return SourceRange();
1031010310

10311-
SourceLoc endLoc;
10312-
10313-
// name(parameter list...) async throws(E)
10311+
SourceRange thrownTypeRange;
1031410312
if (auto *typeRepr = getThrownTypeRepr())
10315-
endLoc = typeRepr->getSourceRange().End;
10316-
if (endLoc.isInvalid())
10317-
endLoc = getThrowsLoc();
10318-
if (endLoc.isInvalid())
10319-
endLoc = getAsyncLoc();
10313+
thrownTypeRange = typeRepr->getSourceRange();
1032010314

10321-
if (endLoc.isInvalid())
10322-
return getParameterListSourceRange();
10323-
return SourceRange(getNameLoc(), endLoc);
10315+
// name(parameter list...) async throws(E)
10316+
return SourceRange::combine(getParameterListSourceRange(), getAsyncLoc(),
10317+
getThrowsLoc(), thrownTypeRange);
1032410318
}
1032510319

1032610320
SourceRange AbstractFunctionDecl::getParameterListSourceRange() const {
1032710321
if (isImplicit())
1032810322
return SourceRange();
1032910323

10330-
auto endLoc = getParameters()->getSourceRange().End;
10331-
if (endLoc.isInvalid())
10332-
return getNameLoc();
10333-
10334-
return SourceRange(getNameLoc(), endLoc);
10324+
return SourceRange::combine(getNameLoc(), getParameters()->getSourceRange());
1033510325
}
1033610326

1033710327
std::optional<Fingerprint> AbstractFunctionDecl::getBodyFingerprint() const {

0 commit comments

Comments
 (0)