mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Split AccessorDecl out from FuncDecl. NFC.
This has three principal advantages: - It gives some additional type-safety when working with known accessors. - It makes it significantly easier to test whether a declaration is an accessor and encourages the use of a common idiom. - It saves a small amount of memory in both FuncDecl and its serialized form.
This commit is contained in:
@@ -360,10 +360,10 @@ SILFunction *SILModule::getOrCreateFunction(SILLocation loc,
|
||||
if (constant.isForeign && decl->hasClangNode())
|
||||
F->setClangNodeOwner(decl);
|
||||
|
||||
if (auto *FDecl = dyn_cast<FuncDecl>(decl)) {
|
||||
if (auto *StorageDecl = FDecl->getAccessorStorageDecl())
|
||||
// Add attributes for e.g. computed properties.
|
||||
addFunctionAttributes(F, StorageDecl->getAttrs(), *this);
|
||||
if (auto *accessor = dyn_cast<AccessorDecl>(decl)) {
|
||||
auto *storage = accessor->getStorage();
|
||||
// Add attributes for e.g. computed properties.
|
||||
addFunctionAttributes(F, storage->getAttrs(), *this);
|
||||
}
|
||||
addFunctionAttributes(F, decl->getAttrs(), *this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user