@@ -14,30 +14,24 @@ fileprivate func representation(of symbol: Symbol, in module: Module) -> String?
1414 return nil
1515 }
1616
17- if let declaration = symbol. declaration as? Enumeration . Case ,
18- !module. symbols. contains ( where: { $0. declaration is Enumeration &&
19- $0. isPublic &&
20- $0. name == declaration. context } )
21- {
22- return nil
23- }
17+ let context = symbol. context. compactMap {
18+ switch $0 {
19+ case let `extension` as Extension :
20+ return `extension`. extendedType
21+ case let symbol as Symbol :
22+ return symbol. name
23+ default :
24+ return nil
25+ }
26+ } . joined ( separator: " . " )
2427
2528 switch symbol. declaration {
2629 case let declaration as Variable :
27- var representation : String
28- if let context = declaration. context {
29- representation = (
30- declaration. attributes. map { $0. description } +
31- declaration. nonAccessModifiers. map { $0. description } +
32- [ " var " , context + " . " + declaration. name]
33- ) . joined ( separator: " " )
34- } else {
35- representation = (
36- declaration. attributes. map { $0. description } +
37- declaration. nonAccessModifiers. map { $0. description } +
38- [ " var " , declaration. name]
39- ) . joined ( separator: " " )
40- }
30+ var representation = (
31+ declaration. attributes. map { $0. description } +
32+ declaration. nonAccessModifiers. map { $0. description } +
33+ [ " var " , context + " . " + declaration. name]
34+ ) . joined ( separator: " " )
4135
4236 if declaration. keyword == " let " ||
4337 declaration. modifiers. contains ( where: { $0. name == " private " && $0. detail == " set " } ) {
@@ -48,20 +42,11 @@ fileprivate func representation(of symbol: Symbol, in module: Module) -> String?
4842
4943 return representation
5044 case let declaration as Function :
51- var representation : String
52- if let context = declaration. context {
53- representation = (
54- declaration. attributes. map { $0. description } +
55- declaration. nonAccessModifiers. map { $0. description } +
56- [ declaration. keyword, context + " . " + declaration. identifier]
57- ) . joined ( separator: " " )
58- } else {
59- representation = (
60- declaration. attributes. map { $0. description } +
61- declaration. nonAccessModifiers. map { $0. description } +
62- [ declaration. keyword, declaration. identifier]
63- ) . joined ( separator: " " )
64- }
45+ var representation = (
46+ declaration. attributes. map { $0. description } +
47+ declaration. nonAccessModifiers. map { $0. description } +
48+ [ declaration. keyword, context + " . " + declaration. identifier]
49+ ) . joined ( separator: " " )
6550
6651 if !declaration. genericParameters. isEmpty {
6752 representation += " < \( declaration. genericParameters. map { $0. description } . joined ( separator: " , " ) ) > "
@@ -86,10 +71,9 @@ fileprivate func representation(of symbol: Symbol, in module: Module) -> String?
8671 var representation = (
8772 declaration. attributes. map { $0. description } +
8873 declaration. nonAccessModifiers. map { $0. description } +
89- [ declaration. keyword, declaration . context! ]
74+ [ declaration. keyword, context]
9075 ) . joined ( separator: " " )
9176
92-
9377 if declaration. optional {
9478 representation += " ? "
9579 }
@@ -109,7 +93,7 @@ fileprivate func representation(of symbol: Symbol, in module: Module) -> String?
10993 var representation = (
11094 declaration. attributes. map { $0. description } +
11195 declaration. nonAccessModifiers. map { $0. description } +
112- [ ( declaration . context ?? " " ) + declaration. keyword]
96+ [ context + declaration. keyword]
11397 ) . joined ( separator: " " )
11498
11599 if !declaration. genericParameters. isEmpty {
@@ -139,7 +123,7 @@ fileprivate func representation(of symbol: Symbol, in module: Module) -> String?
139123 var representation = (
140124 declaration. attributes. map { $0. description } +
141125 declaration. nonAccessModifiers. map { $0. description } +
142- [ /* declaration.keyword, FIXME*/ symbol. id. description]
126+ [ declaration. keyword, symbol. id. description]
143127 ) . joined ( separator: " " )
144128
145129 if let genericParameters = ( declaration as? Generic ) ? . genericParameters,
0 commit comments