@@ -80,7 +80,7 @@ struct SymbolGraphLoader {
80
80
81
81
symbolGraphTransformer ? ( & symbolGraph)
82
82
83
- let ( moduleName, isMainSymbolGraph) = Self . moduleNameFor ( symbolGraph, at: symbolGraphURL)
83
+ let ( moduleName, isMainSymbolGraph) = GraphCollector . moduleNameFor ( symbolGraph, at: symbolGraphURL)
84
84
// If the bundle provides availability defaults add symbol availability data.
85
85
self . addDefaultAvailability ( to: & symbolGraph, moduleName: moduleName)
86
86
@@ -193,7 +193,7 @@ struct SymbolGraphLoader {
193
193
private func loadSymbolGraph( at url: URL ) throws -> ( SymbolGraph , isMainSymbolGraph: Bool ) {
194
194
// This is a private method, the `url` key is known to exist
195
195
var symbolGraph = symbolGraphs [ url] !
196
- let ( moduleName, isMainSymbolGraph) = Self . moduleNameFor ( symbolGraph, at: url)
196
+ let ( moduleName, isMainSymbolGraph) = GraphCollector . moduleNameFor ( symbolGraph, at: url)
197
197
198
198
if !isMainSymbolGraph && symbolGraph. module. bystanders == nil {
199
199
// If this is an extending another module, change the module name to match the extended module.
@@ -340,31 +340,7 @@ struct SymbolGraphLoader {
340
340
341
341
return fileName. split ( separator: " @ " , maxSplits: 1 ) . last. map ( { String ( $0) } )
342
342
}
343
-
344
- /// Returns the module name of a symbol graph based on the JSON data and file name.
345
- ///
346
- /// Useful during decoding the symbol graphs to implement the correct name logic starting with the module name in the JSON.
347
- private static func moduleNameFor( _ symbolGraph: SymbolGraph , at url: URL ) -> ( String , Bool ) {
348
- let isMainSymbolGraph = !url. lastPathComponent. contains ( " @ " )
349
343
350
- let moduleName : String
351
- if isMainSymbolGraph || symbolGraph. module. bystanders != nil {
352
- // For main symbol graphs, get the module name from the symbol graph's data
353
-
354
- // When bystander modules are present, the symbol graph is a cross-import overlay, and
355
- // we need to preserve the original module name to properly render it. It is still
356
- // kept with the extension symbols, due to the merging behavior of UnifiedSymbolGraph.
357
- moduleName = symbolGraph. module. name
358
- } else {
359
- // For extension symbol graphs, derive the extended module's name from the file name.
360
- //
361
- // The per-symbol `extendedModule` value is the same as the main module for most symbols, so it's not a good way to find the name
362
- // of the module that was extended (rdar://63200368).
363
- moduleName = SymbolGraphLoader . moduleNameFor ( url) !
364
- }
365
- return ( moduleName, isMainSymbolGraph)
366
- }
367
-
368
344
private static func applyWorkaroundFor139305015( to symbolGraph: inout SymbolGraph ) {
369
345
guard symbolGraph. symbols. values. mapFirst ( where: { SourceLanguage ( id: $0. identifier. interfaceLanguage) } ) == . objectiveC else {
370
346
return
0 commit comments