@@ -8,20 +8,20 @@ extension IdentifiablePageContext
8
8
struct Cache
9
9
{
10
10
var vertices : Vertices
11
- var volumes : Volumes
11
+ var volumes : Swiftinit . Volumes
12
12
13
13
private
14
14
var uris : [ Unidoc . Scalar : String ]
15
15
16
- init ( vertices: Vertices , volumes: Volumes , uris: [ Unidoc . Scalar : String ] = [ : ] )
16
+ init ( vertices: Vertices , volumes: Swiftinit . Volumes , uris: [ Unidoc . Scalar : String ] = [ : ] )
17
17
{
18
18
self . vertices = vertices
19
19
self . volumes = volumes
20
20
self . uris = uris
21
21
}
22
22
}
23
23
}
24
- extension IdentifiablePageContext . Cache where ID : Swiftinit . VertexPageIdentifier
24
+ extension IdentifiablePageContext . Cache
25
25
{
26
26
mutating
27
27
func load( _ scalar: Unidoc . Scalar , by uri: ( Unidoc . VolumeMetadata ) -> URI ? ) -> String ?
@@ -46,18 +46,19 @@ extension IdentifiablePageContext.Cache where ID:Swiftinit.VertexPageIdentifier
46
46
} ( & self . uris [ scalar] )
47
47
}
48
48
}
49
- extension IdentifiablePageContext . Cache where ID : Swiftinit . VertexPageIdentifier
49
+ extension IdentifiablePageContext . Cache
50
50
{
51
51
subscript( culture scalar: Unidoc . Scalar ) -> ( vertex: Unidoc . CultureVertex , url: String ? ) ?
52
52
{
53
53
mutating get
54
54
{
55
- if case . culture ( let vertex ) ? = self . vertices [ scalar]
55
+ switch self . vertices [ scalar]
56
56
{
57
+ case ( . culture( let vertex) , principal: true ) ? :
58
+ ( vertex, nil )
59
+ case ( . culture( let vertex) , principal: false ) ? :
57
60
( vertex, self . load ( scalar) { Swiftinit . Docs [ $0, vertex. route] } )
58
- }
59
- else
60
- {
61
+ default :
61
62
nil
62
63
}
63
64
}
@@ -67,12 +68,13 @@ extension IdentifiablePageContext.Cache where ID:Swiftinit.VertexPageIdentifier
67
68
{
68
69
mutating get
69
70
{
70
- if case . article ( let vertex ) ? = self . vertices [ scalar]
71
+ switch self . vertices [ scalar]
71
72
{
73
+ case ( . article( let vertex) , principal: true ) ? :
74
+ ( vertex, nil )
75
+ case ( . article( let vertex) , principal: false ) ? :
72
76
( vertex, self . load ( scalar) { Swiftinit . Docs [ $0, vertex. route] } )
73
- }
74
- else
75
- {
77
+ default :
76
78
nil
77
79
}
78
80
}
@@ -82,12 +84,13 @@ extension IdentifiablePageContext.Cache where ID:Swiftinit.VertexPageIdentifier
82
84
{
83
85
mutating get
84
86
{
85
- if case . decl ( let vertex ) ? = self . vertices [ scalar]
87
+ switch self . vertices [ scalar]
86
88
{
89
+ case ( . decl( let vertex) , principal: true ) ? :
90
+ ( vertex, nil )
91
+ case ( . decl( let vertex) , principal: false ) ? :
87
92
( vertex, self . load ( scalar) { Swiftinit . Docs [ $0, vertex. route] } )
88
- }
89
- else
90
- {
93
+ default :
91
94
nil
92
95
}
93
96
}
@@ -100,23 +103,28 @@ extension IdentifiablePageContext.Cache where ID:Swiftinit.VertexPageIdentifier
100
103
{
101
104
self . vertices [ scalar] . map
102
105
{
103
- ( vertex: Unidoc . AnyVertex ) in
104
-
105
- let url : String ? = self . load ( scalar)
106
+ switch $0
106
107
{
107
- switch vertex
108
+ case ( let vertex, principal: false ) :
109
+ let url : String ? = self . load ( scalar)
108
110
{
109
- case . article( let vertex) : Swiftinit . Docs [ $0, vertex. route]
110
- case . culture( let vertex) : Swiftinit . Docs [ $0, vertex. route]
111
- case . decl( let vertex) : Swiftinit . Docs [ $0, vertex. route]
112
- case . file: nil
113
- case . product( let vertex) : Swiftinit . Docs [ $0, vertex. route]
114
- case . foreign( let vertex) : Swiftinit . Docs [ $0, vertex. route]
115
- case . global: Swiftinit . Docs [ $0]
111
+ switch vertex
112
+ {
113
+ case . article( let vertex) : Swiftinit . Docs [ $0, vertex. route]
114
+ case . culture( let vertex) : Swiftinit . Docs [ $0, vertex. route]
115
+ case . decl( let vertex) : Swiftinit . Docs [ $0, vertex. route]
116
+ case . file: nil
117
+ case . product( let vertex) : Swiftinit . Docs [ $0, vertex. route]
118
+ case . foreign( let vertex) : Swiftinit . Docs [ $0, vertex. route]
119
+ case . global: Swiftinit . Docs [ $0]
120
+ }
116
121
}
117
- }
118
122
119
- return ( vertex, url)
123
+ return ( vertex, url)
124
+
125
+ case ( let vertex, principal: true ) :
126
+ return ( vertex, nil )
127
+ }
120
128
}
121
129
}
122
130
}
0 commit comments