File tree Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -8454,6 +8454,11 @@ class AccessorDecl final : public FuncDecl {
8454
8454
// / even when it does not have one _yet_.
8455
8455
bool doesAccessorHaveBody () const ;
8456
8456
8457
+ // / Whether this accessor is a protocol requirement for which a default
8458
+ // / implementation must be provided for back-deployment. For example, read2
8459
+ // / and modify2 requirements with early enough availability.
8460
+ bool isRequirementWithSynthesizedDefaultImplementation () const ;
8461
+
8457
8462
static bool classof (const Decl *D) {
8458
8463
return D->getKind () == DeclKind::Accessor;
8459
8464
}
Original file line number Diff line number Diff line change @@ -10540,24 +10540,29 @@ ArrayRef<VarDecl *> AccessorDecl::getAccessedProperties() const {
10540
10540
return {};
10541
10541
}
10542
10542
10543
+ bool AccessorDecl::isRequirementWithSynthesizedDefaultImplementation () const {
10544
+ if (!isa<ProtocolDecl>(getDeclContext ()))
10545
+ return false ;
10546
+
10547
+ if (!getASTContext ().LangOpts .hasFeature (Feature::CoroutineAccessors)) {
10548
+ return false ;
10549
+ }
10550
+ if (!requiresFeatureCoroutineAccessors (getAccessorKind ())) {
10551
+ return false ;
10552
+ }
10553
+ if (getStorage ()->getOverrideLoc ()) {
10554
+ return false ;
10555
+ }
10556
+ return getStorage ()->requiresCorrespondingUnderscoredCoroutineAccessor (
10557
+ getAccessorKind (), this );
10558
+ }
10559
+
10543
10560
bool AccessorDecl::doesAccessorHaveBody () const {
10544
10561
auto *accessor = this ;
10545
10562
auto *storage = accessor->getStorage ();
10546
10563
10547
10564
if (isa<ProtocolDecl>(accessor->getDeclContext ())) {
10548
- if (!accessor->getASTContext ().LangOpts .hasFeature (
10549
- Feature::CoroutineAccessors)) {
10550
- return false ;
10551
- }
10552
- if (!requiresFeatureCoroutineAccessors (accessor->getAccessorKind ())) {
10553
- return false ;
10554
- }
10555
- if (storage->getOverrideLoc ()) {
10556
- return false ;
10557
- }
10558
- return accessor->getStorage ()
10559
- ->requiresCorrespondingUnderscoredCoroutineAccessor (
10560
- accessor->getAccessorKind (), accessor);
10565
+ return isRequirementWithSynthesizedDefaultImplementation ();
10561
10566
}
10562
10567
10563
10568
// NSManaged getters and setters don't have bodies.
You can’t perform that action at this time.
0 commit comments