Skip to content
This repository was archived by the owner on Oct 14, 2021. It is now read-only.

Commit b4b0578

Browse files
author
Jeff Verkoeyen
committed
Add support for Swift output.
1 parent 411f06e commit b4b0578

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

apple/diffreport/diffreportlib/diffreport.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,18 @@ func += (left: inout ApiNameNodeMap, right: ApiNameNodeMap) {
173173

174174
func prettyString(forKind kind: String) -> String {
175175
switch kind {
176+
// Objective-C
176177
case "sourcekitten.source.lang.objc.decl.protocol": return "protocol"
177178
case "sourcekitten.source.lang.objc.decl.typedef": return "typedef"
178179
case "sourcekitten.source.lang.objc.decl.method.instance": return "method"
179180
case "sourcekitten.source.lang.objc.decl.property": return "property"
180181
case "sourcekitten.source.lang.objc.decl.class": return "class"
182+
183+
// Swift
184+
case "source.lang.swift.decl.function.method.instance": return "method"
185+
case "source.lang.swift.decl.var.instance": return "var"
186+
case "source.lang.swift.decl.class": return "class"
187+
181188
default: return kind
182189
}
183190
}
@@ -243,6 +250,11 @@ func extractAPINodeMap(from sourceKittenNode: SourceKittenNode, parentUsr: Strin
243250
for (key, value) in sourceKittenNode {
244251
switch key {
245252
case "key.usr":
253+
if let accessibility = sourceKittenNode["key.accessibility"] {
254+
if accessibility as! String != "source.lang.swift.accessibility.public" {
255+
continue
256+
}
257+
}
246258
var node = apiNode(from: sourceKittenNode)
247259

248260
// Create a reference to the parent node

0 commit comments

Comments
 (0)