@@ -29,15 +29,21 @@ extension Unidoc
29
29
30
30
let current : Graph
31
31
32
+ /// The set of all nodes in the current graph. These are the nodes being linked; all
33
+ /// other nodes in this structure are merely used for context.
34
+ let nodes : Set < Unidoc . Scalar >
35
+
32
36
private
33
37
init (
34
38
byPackageIdentifier: [ Symbol . Package : Graph ] ,
35
39
byPackage: [ Package : Graph ] ,
36
- current: Graph )
40
+ current: Graph ,
41
+ nodes: Set < Unidoc . Scalar > )
37
42
{
38
43
self . byPackageIdentifier = byPackageIdentifier
39
44
self . byPackage = byPackage
40
45
self . current = current
46
+ self . nodes = nodes
41
47
42
48
self . diagnostics = . init( )
43
49
}
@@ -47,7 +53,7 @@ extension Unidoc
47
53
extension Unidoc . Linker
48
54
{
49
55
public
50
- init ( _ currentSnapshot: Unidoc . Snapshot , dependencies: borrowing [ Unidoc . Snapshot ] )
56
+ init ( _ currentSnapshot: consuming Unidoc . Snapshot , dependencies: borrowing [ Unidoc . Snapshot ] )
51
57
{
52
58
// Build a combined lookup table mapping upstream symbols to scalars.
53
59
// Because module names are unique within a build tree, there should
@@ -83,12 +89,19 @@ extension Unidoc.Linker
83
89
byPackage [ snapshot. id. package ] = snapshot
84
90
}
85
91
92
+ let current : Graph = . init( snapshot: currentSnapshot, upstream: upstream)
93
+
86
94
self . init (
87
95
byPackageIdentifier: byPackageIdentifier,
88
96
byPackage: byPackage,
89
- current: . init(
90
- snapshot: currentSnapshot,
91
- upstream: upstream) )
97
+ current: current,
98
+ nodes: current. scalars. decls [ current. decls. nodes. indices] . reduce ( into: [ ] )
99
+ {
100
+ if let s: Unidoc . Scalar = $1
101
+ {
102
+ $0. insert ( s)
103
+ }
104
+ } )
92
105
}
93
106
}
94
107
extension Unidoc . Linker
@@ -227,8 +240,7 @@ extension Unidoc.Linker
227
240
{
228
241
for (dependencies, cultures) : ( [ Symbol . Package : Set < String > ] , [ Int ] ) in groups
229
242
{
230
- var shared : SymbolGraph . ModuleContext = . init(
231
- nodes: self . current. scalars. decls [ self . current. decls. nodes. indices] )
243
+ var shared : SymbolGraph . ModuleContext = . init( )
232
244
233
245
if let swift: Graph = self [ dynamic: . swift]
234
246
{
0 commit comments