Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 2aedf5c

Browse files
committed
Add declarations in public protocols as public declarations
1 parent 0abd89f commit 2aedf5c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Sources/swift-api-inventory/Inventory.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,21 @@ import SwiftSemantics
22
import SwiftDoc
33

44
func inventory(of module: Module) -> [String] {
5-
return module.symbols
5+
let publicSymbols = module.symbols
66
.filter { $0.declaration.isPublic }
7+
8+
let publicNames = Set(publicSymbols
9+
.map { $0.declaration.qualifiedName })
10+
11+
let symbolsWithPublicContext = module.symbols
12+
.filter { symbol -> Bool in
13+
guard let context = symbol.declaration.context else { return false }
14+
return publicNames.contains(context)
15+
}
16+
17+
let inventory = publicSymbols + symbolsWithPublicContext
18+
19+
return inventory
720
.sorted { $0.declaration.qualifiedName < $1.declaration.qualifiedName }
821
.compactMap { representation(of: $0, in: module) }
922
}

0 commit comments

Comments
 (0)