This repository was archived by the owner on Jun 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,17 @@ public final class Symbol {
41
41
return true
42
42
}
43
43
44
- if declaration is Enumeration . Case ,
45
- let enumeration = context. compactMap ( { ( $0 as? Symbol ) ? . declaration as? Enumeration } ) . last,
46
- enumeration. modifiers. contains ( where: { $0. name == " public " } ) {
47
- return true
44
+ if let symbol = context. compactMap ( { $0 as? Symbol } ) . first,
45
+ symbol. declaration. modifiers. contains ( where: { $0. name == " public " } )
46
+ {
47
+ switch symbol. declaration {
48
+ case is Enumeration :
49
+ return declaration is Enumeration . Case
50
+ case is Protocol :
51
+ return declaration is Function || declaration is Variable
52
+ default :
53
+ break
54
+ }
48
55
}
49
56
50
57
return false
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ final class SourceFileTests: XCTestCase {
29
29
public struct S {}
30
30
31
31
/// Extension
32
- extension S: P {
32
+ public extension S: P {
33
33
/// Function
34
34
func f() {}
35
35
@@ -40,10 +40,10 @@ final class SourceFileTests: XCTestCase {
40
40
/// Class
41
41
open class C: P{
42
42
/// Function
43
- func f() {}
43
+ public func f() {}
44
44
45
45
/// Property
46
- var p: Any { return () }
46
+ public var p: Any { return () }
47
47
}
48
48
49
49
/// Subclass
@@ -58,6 +58,10 @@ final class SourceFileTests: XCTestCase {
58
58
59
59
XCTAssertEqual ( sourceFile. symbols. count, 12 )
60
60
61
+ for symbol in sourceFile. symbols {
62
+ XCTAssert ( symbol. isPublic, " \( symbol. declaration) isn't public " )
63
+ }
64
+
61
65
do {
62
66
let `protocol` = sourceFile. symbols [ 0 ]
63
67
XCTAssert ( `protocol`. declaration is Protocol )
You can’t perform that action at this time.
0 commit comments