@@ -82,7 +82,7 @@ struct SymbolGraphLoader {
82
82
83
83
symbolGraphTransformer ? ( & symbolGraph)
84
84
85
- let ( moduleName, isMainSymbolGraph) = Self . moduleNameFor ( symbolGraph, at: symbolGraphURL)
85
+ let ( moduleName, isMainSymbolGraph) = GraphCollector . moduleNameFor ( symbolGraph, at: symbolGraphURL)
86
86
// If the bundle provides availability defaults add symbol availability data.
87
87
self . addDefaultAvailability ( to: & symbolGraph, moduleName: moduleName)
88
88
@@ -205,7 +205,7 @@ struct SymbolGraphLoader {
205
205
private func loadSymbolGraph( at url: URL ) throws -> ( SymbolGraph , isMainSymbolGraph: Bool ) {
206
206
// This is a private method, the `url` key is known to exist
207
207
var symbolGraph = symbolGraphs [ url] !
208
- let ( moduleName, isMainSymbolGraph) = Self . moduleNameFor ( symbolGraph, at: url)
208
+ let ( moduleName, isMainSymbolGraph) = GraphCollector . moduleNameFor ( symbolGraph, at: url)
209
209
210
210
if !isMainSymbolGraph && symbolGraph. module. bystanders == nil {
211
211
// If this is an extending another module, change the module name to match the extended module.
@@ -352,31 +352,7 @@ struct SymbolGraphLoader {
352
352
353
353
return fileName. split ( separator: " @ " , maxSplits: 1 ) . last. map ( { String ( $0) } )
354
354
}
355
-
356
- /// Returns the module name of a symbol graph based on the JSON data and file name.
357
- ///
358
- /// Useful during decoding the symbol graphs to implement the correct name logic starting with the module name in the JSON.
359
- private static func moduleNameFor( _ symbolGraph: SymbolGraph , at url: URL ) -> ( String , Bool ) {
360
- let isMainSymbolGraph = !url. lastPathComponent. contains ( " @ " )
361
355
362
- let moduleName : String
363
- if isMainSymbolGraph || symbolGraph. module. bystanders != nil {
364
- // For main symbol graphs, get the module name from the symbol graph's data
365
-
366
- // When bystander modules are present, the symbol graph is a cross-import overlay, and
367
- // we need to preserve the original module name to properly render it. It is still
368
- // kept with the extension symbols, due to the merging behavior of UnifiedSymbolGraph.
369
- moduleName = symbolGraph. module. name
370
- } else {
371
- // For extension symbol graphs, derive the extended module's name from the file name.
372
- //
373
- // 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
374
- // of the module that was extended (rdar://63200368).
375
- moduleName = SymbolGraphLoader . moduleNameFor ( url) !
376
- }
377
- return ( moduleName, isMainSymbolGraph)
378
- }
379
-
380
356
private static func applyWorkaroundFor139305015( to symbolGraph: inout SymbolGraph ) {
381
357
guard symbolGraph. symbols. values. mapFirst ( where: { SourceLanguage ( id: $0. identifier. interfaceLanguage) } ) == . objectiveC else {
382
358
return
0 commit comments