@@ -82,7 +82,7 @@ struct SymbolGraphLoader {
8282
8383 symbolGraphTransformer ? ( & symbolGraph)
8484
85- let ( moduleName, isMainSymbolGraph) = Self . moduleNameFor ( symbolGraph, at: symbolGraphURL)
85+ let ( moduleName, isMainSymbolGraph) = GraphCollector . moduleNameFor ( symbolGraph, at: symbolGraphURL)
8686 // If the bundle provides availability defaults add symbol availability data.
8787 self . addDefaultAvailability ( to: & symbolGraph, moduleName: moduleName)
8888
@@ -205,7 +205,7 @@ struct SymbolGraphLoader {
205205 private func loadSymbolGraph( at url: URL ) throws -> ( SymbolGraph , isMainSymbolGraph: Bool ) {
206206 // This is a private method, the `url` key is known to exist
207207 var symbolGraph = symbolGraphs [ url] !
208- let ( moduleName, isMainSymbolGraph) = Self . moduleNameFor ( symbolGraph, at: url)
208+ let ( moduleName, isMainSymbolGraph) = GraphCollector . moduleNameFor ( symbolGraph, at: url)
209209
210210 if !isMainSymbolGraph && symbolGraph. module. bystanders == nil {
211211 // If this is an extending another module, change the module name to match the extended module.
@@ -352,31 +352,7 @@ struct SymbolGraphLoader {
352352
353353 return fileName. split ( separator: " @ " , maxSplits: 1 ) . last. map ( { String ( $0) } )
354354 }
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 ( " @ " )
361355
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-
380356 private static func applyWorkaroundFor139305015( to symbolGraph: inout SymbolGraph ) {
381357 guard symbolGraph. symbols. values. mapFirst ( where: { SourceLanguage ( id: $0. identifier. interfaceLanguage) } ) == . objectiveC else {
382358 return
0 commit comments