@@ -11458,40 +11458,61 @@ DestructorDecl *DestructorDecl::getSuperDeinit() const {
11458
11458
}
11459
11459
11460
11460
SourceLoc FuncDecl::getStartLoc () const {
11461
- auto startLoc = StaticLoc;
11462
- if (startLoc.isInvalid ())
11463
- startLoc = FuncLoc;
11464
- if (startLoc.isInvalid ())
11465
- startLoc = getNameLoc ();
11466
- if (startLoc.isInvalid ())
11467
- startLoc = getSignatureSourceRange ().Start ;
11468
- if (startLoc.isInvalid ())
11469
- startLoc = getResultTypeSourceRange ().Start ;
11470
- if (startLoc.isInvalid ())
11471
- startLoc = getGenericTrailingWhereClauseSourceRange ().Start ;
11472
- if (startLoc.isInvalid ())
11473
- startLoc = getOriginalBodySourceRange ().Start ;
11461
+ if (StaticLoc)
11462
+ return StaticLoc;
11474
11463
11475
- return startLoc;
11464
+ if (FuncLoc)
11465
+ return FuncLoc;
11466
+
11467
+ auto nameLoc = getNameLoc ();
11468
+ if (nameLoc)
11469
+ return nameLoc;
11470
+
11471
+ auto sigStart = getSignatureSourceRange ().Start ;
11472
+ if (sigStart)
11473
+ return sigStart;
11474
+
11475
+ auto resultTyStart = getResultTypeSourceRange ().Start ;
11476
+ if (resultTyStart)
11477
+ return resultTyStart;
11478
+
11479
+ auto genericWhereStart = getGenericTrailingWhereClauseSourceRange ().Start ;
11480
+ if (genericWhereStart)
11481
+ return genericWhereStart;
11482
+
11483
+ auto bodyStart = getOriginalBodySourceRange ().Start ;
11484
+ if (bodyStart)
11485
+ return bodyStart;
11486
+
11487
+ return SourceLoc ();
11488
+ }
11489
+
11490
+ SourceLoc FuncDecl::getEndLoc () const {
11491
+ auto bodyEnd = getOriginalBodySourceRange ().End ;
11492
+ if (bodyEnd)
11493
+ return bodyEnd;
11494
+
11495
+ auto genericWhereEnd = getGenericTrailingWhereClauseSourceRange ().End ;
11496
+ if (genericWhereEnd)
11497
+ return genericWhereEnd;
11498
+
11499
+ auto resultTyEnd = getResultTypeSourceRange ().End ;
11500
+ if (resultTyEnd)
11501
+ return resultTyEnd;
11502
+
11503
+ auto sigEnd = getSignatureSourceRange ().End ;
11504
+ if (sigEnd)
11505
+ return sigEnd;
11506
+
11507
+ return getStartLoc ();
11476
11508
}
11477
11509
11478
11510
SourceRange FuncDecl::getSourceRange () const {
11479
11511
SourceLoc startLoc = getStartLoc ();
11480
-
11481
11512
if (startLoc.isInvalid ())
11482
11513
return SourceRange ();
11483
11514
11484
- SourceLoc endLoc = getOriginalBodySourceRange ().End ;
11485
- if (endLoc.isInvalid ())
11486
- endLoc = getGenericTrailingWhereClauseSourceRange ().End ;
11487
- if (endLoc.isInvalid ())
11488
- endLoc = getResultTypeSourceRange ().End ;
11489
- if (endLoc.isInvalid ())
11490
- endLoc = getSignatureSourceRange ().End ;
11491
- if (endLoc.isInvalid ())
11492
- endLoc = startLoc;
11493
-
11494
- return { startLoc, endLoc };
11515
+ return { startLoc, getEndLoc () };
11495
11516
}
11496
11517
11497
11518
EnumElementDecl::EnumElementDecl (SourceLoc IdentifierLoc, DeclName Name,
0 commit comments