Skip to content

Commit d4db260

Browse files
committed
deprecated/obsoleted declarations now always sort after non-deprecated decls in an extension
1 parent 2a15437 commit d4db260

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

Sources/UnidocLinker/Groups/DynamicContext.SortLeague.swift renamed to Sources/UnidocLinker/Groups/DynamicContext.SortPriority.Phylum.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
12
import Sources
23
import Unidoc
34

4-
extension DynamicContext
5+
extension DynamicContext.SortPriority
56
{
6-
enum SortLeague:Equatable, Comparable
7+
enum Phylum:Equatable, Comparable
78
{
89
case `var`
910
case `func`
@@ -27,7 +28,7 @@ extension DynamicContext
2728
case method(Unidoc.Decl.Objectivity)
2829
}
2930
}
30-
extension DynamicContext.SortLeague
31+
extension DynamicContext.SortPriority.Phylum
3132
{
3233
init(_ phylum:Unidoc.Decl, position:SourcePosition? = nil)
3334
{
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extension DynamicContext
2+
{
3+
enum SortPriority:Equatable, Comparable
4+
{
5+
case available (Phylum, String, Int32)
6+
case removed (Phylum, String, Int32)
7+
}
8+
}

Sources/UnidocLinker/Groups/DynamicContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ extension DynamicContext
233233
extension DynamicContext
234234
{
235235
/// Get the sort-priority of a declaration.
236-
func priority(of decl:Unidoc.Scalar) -> (SortLeague, String, Int32)?
236+
func priority(of decl:Unidoc.Scalar) -> SortPriority?
237237
{
238238
self[decl.package]?.priority(of: decl)
239239
}

Sources/UnidocLinker/Snapshots/SnapshotObject.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,16 @@ extension SnapshotObject
8080
}
8181
extension SnapshotObject
8282
{
83-
func priority(of decl:Unidoc.Scalar) -> (DynamicContext.SortLeague, String, Int32)?
83+
func priority(of decl:Unidoc.Scalar) -> DynamicContext.SortPriority?
8484
{
8585
if let local:Int32 = decl - self.zone,
8686
let decl:SymbolGraph.Decl = snapshot.graph.decls[local]?.decl
8787
{
88-
let league:DynamicContext.SortLeague = .init(decl.phylum,
88+
let phylum:DynamicContext.SortPriority.Phylum = .init(decl.phylum,
8989
position: decl.location?.position)
90-
return (league, decl.path.last, local)
90+
return decl.signature.availability.isGenerallyRecommended ?
91+
.available(phylum, decl.path.last, local) :
92+
.removed(phylum, decl.path.last, local)
9193
}
9294
else
9395
{

Sources/UnidocPages/Groups/Inliner.Groups.Generics.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ extension Inliner.Groups.Generics
2323
self.init(parameters: generics.reduce(into: []) { $0.insert($1.name) })
2424
}
2525

26+
var count:Int { self.parameters.count }
27+
2628
/// Returns the number of free generic parameters remaining after applying any same-type
2729
/// constraints in the given list.
2830
func count(substituting constraints:[GenericConstraint<Unidoc.Scalar?>]) -> Int

0 commit comments

Comments
 (0)