Merge pull request #23337 from aschwaighofer/support_dynamic_replacement_of_stored_with_observer

Add support for dynamic replacement of didSet/willSet
This commit is contained in:
Arnold Schwaighofer
2019-03-18 11:18:21 -07:00
committed by GitHub
9 changed files with 285 additions and 5 deletions

View File

@@ -4421,6 +4421,14 @@ bool AbstractStorageDecl::hasPrivateAccessor() const {
return false;
}
bool AbstractStorageDecl::hasDidSetOrWillSetDynamicReplacement() const {
if (auto *func = getDidSetFunc())
return func->getAttrs().hasAttribute<DynamicReplacementAttr>();
if (auto *func = getWillSetFunc())
return func->getAttrs().hasAttribute<DynamicReplacementAttr>();
return false;
}
void AbstractStorageDecl::setAccessors(StorageImplInfo implInfo,
SourceLoc lbraceLoc,
ArrayRef<AccessorDecl *> accessors,