Skip to content

Commit 061e1db

Browse files
committed
Remove redundant "bundle" parameter from PathHierarchyBasedLinkResolver.referencesForSymbols
1 parent 5898c48 commit 061e1db

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Sources/SwiftDocC/Infrastructure/DocumentationContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ public class DocumentationContext {
10141014

10151015
// Build references for all symbols in all of this module's symbol graphs.
10161016
let symbolReferences = signposter.withIntervalSignpost("Disambiguate references") {
1017-
linkResolver.localResolver.referencesForSymbols(in: symbolGraphLoader.unifiedGraphs, bundle: bundle, context: self)
1017+
linkResolver.localResolver.referencesForSymbols(in: symbolGraphLoader.unifiedGraphs, context: self)
10181018
}
10191019

10201020
// Set the index and cache storage capacity to avoid ad-hoc storage resizing.

Sources/SwiftDocC/Infrastructure/Link Resolution/PathHierarchyBasedLinkResolver.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ final class PathHierarchyBasedLinkResolver {
264264
///
265265
/// - Parameters:
266266
/// - symbolGraph: The complete symbol graph to walk through.
267-
/// - bundle: The bundle to use when creating symbol references.
268-
func referencesForSymbols(in unifiedGraphs: [String: UnifiedSymbolGraph], bundle: DocumentationBundle, context: DocumentationContext) -> [SymbolGraph.Symbol.Identifier: ResolvedTopicReference] {
267+
/// - context: The context that the symbols are a part of.
268+
func referencesForSymbols(in unifiedGraphs: [String: UnifiedSymbolGraph], context: DocumentationContext) -> [SymbolGraph.Symbol.Identifier: ResolvedTopicReference] {
269269
let disambiguatedPaths = pathHierarchy.caseInsensitiveDisambiguatedPaths(includeDisambiguationForUnambiguousChildren: true, includeLanguage: true, allowAdvancedDisambiguation: false)
270270

271271
var result: [SymbolGraph.Symbol.Identifier: ResolvedTopicReference] = [:]
@@ -280,15 +280,15 @@ final class PathHierarchyBasedLinkResolver {
280280
pathComponents.count == componentsCount
281281
{
282282
let symbolReference = SymbolReference(pathComponents: pathComponents, interfaceLanguages: symbol.sourceLanguages)
283-
return ResolvedTopicReference(symbolReference: symbolReference, moduleName: moduleName, bundle: bundle)
283+
return ResolvedTopicReference(symbolReference: symbolReference, moduleName: moduleName, bundle: context.inputs)
284284
}
285285

286286
guard let path = disambiguatedPaths[uniqueIdentifier] else {
287287
return nil
288288
}
289289

290290
return ResolvedTopicReference(
291-
bundleID: bundle.documentationRootReference.bundleID,
291+
bundleID: context.inputs.documentationRootReference.bundleID,
292292
path: NodeURLGenerator.Path.documentationFolder + path,
293293
sourceLanguages: symbol.sourceLanguages
294294
)

Tests/SwiftDocCTests/Infrastructure/SymbolDisambiguationTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@ class SymbolDisambiguationTests: XCTestCase {
189189
}
190190

191191
func testMixedLanguageFramework() async throws {
192-
let (bundle, context) = try await testBundleAndContext(named: "MixedLanguageFramework")
192+
let (inputs, context) = try await testBundleAndContext(named: "MixedLanguageFramework")
193193

194-
var loader = SymbolGraphLoader(bundle: bundle, dataProvider: context.dataProvider)
194+
var loader = SymbolGraphLoader(bundle: inputs, dataProvider: context.dataProvider)
195195
try loader.loadAll()
196196

197-
let references = context.linkResolver.localResolver.referencesForSymbols(in: loader.unifiedGraphs, bundle: bundle, context: context).mapValues(\.path)
197+
let references = context.linkResolver.localResolver.referencesForSymbols(in: loader.unifiedGraphs, context: context).mapValues(\.path)
198198
XCTAssertEqual(Set(references.keys), [
199199
SymbolGraph.Symbol.Identifier(precise: "c:@CM@TestFramework@objc(cs)MixedLanguageClassConformingToProtocol(im)mixedLanguageMethod", interfaceLanguage: "swift"),
200200
.init(precise: "c:@E@Foo", interfaceLanguage: "swift"),
@@ -321,7 +321,7 @@ class SymbolDisambiguationTests: XCTestCase {
321321
let uniqueSymbolCount = Set(swiftSymbols.map(\.preciseID) + objectiveCSymbols.map(\.preciseID)).count
322322
XCTAssertEqual(unified.symbols.count, uniqueSymbolCount)
323323

324-
let bundle = DocumentationBundle(
324+
let inputs = DocumentationBundle(
325325
info: DocumentationBundle.Info(
326326
displayName: "SymbolDisambiguationTests",
327327
id: "com.test.SymbolDisambiguationTests"),
@@ -335,8 +335,8 @@ class SymbolDisambiguationTests: XCTestCase {
335335
objcSymbolGraphURL: try JSONEncoder().encode(graph2),
336336
], fallback: nil)
337337

338-
let context = try await DocumentationContext(bundle: bundle, dataProvider: provider)
338+
let context = try await DocumentationContext(bundle: inputs, dataProvider: provider)
339339

340-
return context.linkResolver.localResolver.referencesForSymbols(in: ["SymbolDisambiguationTests": unified], bundle: bundle, context: context)
340+
return context.linkResolver.localResolver.referencesForSymbols(in: ["SymbolDisambiguationTests": unified], context: context)
341341
}
342342
}

0 commit comments

Comments
 (0)