@@ -80,7 +80,7 @@ struct SymbolGraphLoader {
8080
8181 symbolGraphTransformer ? ( & symbolGraph)
8282
83- let ( moduleName, isMainSymbolGraph) = Self . moduleNameFor ( symbolGraph, at: symbolGraphURL)
83+ let ( moduleName, isMainSymbolGraph) = GraphCollector . moduleNameFor ( symbolGraph, at: symbolGraphURL)
8484 // If the bundle provides availability defaults add symbol availability data.
8585 self . addDefaultAvailability ( to: & symbolGraph, moduleName: moduleName)
8686
@@ -193,7 +193,7 @@ struct SymbolGraphLoader {
193193 private func loadSymbolGraph( at url: URL ) throws -> ( SymbolGraph , isMainSymbolGraph: Bool ) {
194194 // This is a private method, the `url` key is known to exist
195195 var symbolGraph = symbolGraphs [ url] !
196- let ( moduleName, isMainSymbolGraph) = Self . moduleNameFor ( symbolGraph, at: url)
196+ let ( moduleName, isMainSymbolGraph) = GraphCollector . moduleNameFor ( symbolGraph, at: url)
197197
198198 if !isMainSymbolGraph && symbolGraph. module. bystanders == nil {
199199 // If this is an extending another module, change the module name to match the extended module.
@@ -340,31 +340,7 @@ struct SymbolGraphLoader {
340340
341341 return fileName. split ( separator: " @ " , maxSplits: 1 ) . last. map ( { String ( $0) } )
342342 }
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 ( " @ " )
349343
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-
368344 private static func applyWorkaroundFor139305015( to symbolGraph: inout SymbolGraph ) {
369345 guard symbolGraph. symbols. values. mapFirst ( where: { SourceLanguage ( id: $0. identifier. interfaceLanguage) } ) == . objectiveC else {
370346 return
0 commit comments