Allow extractConstantsFromMembers on all nominal decls

This commit is contained in:
Apollo Zhu
2023-11-30 18:35:17 -08:00
parent 95fa962851
commit a8fd83703b
4 changed files with 56 additions and 3 deletions

View File

@@ -58,11 +58,17 @@ public:
if (auto *ETD = dyn_cast<ExtensionDecl>(D))
NTD = ETD->getExtendedNominal();
if (NTD)
if (!isa<ProtocolDecl>(NTD) && CheckedDecls.insert(NTD).second)
if (!isa<ProtocolDecl>(NTD) && CheckedDecls.insert(NTD).second) {
if (NTD->getAttrs().hasAttribute<ExtractConstantsFromMembersAttr>()) {
ConformanceTypeDecls.push_back(NTD);
return Action::Continue();
}
for (auto &Protocol : NTD->getAllProtocols())
if (Protocol->getAttrs().hasAttribute<ExtractConstantsFromMembersAttr>() ||
Protocols.count(Protocol->getName().str().str()) != 0)
ConformanceTypeDecls.push_back(NTD);
}
return Action::Continue();
}