@@ -41,8 +41,7 @@ private struct ContextLinkProvider: DocCHTML.LinkProvider {
4141 // This symbol has multiple unique names
4242 let titles = [ SourceLanguage: String] (
4343 titles. map { trait, title in
44- // FIXME: Use 'sourceLanguage' once https://github.com/swiftlang/swift-docc/pull/1355 is merged
45- ( ( trait. interfaceLanguage. map { SourceLanguage ( id: $0) } ?? . swift) , title)
44+ ( trait. sourceLanguage ?? . swift, title)
4645 } ,
4746 uniquingKeysWith: { _, new in new }
4847 )
@@ -95,8 +94,7 @@ private struct ContextLinkProvider: DocCHTML.LinkProvider {
9594 // This symbol has multiple unique names
9695 subheadings = . languageSpecificSymbol( . init(
9796 allSubheadings. map { trait, subheading in (
98- // FIXME: Use 'sourceLanguage' once https://github.com/swiftlang/swift-docc/pull/1355 is merged
99- key: ( trait. interfaceLanguage. map { SourceLanguage ( id: $0) } ?? . swift) ,
97+ key: trait. sourceLanguage ?? . swift,
10098 value: convert ( subheading)
10199 ) } ,
102100 uniquingKeysWith: { _, new in new }
@@ -297,9 +295,8 @@ struct HTMLRenderer {
297295 } else {
298296 names = . languageSpecificSymbol( [ SourceLanguage: String] (
299297 symbol. titleVariants. allValues. compactMap ( { trait, title in
300- // FIXME: Use 'sourceLanguage' once https://github.com/swiftlang/swift-docc/pull/1355 is merged
301- guard let languageID = trait. interfaceLanguage else { return nil }
302- return ( key: SourceLanguage ( id: languageID) , value: title)
298+ guard let language = trait. sourceLanguage else { return nil }
299+ return ( key: language, value: title)
303300 } ) ,
304301 uniquingKeysWith: { _, new in new }
305302 ) )
@@ -319,12 +316,11 @@ struct HTMLRenderer {
319316 // Title
320317 let titleVariants = symbol. titleVariants. allValues. sorted ( by: { $0. trait < $1. trait} )
321318 for (trait, variant) in titleVariants {
322- // FIXME: Use 'sourceLanguage' once https://github.com/swiftlang/swift-docc/pull/1355 is merged
323- guard let lang = trait. interfaceLanguage else { continue }
319+ guard let language = trait. sourceLanguage else { continue }
324320
325321 var classes : [ String ] = [ ]
326322 if titleVariants. count > 1 {
327- classes. append ( " \( lang ) -only " )
323+ classes. append ( " \( language . id ) -only " )
328324 }
329325 if isDeprecated {
330326 classes. append ( " deprecated " )
@@ -375,15 +371,14 @@ struct HTMLRenderer {
375371 if !symbol. declarationVariants. allValues. isEmpty {
376372 // FIXME: Display platform specific declarations
377373
378- var fragmentsByLanguageID = [ SourceLanguage: [ SymbolGraph . Symbol. DeclarationFragments. Fragment] ] ( )
374+ var fragmentsByLanguage = [ SourceLanguage: [ SymbolGraph . Symbol. DeclarationFragments. Fragment] ] ( )
379375 for (trait, variant) in symbol. declarationVariants. allValues {
380- // FIXME: Use 'sourceLanguage' once https://github.com/swiftlang/swift-docc/pull/1355 is merged
381- guard let languageID = trait. interfaceLanguage else { continue }
382- fragmentsByLanguageID [ SourceLanguage ( id: languageID) ] = variant. values. first? . declarationFragments
376+ guard let language = trait. sourceLanguage else { continue }
377+ fragmentsByLanguage [ language] = variant. values. first? . declarationFragments
383378 }
384379
385- if fragmentsByLanguageID . values. contains ( where: { !$0. isEmpty } ) {
386- hero. addChild ( renderer. declaration ( fragmentsByLanguageID ) )
380+ if fragmentsByLanguage . values. contains ( where: { !$0. isEmpty } ) {
381+ hero. addChild ( renderer. declaration ( fragmentsByLanguage ) )
387382 }
388383 }
389384
@@ -411,8 +406,7 @@ struct HTMLRenderer {
411406 renderer. parameters (
412407 [ SourceLanguage: [ MarkdownRenderer < ContextLinkProvider > . ParameterInfo] ] (
413408 symbol. parametersSectionVariants. allValues. map { trait, parameters in (
414- // FIXME: Use 'sourceLanguage' once https://github.com/swiftlang/swift-docc/pull/1355 is merged
415- key: trait. interfaceLanguage. map { SourceLanguage ( id: $0) } ?? . swift,
409+ key: trait. sourceLanguage ?? . swift,
416410 value: parameters. parameters. map {
417411 MarkdownRenderer< ContextLinkProvider> . ParameterInfo( name: $0. name, content: $0. contents)
418412 }
@@ -429,8 +423,7 @@ struct HTMLRenderer {
429423 renderer. returns (
430424 . init(
431425 symbol. returnsSectionVariants. allValues. map { trait, returnSection in (
432- // FIXME: Use 'sourceLanguage' once https://github.com/swiftlang/swift-docc/pull/1355 is merged
433- key: trait. interfaceLanguage. map { SourceLanguage ( id: $0) } ?? . swift,
426+ key: trait. sourceLanguage ?? . swift,
434427 value: returnSection. content
435428 ) } ,
436429 uniquingKeysWith: { _, new in new }
@@ -546,8 +539,13 @@ struct HTMLRenderer {
546539// Note; this isn't a Comparable conformance because I wanted it to be private to this file.
547540private extension DocumentationDataVariantsTrait {
548541 static func < ( lhs: DocumentationDataVariantsTrait , rhs: DocumentationDataVariantsTrait ) -> Bool {
549- // FIXME: Use 'sourceLanguage' once https://github.com/swiftlang/swift-docc/pull/1355 is merged
550- ( lhs. interfaceLanguage ?? " " ) < ( rhs. interfaceLanguage ?? " " )
542+ if let lhs = lhs. sourceLanguage {
543+ if let rhs = rhs. sourceLanguage {
544+ return lhs < rhs
545+ }
546+ return true // nil is after anything
547+ }
548+ return false // nil is after anything
551549 }
552550}
553551
0 commit comments